Archived

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

CDeity

Direct3D vs OpenGL..

Recommended Posts

Hello there. I''ve been doing Direct3D for a few years and, with DirectX8 out, I decided to see what else was around. So, I''ve read several of these tutorials and wrote a few OpenGL programs. OpenGL seems nice and simple compared to Direct3D, but I am concerned with speed. I decided to test the two, so I wrote a program that generates a high-polygon sphere and renders 1000 frames of it. I was sorely disappointed to discover that Direct3D7 rendered the 1000 frames (800x600x32) in 5400 ms, while OpenGL took over 11000 ms to render it. The code was as similar as it it could be. I''m wondering what I can do to make the OpenGL code run a lot faster. For instance, is there an OpenGL equivalent of a vertex buffer? Can I force OpenGL to do hardware Tn&L? Any comments on optimizing OpenGL would be greatly appreciated.

Share this post


Link to post
Share on other sites
check out glDrawElements(), and the following extensions:
EXT_vertex_array, EXT_compiled_vertex_array.

You can get the specs for the extensions at, http://partners.nvidia.com/Marketing/Developer/DevRel.nsf/ProgrammingResourcesFrame?OpenPage

There are a couple NeHe tutorials on how to work with extensions. I hope that''s what you were looking for.

Share this post


Link to post
Share on other sites
what graphics card are you using?

any reasonably new card will support a whole host ef extensions, such as compiled vertex arrays - which will improve performance. You can also use display list, which upload the polygon data to video memory for fast access.

also check out

http://www.delphi3d.net/download/transfer.zip

which shows very graphically the speed differences between different ways of drawing poylons.

here are the kinds of figures i get (PII 350, 384 Mb, geforce 256) drawing 10,000 polys

immediate mode drawing 23 fps
triangle strips 67 fps
tri strip vertex array 700 fps
immediate mode display list 1100 fps
tri strip display list 2200 fps

that''s a big difference

please post any findings you have when looking at the relative performance of OpenGL vs DirectX8 ... i''m sure a lot of ppl in here would be interested

Share this post


Link to post
Share on other sites
Computer specs:

Pentium III 733 MHz
GeForce2 GTS
128 Mb RAM

Thanks for the posts. I''ll post another reply when I have better scores to provide . Thanks a bunch.

-- C Deity

Share this post


Link to post
Share on other sites
The fastest should be VAR/fence.
Get the information about it from nvidias developer page. It should be clearly faster than DX7 but according to nvidia also faster than anything you can do with DX8.
The OpenGL driver is responsible to give you the possible hardware setup so T&L is used by all OpenGL functions.

Share this post


Link to post
Share on other sites
Okay, I'd like to venture to say that somewhere in the OpenGL settings, there is a framerate cap near 85-86 fps. It seems as if increasing the number of triangles has no effect on framerate until I reach a certain point. I've calculated a whopping 10.1 million triangles per second. That's better than I originally thought with the low poly sphere (low as in less than 5000 triangles), but my GeForce2 can supposedly do 25. Any ideas? I've got it using triangle strips with compiled draw lists.

Edited by - CDeity on July 28, 2001 4:40:12 PM

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I have some trouble using display lists.
I have one object consisting of about 16000 tri and I have made two versions of my rendering program, one
using display list and the other one without. The thing is that when I render this object I always get higher fps using the program without display lists… how can that be??
Im not doing anything special…no culling or anything..just simple rendering.
If u know what it could be..please let me know.

Share this post


Link to post
Share on other sites
CDEITY ... your framate is limited by the refresh rate of your monitor ... you can adjust this in display setting so that frame rate isn''t limited ... depends on which hardware you are using ...

AP ... i have seen similar problems with display list being slower than imediate mode ... no idea why!!! sorry!

Share this post


Link to post
Share on other sites
the DL''s + vertex arrays u have a performance limit of the number of tris u can do with one call. instead of 16000 tris in one list make 4 lists of 4000 tris a piece.
10 mil tri/sec how to improve? do what nvidia + other card makers do when they test the results make your window size 320x240 + 16bit colour

Share this post


Link to post
Share on other sites