Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Koobze

OpenGL Opengl 3d engine...

This topic is 6692 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was wondering what the best method for making an opengl app cycle through all my triangles... I currently have them set up in a linked list, and I have a while loop that cycles through them and renders them all them time. And this is all in a dll, which might be a bad thing. Right now, it takes about 141ms to render 2 unlit, untextured triangles on screen... and that''s the part that''s bugging me. Could anyone offer some advice or point me to some easy-to-understand examples? I have it dynamically at triangles, so I need to have it cycle through them somehow... Any help would be greatly appreciated, --Koobze

Share this post


Link to post
Share on other sites
Advertisement
I''ll be happy to help you if you can give me some details.

First of what kind of engine do you use ?
(octree, quadtree, portal, BSP...)

Second, Are you using C++ and Objects to store polygons ?

Third, I assume that you want to cycle trough your polys because you''re rendering them.
Generally you now the visible on screen objects to be rendered.
And your OpenGL/Direct3D procedure ask the object to give it its polys to render them.
You can use display list in OpenGL.

I don''t really understand where the problem stand...

So, don''t if you can reformulate your question...

-* Sounds, music and story makes the difference between good and great games *-

Share this post


Link to post
Share on other sites
First off, I have no idea what octrees, etc... are
I''m just starting out, trying to get an easy dll with my functions for rendering some triangles. I''m using C++, and I''m using the following type to store the triangles:
struct ObjTriangle {
int Index;
float p1[3], p2[3], p3[3];
float color[3];
ObjTriangle *next;
};
Now, this works all ok and stores my triangles well. I haven''t done any checking on what triangles are visible or not... just trying to get some triangles drawn

Inside my render function, I have the following:
while( TempTriangle !0 NULL ){
glBegin( GL_TRIANGLES );
glVertex3fv( TempTriangle->p1 );
glVertex3fv( TempTriangle->p2 );
glVertex3fv( TempTriangle->p3 );
glEnd();
TempTriangle = TempTriangle->next;
}

The problem is that this is taking too long... I had 2 triangles in the list, and it took 141 milliseconds to render them. Are there any tutorials or anything on how to set this kind of triangle thing up? Or am I just doing something wrong?

Thanks

--Koobze

Share this post


Link to post
Share on other sites
a little off topic, but try moving glBegin and glEnd outside the while, and use a larger number of triangles 10K-100K.


( if you link the dll dynamic, it will first be linked the first time you call the function ( i think ive read somewhere .-) ))

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
ehm... do you have installed the proper opengl drivers for your 3d card?? if you have a voodoo card, finding the right file (opengl32.dll, not a minigl) can be quite a hassle...

spikeD

Share this post


Link to post
Share on other sites
Yeah, I have the right drivers (tnt2).
I just removed the dll, and copied the dll''s code into my actual app, and presto: Everything is nice and fast...

Are there any tutorials on octrees, writing custom lighting, etc... for opengl? because the 8 light limit will eventually get to me

--Koobze

Share this post


Link to post
Share on other sites
I think Claus is right. I am not sure, but I think most of the time is being used by the glBegin() and glEnd(). Testing with a larger set, and moving the glBegin() and glEnd() to the outside of the while loop, will really tell you what is the culprit. Or, you can use a profiler and time everything.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!