Beginner SpeedUp

Started by
10 comments, last by FabioPal 20 years, 12 months ago
I'm trying to write an OpenGL 3D Engine using C++... I've read the tutorial about the Display List, (it should be number 6...), my question is simple: How about the speedup? consider that my engine already moves easily about 10000 polygons without using strips or fans on an AthlonXP 1800+ with GeForce2MX using dynamic lights. Consider that I cannot use extensions because my intentions is to port the engine on Linux and I cannot rely on the specific platform or implementation of OGL. Thank you all!!! FabioPal [edited by - FabioPal on April 30, 2003 8:42:04 AM]
---------------------------------------There are 10 type of people:those who knows binary codeand those who doesn't---------------------------------------
Advertisement
Display Lists - You might see some improvement, you might see some improvement, but probably not as much as you would hope. I''ve never been a big fan of them. Display lists are also part of OpenGL 1.1 (were they in 1.0 anyone?), so should be supported EVERYWHERE.

Instead of Display Lists...take a look at Vertex Arrays. True, these are "extensions", however they are a built-in as of OpenGL 1.3. Vertex arrays on models as big as you''re talking about, should buy you a lot of performance, because right now you''re probably sending lots of little calls down the OpenGL pipeline, and with vertex arrays, you''ll be sending big chuncks of data, making it faster.

I would also say...most Linux distros have a version of OpenGL that has vertex arrays. Go for it.

- sighuh?
- sighuh?
just a question; are you sure that vertex arrays come with gl 1.3? IMHO it exists in 1.1, that''s why we can use it without extension mechanism in Windows..
-----------my quote is under construction
Look into the following commands for vertex arrays:

glEnableClientState(GLenum array);// Available Options:// GL_COLOR_ARRAY // GL_EDGE_FLAG_ARRAY // GL_INDEX_ARRAY // GL_NORMAL_ARRAY // GL_TEXTURE_COORD_ARRAY // GL_VERTEX_ARRAY // Then you can create/draw/etc. vertex arrays with the following...void glVertexPointer(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);void glDrawArrays(GLenum mode, GLint first, GLsizei count);void glArrayElement(GLint index); 

It''s not trivial to use, but it''s not that hard either. Worth looking into I''d say.

- sighuh?
- sighuh?
I think you''re right, I use headers and lib files from OGL1.1 and I can use Display Lists...

FabioPal
---------------------------------------There are 10 type of people:those who knows binary codeand those who doesn't---------------------------------------
quote:Original post by mentat
just a question; are you sure that vertex arrays come with gl 1.3? IMHO it exists in 1.1, that's why we can use it without extension mechanism in Windows..

I'm sorry...It (vertex array) is in 1.2, but not 1.1.

You can use them in 1.1 sure...but they aren't part of the base OGL implementation.

Me not fully awake yet.

- sighuh?

[edited by - redragon on April 30, 2003 9:06:41 AM]

[edited by - redragon on April 30, 2003 9:07:25 AM]
- sighuh?
quote:Original post by redragon
Look into the following commands for vertex arrays:
...
It''s not trivial to use, but it''s not that hard either. Worth looking into I''d say.
...


thank you... but an example of real code???



FabioPal
---------------------------------------There are 10 type of people:those who knows binary codeand those who doesn't---------------------------------------
I''m not saying this is right...and it''s just a quick and dirty example.
GLfloat vert[] = {0.0,0.5, -0.5,-0.5, 0.5,-0.5};GLfloat color[] = {1.0,0.0,0.0, 0.0,1.0,0.0, 0.0,0.0,1.0};glEnableClientState(GL_COLOR_ARRAY | GL_VERTEX_ARRAY);glColorPointer(3, GL_FLOAT, 0, color);glVertexPointer(2, GL_FLOAT, 0, vert);glBegin();    glDrawArrays(GL_POLYGON,0,3);glEnd(); 

I''m not sure it''s right...kind of managed to confuse myself this morning...but try it.
- sighuh?
And I'm full of it....

Vertex arrays are in 1.1. Apparently I'm just really asleep at the wheel.

[edited by - redragon on April 30, 2003 9:33:19 AM]
- sighuh?
You''re telling me that all the stuff is about putting ALL the coords, colors and normals into some arrays????

I should rewrite all my engine!!!!

---------------------------------------
There are 10 type of people:
those who knows binary code
and those who doesn''t
---------------------------------------
---------------------------------------There are 10 type of people:those who knows binary codeand those who doesn't---------------------------------------

This topic is closed to new replies.

Advertisement