Archived

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

danielk

OpenGL woes

Recommended Posts

Hi. In a nutshell, I''m currently developing a 3d engine using OpenGL, and it''s not a fast as I would have liked it to be thus far. Basically, my engine starts to get pretty sluggish when passing about 1000 triangles or so. My current setup is a K6-2 300mhz, 64meg RAM, and a Voodoo 3000 PCI (Don''t laugh). I havnt implemented a BSP/Octree system as of yet. But it does perform backface culling, so only half of the total polys have to be rendered. All my program does whilst rendering the scene is loop through an array of vertex data (not an OpenGL vertex array, but my own), and render the textured triangles, no normal calculation, no lighting, no antialialising etc. Quite alot of OpenGL apps seem to run pretty slowly on my machine, but Quake 2 runs perfectly fine???? Is there anything special about Quake 2 OpenGl code??? Or am I just being stupid?^_^ I am using gluLookat for my camera positioning, would this slow things down at all??? Any suggestions???? Thanx ^_^ Transformers Rulez!!

Share this post


Link to post
Share on other sites
Lose the glVertex3f(...) calls and instead send vertex arrays to OpenGL. Also, if you can do some efficient frustrum culling, that would speed things up significantly. What you really need is some spacial data structure. Even a simple grid would work.

Share this post


Link to post
Share on other sites
I''m not expert, in fact (much) closer to a complete beginner, but I have experimented with the effect of culling anything behind and anything too far in front (still working on true frustrum culling) The effect on frame rates of just this is it''s quite impressive. Of course, it depends on how many non-visible vertices your trying to draw.

Also, and this may not apply to the Voodoo 3000, but I recall my old Voodoo 2000 could be a real pig with OpenGL (several of NeHe''s examples just would not work with it on my machine).

Stephen

Share this post


Link to post
Share on other sites
Thanx for all the info people, I''ll give it a go ^_^

And yeah, I can only render in 16-bit mode unfortunately...

As an example, I have written a world editor which uses prefabricated vertex data in txt files as brushes. For testing puposes, I load a cube brush from disk. Composed of 12 polygons (I know its not very efficient to repeat vertices, but I''m pretty inexperienced at the mo). I have back face culling enabled, and not much else. I can draw about 80 brushes before slowdown, or 960 triangles, and half of those aren''t even being rendered. So I''m drawing about 480 triangles per frame...Which isnt much at all. Even when I rotate the camera so nothing is actually rendered, the frame rate stays pretty much the same... if Quake 3 draws what, 5-7k triangles on a screen at any one time?? Quake 2 should be a little less. Quake 2 ran faster on my old P133 with a first gen diamond monster 3dfx, than my world editor on my current setup....

I''m a little perplexed to say the least ^_^

Transformers Rulez!!

Share this post


Link to post
Share on other sites
if quake 2 runs on ur system fine, then y dont u take a look at the FREE source code? there was a article in the news about it a little while back, check it out, see what techniques they used to find out what whill work well on ur comp

,Matt

-= kill one, your a murderer, kill thousands your a conquerer =-

Share this post


Link to post
Share on other sites
I wasnt aware of the source code until now. Thanx ^_^

I''ve downloaded the source code, and have had a look at, what seems to be part of the rendering system. The code in itself seems pretty uncommented, and slightly obscure, but I''m sure with a little time and effort, I might be able to make some sense of it.

At a glance, it seems to me that it didnt use the standard OpenGL implementation, but used an external DLL of some sort ( hinted by the numerous and varying dllWhateverFunctionApplies() calls), maybe based on 3DFX, which would give a hint as to why it runs so well on 3dfx based cards. I cannot find any standard gl calls anywhere. But I can locate similar calls. Maybe the speed difference has something to do with this, as Quake2 is the ONLY opengl based app which runs very smoothly on my machine. Unreal using OpenGL rendering is very jumpy, and some demos wont work at all.....

Transformers Rulez!!

Share this post


Link to post
Share on other sites