I am following the WikiBooks OpenGL Tutorial # 2
I can't get my shader to compile, it says #version must occur first.
Here is the main.cpp code: https://gitorious.org/wikibooks-opengl/modern-tutorials/blobs/master/tut02_clean/triangle.cpp
Here is the shader utility code: https://gitorious.org/wikibooks-opengl/modern-tutorials/blobs/master/common/shader_utils.cpp
Here is the vertex shader that is causing the error: https://gitorious.org/wikibooks-opengl/modern-tutorials/blobs/master/tut02_clean/triangle.v.glsl
I can't seem to figure out why I'm getting this error, because in the shader #version is first.
Are you sure that the error is showing up in reading and creating a shader? I ask because you have an error in main.cpp. You set compile_ok
to GL_FALSE
, then never assign to it again, then check it and exit if it's GL_FALSE
. So you're guaranteed to always exit and print "Error in fragment shader".
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.