2013-04-21 59 views
0

我下面的WikiBooks OpenGL Tutorial # 2麻煩編譯GLSL着色器,必須的#Version出現第一個錯誤

我不能讓我的着色器編譯,它說的#Version必須首先發生。

下面是main.cpp中的代碼:https://gitorious.org/wikibooks-opengl/modern-tutorials/blobs/master/tut02_clean/triangle.cpp

這裏是着色器程序代碼:https://gitorious.org/wikibooks-opengl/modern-tutorials/blobs/master/common/shader_utils.cpp

這是導致錯誤的頂點着色器:https://gitorious.org/wikibooks-opengl/modern-tutorials/blobs/master/tut02_clean/triangle.v.glsl

我似乎無法找出爲什麼我得到這個錯誤,因爲在#version 的着色器中,首先是

回答

-1

您確定在閱讀和創建着色器時顯示錯誤嗎?我問,因爲你在main.cpp中有錯誤。您將compile_ok設置爲GL_FALSE,然後永遠不會再分配給它,然後檢查它並退出,如果它是GL_FALSE。所以你保證總是退出並打印「片段着色器錯誤」。

+0

是的,我在教程中添加了if-then語句,並且我得到一個錯誤,指出tat #version必須發生在其他任何事情之前。但#version首先發生!? – foobar5512 2013-04-21 19:04:18