On 10-06-06 12:26 PM, Gijs wrote:
Glad we cleared that up :)

Anyway, I tried it out, but I couldn't get it to work either. glGetUniformfv seemed to be defined as glGetUniformfv(programloc, varloc, returnvalues) in PyOpenGL, same as the default C spec. Normal PyOpenGL functions aren't defined this way. As you said, the return values are normally returned instead of passed along with the function call.

When I tried to call it with three parameters, it did not even touch the returnvariable. So I assume there is a bug somewhere. Also, the function requires an array to be passed as a returnvariable, but the return value is always one value, never an array. You simply cannot ask for the values of an entire shader-array. You'd need to call glGetUniformfv for each element of the array.

It might work if you pass a ctypes float along with it, however I have no experience with ctypes stuff, so I'll leave that to the experts.

This function should get wrapped to create the array automatically.  In the meantime, this is a sample that should work:

                glUniform4fv(
                    self.uniform_locations['lights'],
                    12,
                    self.LIGHTS
                )
                test_lights = (GLfloat * 12)()
                glGetUniformfv( self.shader, self.uniform_locations['lights'], test_lights )
                print 'Lights', list(test_lights)

You should be able to pass any writable PyOpenGL array type (e.g. a numpy array) as params.

HTH,
Mike

On 6/6/10 16:06 , Ian Mallett wrote:
On Sun, Jun 6, 2010 at 1:31 AM, Gijs <info@bsnw.nl> wrote:
I don't think I've ever had to use it before, but you usually give the program location and the variable location. So it would be something like this:
value = glGetUniformfv(programloc, varloc)
Oops!  I actually tried that.  Typo. 
value=glGetUniformfv(programlocation)
Should have been:
value=glGetUniformfv(program,location)
Ian


-- 
________________________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://www.vrplumber.com
  http://blog.vrplumber.com