[PyOpenGL-Users] [SOLVED] glDrawArrays and PyOpenGL 3.0.0a6 anything changed?
Brought to you by:
mcfletch
From: V. A. S. <so...@es...> - 2007-10-05 07:40:58
|
Hello again, PROBLEM The following code was working fine on PyOpenGL 2.0.1.09: GL.glVertexPointerf(self.vertices) GL.glColorPointerf(self.vertexColors) GL.glEnableClientState(GL.GL_VERTEX_ARRAY) GL.glEnableClientState(GL.GL_COLOR_ARRAY) GL.glDrawArrays(GL.GL_POINTS, 0, xsize*ysize) but now it does not work under PyOpenGL 3.0.0.a6: WindowsError: exception: access violation reading 0x0BD20028 If instead of using glDrawArrays, I loop for all the vertices and colors, the program works (of course very slowly): GL.glBegin(GL.GL_POINTS) for i in range(xsize * ysize): GL.glColor4fv(self.vertexColors[i]) GL.glVertex(self.vertices[i]) GL.glEnd() SOLUTION I set a white color with glColor3ub(255, 255, 255) and removed the glEnableClientState(GL_COLOR_ARRAY) and I got my image plotted. I checked the type of my arrays and found out they were float64 (and not float32). It seems glVertexPointerf and glColor4fv convert doubles to floats and nothing happens but glColorPointerf is unable to do it. Just changing glColorPointerf(self.vertexColors) by glColorPointerd(self.vertexColors) solved my problem. I prefer to have the things forced and to avoid automatic transformations, but I would have preferred a clearer error message :-) Thanks for your time, Armando |