OpenGL optimization - performances issue

Started by
15 comments, last by polar01 14 years, 5 months ago
Hi, I'm trying to display a model with : - 652000 vertices / normals - 166000 faces I'm currently using the display list but it is VERY slow, it is even difficult to rotate the model. Do you have some councils to help me to have better performance ? I have try the VBO, but I got a NullReferenceException when I call : int vertexVBO; Gl.glGenBuffersARB(1, out vertexVBO);
--------------------------------------------------------------------------------Aurora Studio - PureLight - Animation & rendering software and API.http://www.polarlights.net
Advertisement
You should post your source code, as looking what's wrong without source is pretty impossible.
VBO is definitely the answer.
I only do this :

int vertexVBO;
Gl.glGenBuffersARB(1, out vertexVBO);

I do this where currently I use glVertex3d...

If you want to see the code you can get it at http://rs.codeplex.com
In the class GLRenderer (The VBO code is currently commented).

Thanks
--------------------------------------------------------------------------------Aurora Studio - PureLight - Animation & rendering software and API.http://www.polarlights.net
It seems that every frame you call 'Gl.glBufferSubDataARB', causing your model to be uploaded to the video card at every frame.
Yes, you're right...

It is the way I have write the code and it is wrong for performance :-P

But currently, this doesn't work because the first call to "glGenBuffersARB" crash :-(
--------------------------------------------------------------------------------Aurora Studio - PureLight - Animation & rendering software and API.http://www.polarlights.net
I'm trying to play with glDrawElements and DisplayList... but it change nothing.

Another problem is that I must create 3 arrays of datas for glDrawElement:
- Indices
- Vertices
- Textures

Then save them to memory and only after I can call glDrawElements !!!

I do this only 1 time... after I use the display list...

But it is still slow !
--------------------------------------------------------------------------------Aurora Studio - PureLight - Animation & rendering software and API.http://www.polarlights.net
Perhaps you should do something like this intead:

int[] vertexVBO = new int[ 1 ];
gl.glGenBuffersARB( 1, vertexVBO, 0 );
[ignore]

[Edited by - knighty on October 29, 2009 7:16:46 AM]
Quote:Original post by knighty
Perhaps you should do something like this intead:

int[] vertexVBO = new int[ 1 ];
gl.glGenBuffersARB( 1, vertexVBO, 0 );


Nope, the original code is correct. What you are doing will also work, but there's no need for that. (Note that this code is in C#/Tao, while you've linked to a JOGL tutorial :) ).

To the OP: what exception are you getting on the glGenBuffersARB crash? If it is a null reference exception, then 99% you are accessing initializing the Gl class before the OpenGL context is ready. (This is an error and you are lucky for getting this far without crashes :) ).

[OpenTK: C# OpenGL 4.4, OpenGL ES 3.0 and OpenAL 1.1. Now with Linux/KMS support!]

Quote:Original post by Fiddler
Quote:Original post by knighty
Perhaps you should do something like this intead:

int[] vertexVBO = new int[ 1 ];
gl.glGenBuffersARB( 1, vertexVBO, 0 );


Nope, the original code is correct. What you are doing will also work, but there's no need for that. (Note that this code is in C#/Tao, while you've linked to a JOGL tutorial :) ).

Indeed!
What a shame!

This topic is closed to new replies.

Advertisement