View Full Version : OpenGL code performance

08-24-2008, 07:22 PM
Hi all, I have a C# OpenGL program which draw a torus and 50 small spheres. It's actually the sample program in chapter 4 of the OpenGL super bible book I'm reading, the sample program is in C++ and I tried to converted to C#.

I have corrected output but terrible performance with my C# program, it takes 500ms to draw the scene, while the orignal sample program is crazily fast.

I'm thinking my problem could be I'm using software implementation of OpenGL on windows, and the sample is using my graphics hardware ? Could anyone help to how to improve my C# program? :( Many thanks.

08-25-2008, 02:07 AM
Try one of the viewers here, if they say something like "vendor: microsoft" then it means you need to install recent drivers for your video card, to have opengl acceleration.

In your code, you can call those to check :

It is possible that when request a GL context with some constraints, it can not create it accelerated, and gives you an unaccelerated context. But normally the gets above should give you the same info as the GL viewers.

08-25-2008, 02:11 AM
Then I you still have problems with performance, with an accelerated context : http://www.opengl.org/wiki/index.php/Performance

08-25-2008, 04:14 PM
I changed something with my set pixel format function, and it returned: vendor ="Intel", renderer= "Intel G915M". Before it returned : vendor ="Microsoft", renderer="GDI Generic".

But the performance of my program still be very slow when I click F5 in Visual studio. But when I used Ctrl + F5, the performance is very, very good.

Thank you very much for your advice :)

08-25-2008, 04:18 PM
as I recall, F5 hooks the debugger in, and CTRL+F5 runs the program on its own. That would explain the discrepancy.

08-25-2008, 04:45 PM
I want to use display list to improve the performance further, I'm reading my book and it says that some openGL commands are not good or does not make sense within a display list. It does not say anything about matrix operations (modelview, projection..)

Can I use these matrix operations within a display list ?

08-25-2008, 04:48 PM
Display lists are obsolete. You can learn them if you want, but in the long run they won't be very helpful.

You'd be better off moving from immediate mode to vertex arrays, or even to VBOs.