eeucalyptus / eeDA_legacy

Electronic Design Aid
Apache License 2.0
1 stars 0 forks source link

Move away from immediate verticies #11

Closed eeucalyptus closed 7 years ago

eeucalyptus commented 7 years ago

Currently, all geometry is drawn using immediate GL calls in the form of:

self.gl.glBegin(self.gl.GL_QUADS)

self.gl.glVertex3d(0, 0, -1)
self.gl.glVertex3d(0, 100, -1)
self.gl.glVertex3d(100, 100, -1)
self.gl.glVertex3d(100, 0, -1)

self.gl.glEnd()

This is one way of drawing in OpenGL. But there are also other ways of drawing meshes, namely vertex arrays and vertex buffer objects. These seem to provide better performance, although I don't know about the actual performance improvement, because we are already using display lists.

Maybe we should consider changing to one of the other schemes, because the old scheme was removed in OpenGL 3.0. Although we are using OpenGL 2.1, it might be a good idea to switch anyway, if we want to change to a newer version of OpenGL some day.

Some topic related reading: http://www.songho.ca/opengl/gl_vertexarray.html - difference between the schemes http://www.songho.ca/opengl/gl_vbo.html - explaination on vertex buffer objects https://gist.github.com/MorganBorman/4243336 - vertex array with pygame http://www.siafoo.net/snippet/316 - two schemes in PyQt4 (similar to PyQt5...)

Musicted commented 7 years ago

On it :)

Musicted commented 7 years ago

Should be done, I'll close this for now.