bkloppenborg / simtoi

The SImulation and Modeling Tool for Optical Interferometry
GNU General Public License v3.0
7 stars 6 forks source link

Switch rendering to OpenGL 3.3 (or later) specifications #69

Closed bkloppenborg closed 10 years ago

bkloppenborg commented 10 years ago

At present most of SIMTOI uses the old 1.20 OpenGL pipeline and renders models in a very inefficient fashion. These should probably be evaluated and upgraded to modern specifications.

The current immediate mode rendering leads to very poor performance as noted in #70.

bkloppenborg commented 10 years ago

Further investigation of #70 showed that the rendering itself was exceptionally slow. Therefore I re-implemented the concentric ring disk model in OpenGL 3.2 using GLFW and GLEW using VBOs and element arrays. SIMTOI can render the model at a rate of ~22 frames per second. This new implementation does ~450 fps on my NVidia 8600m GT laptop. This acceleration, ~21 times, justifies switching from immediate mode rendering which is presently in SIMTOI to vertex buffers.

Doing this switch will require an almost complete rewrite of all of the OpenGL-related code including CWorkerThread, all models, and all shaders. After inspecting the code, here is a list of things needing to be changed:

Core program

CWorkerThread:

CModel:

CShader

bkloppenborg commented 10 years ago

All of the above items have been completed. Almost all models have been ported to OpenGL 3.2 CORE as of 8dea6bfaff393ceed27ec95737ef0390f53f4556. Rendering tests with the Pascucci disk model are very promising:

Direct rendering mode with Pascucci disk model.
Completed 3 iterations in 41.413 seconds.
Throughput: 0.072441 iterations/second.

That is, 15.1 FPS. The VBO-based model

VBO rendering mode with Pascucci disk model:
Completed 9 iterations in 23.361 seconds.
Throughput: 0.385257 iterations/second.

That is, 80.5 FPS. This is a speed up of ~5.3 times for a model of the same complexity.

bkloppenborg commented 10 years ago

All changed completed by commit 931a725.