[PyOpenGL-Users] VBO help and performance
Brought to you by:
mcfletch
From: Wakefield, R. <rjw...@en...> - 2010-05-01 07:20:54
|
Hello, I've been using PyOpenGL to try to get faster graphics in pygame, and from what I've been able to find online VBOs are the best way to optimize in my case (2D sprites and tiled backgrounds). However, for some reason they and the vertex arrays they're based on won't work. In even the simplest example, nothing appears, while the corresponding display list or glBegin/End call works without a hitch. Am I missing something, or could this be a technical issue? Any other ideas as to what's wrong? The code I have in the draw test is listed below (I also tried to generate/bind buffers, to no effect, but I think the problem is the array): # shows nothing; also didn't work with GL_INT and integer types or typing in the '.0' for decimal. vertices = numpy.array([0,0, 0,128, 128,128], dtype=numpy.float32) glEnableClientState(GL_VERTEX_ARRAY) glVertexPointer(2, GL_FLOAT, 0, vertices) glDrawArrays(GL_TRIANGLES, 0, 3) glDisableClientState(GL_VERTEX_ARRAY) # this, however, works fine. The data points and mode (GL_TRIANGLES) are both identical glBegin(GL_TRIANGLES) glVertex2f(0.0, 0.0) glVertex2f(0.0, 128.0) glVertex2f(128.0, 128.0) glEnd() |