错误:ImGui_ImplOpenGL3_CreateDeviceObjects:无法编译顶点着色器!使用 GLSL:调用 ImGui_ImplGlfw_NewFrame() 时在 imgui 中为 4.60 NVIDIA; [关闭]

问题描述 投票:0回答:0

我正在尝试向我在 visual studio 中的 opengl 测试项目添加一个基本的 gui,但现在它随机停止工作并开始说

ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to compile vertex shader! With GLSL: 4.60 NVIDIA
0(1) : error C0000: syntax error, unexpected floating point constant at token "<float-const>"
0(6) : error C5060: out can't be used with non-varying Frag_UV
0(7) : error C5060: out can't be used with non-varying Frag_Color
0(12) : warning C1503: undefined variable "ProjMtx"
ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to compile fragment shader! With GLSL: 4.60 NVIDIA
0(1) : error C0000: syntax error, unexpected floating point constant at token "<float-const>"
0(5) : error C5060: out can't be used with non-varying Out_Color
0(8) : warning C1503: undefined variable "Texture"
ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to link shader program! With GLSL 4.60 NVIDIA
Vertex info
-----------
0(1) : error C0000: syntax error, unexpected floating point constant at token "<float-const>"
0(6) : error C5060: out can't be used with non-varying Frag_UV
0(7) : error C5060: out can't be used with non-varying Frag_Color
0(12) : warning C1503: undefined variable "ProjMtx"
(0) : error C2003: incompatible options for link
Fragment info
-------------
0(1) : error C0000: syntax error, unexpected floating point constant at token "<float-const>"
0(5) : error C5060: out can't be used with non-varying Out_Color
0(8) : warning C1503: undefined variable "Texture"
(0) : error C2003: incompatible options for link

不再显示任何图形用户界面

这发生在我第一次调用 ImGui_ImplGlfw_NewFrame() 时;

我尝试用 github 的最新版本替换所有 imgui 代码,但这没有帮助,我也尝试重新排列一些代码(不记得是什么),但这也没有帮助

我用它来创建 imgui 上下文:

IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO(); (void)io;
ImGui::StyleColorsDark();
ImGui_ImplGlfw_InitForOpenGL(window, true);

ImGui_ImplOpenGL3_Init((char*)glGetString(GL_SHADING_LANGUAGE_VERSION));

当我在主循环中运行它时发生错误:

renderer.Clear();
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();

renderer.Clear();只是运行 glClear(GL_COLOR_BUFFER_BIT);

c++ opengl glfw imgui
© www.soinside.com 2019 - 2024. All rights reserved.