Re: [PyOpenGL-Users] glGetUniformLocation causes segmentation faults
Brought to you by:
mcfletch
From: richard h. <rha...@cs...> - 2009-06-25 16:14:38
|
I moved over to my desktop which has a GeForce GTX 260, and is also running 64 bit Ubuntu 9.04. This machine also segfaults when I call glGetUniformLocation. As I expected, the enumeration of the uniform resources changed between my Intel card and this GeForce. The GeForce enumerates as follows for me: glUniform3f(0, 1.0, 0.3, 0.2) glUniform3f(4, 0.85, 0.86, 0.84) glUniform2f(2, 0.30, 0.15) glUniform2f(1, 0.90, 0.85) glUniform3f(3, 0.0, 0.0, 4.0) Also I installed pyopengl using the python-opengl package in apt if that might help at all. I also added calls to glGetError, but it appears that nothing is failing. Below is an excerpt of my changes: ------------------------------------ ... vert = glCreateShader(GL_VERTEX_SHADER) print "glGetError - glCreateShader: ", glGetError() frag = glCreateShader(GL_FRAGMENT_SHADER) print "glGetError - glCreateShader: ", glGetError() glShaderSource(vert, self.vert_src) print "glGetError - glShaderSource: ", glGetError() glShaderSource(frag, self.frag_src) print "glGetError - glShaderSource: ", glGetError() glCompileShader(vert) print "glGetError - glCompileShader: ", glGetError() glCompileShader(frag) print "glGetError - glCompileShader: ", glGetError() program = glCreateProgram() print "glGetError - glCreateProgram: ", glGetError() glAttachShader(program, vert) print "glGetError - glAttachShader: ", glGetError() glAttachShader(program, frag) print "glGetError - glAttachShader: ", glGetError() glValidateProgram(program) print "glGetError - glValidateProgram: ", glGetError() glLinkProgram(program) print "glGetError - glLinkProgram: ", glGetError() glUseProgram(program) print "glGetError - glUseProgram: ", glGetError() # Any of the following will cause a segmentation # fault. (due to the call to glGetUniformLocation) glUniform3f(self.getUniLoc(program, "BrickColor"), 1.0, 0.3, 0.2) ... ------------------------------------ which now gives me the output: GL_VENDOR: NVIDIA Corporation GL_RENDERER: GeForce GTX 260/PCI/SSE2 GL_VERSION: 3.0.0 NVIDIA 180.44 ... glGetError - glCreateShader: 0 glGetError - glCreateShader: 0 glGetError - glShaderSource: 0 glGetError - glShaderSource: 0 glGetError - glCompileShader: 0 glGetError - glCompileShader: 0 glGetError - glCreateProgram: 0 glGetError - glAttachShader: 0 glGetError - glAttachShader: 0 glGetError - glValidateProgram: 0 glGetError - glLinkProgram: 0 glGetError - glUseProgram: 0 Segmentation fault Thanks for the help, Richard On Thu, Jun 25, 2009 at 10:24 AM, Mike C. Fletcher<mcf...@vr...> wrote: > richard hawkins wrote: >> Hello all, >> >> I am having some trouble with a simple test application. I am mixing >> one of the nehe tutorials with the brick example from the OpenGL >> orange book. >> >> Here is my problem, all calls to glGetUniformLocation result in a >> segmentation fault. I removed all calls to glGetUniformLocation, and >> played around with guessing the appropriate values. Doing this I was >> able to get the shader to render correctly, but is not a good way to >> do things. >> > Interesting, my machine bombs out (not a segfault, just an invalid > operation) when trying to do glUseProgram. I'd suspect that something > is failing during compilation and you just aren't retrieving a > compilation error message to see the failure? Don't have time to track > it down this morning (already late for meeting). (Tested on an Ubuntu > 9.04 64-bit with AMD Radeon, btw). > > Good luck, > Mike > > -- > ________________________________________________ > Mike C. Fletcher > Designer, VR Plumber, Coder > http://www.vrplumber.com > http://blog.vrplumber.com > > -- "People who think they know everything really annoy those of us who know we don't" - Bjarne Stroustrup |