I'm working on a project where I want to get OpenGL graphics to display in an X11 window. This needs to be done on Ubuntu 12.04 and I am using Mesa's version of OpenGL ES 2.0 and egl. There are a couple of shaders that get compiled and they work fine, but when I get to the one, gdb is showing that the segfault is happening at glCompile()
with this fragment shader:
const char PixmapShaderFrag[] =
"precision mediump float; \n"
"varying vec2 vTexCoord; \n"
"varying vec4 vColor; \n"
"uniform sampler2D sTexture; \n"
"void main() \n"
"{ \n"
" gl_FragColor = texture2D(sTexture, vTexCoord); \n"
"} \n";
EDIT:
Here is another fragment shader that compiles before the one above and doesn't seem to cause any issues:
const char RectShaderFrag[] =
"precision mediump float; \n"
"varying vec4 vColor; \n"
"void main() \n"
"{ \n"
" gl_FragColor = vColor; \n"
"} \n";
The only big difference between the PixmapShaderFrag
shader and the others is texture2D()
, so I think that might be what is causing the segfault. Does anyone know if there is a problem with Mesa and using texture2D()
, or is there something else wrong with the shader? Is there perhaps another way I can do what texture2D()
does even if it requires more shader code?`