PDA

View Full Version : OpenGL - Fast or slow?



02-25-2001, 12:37 PM
Hello,

I started to develope with OpenGL yesterday. Today I made a Cube with Texture-Mapping. I used the GL_LINEAR-Flag in glTexParameteri.
And it was very slow! I just thought about the speed of OpenGL, because I have a Pentium3 800 MHz, 128 MB SDRAM and a TNT2-32 MB-Card.

Why is GL_LINEAR so slow?

Janneke
02-25-2001, 02:45 PM
it could be everything

here a cube would run at at least 100 fps...

so maybe your configuration is wrong,
or maybe the code was messed up...

dunno http://www.opengl.org/discussion_boards/ubb/smile.gif

Cya

Jan

lee
02-25-2001, 08:31 PM
does it happen only when you use GL_LINEAR or when you use the other parameters as well?

02-26-2001, 02:01 AM
With GL_NEAREST it is fast (but also not very fast!).
Here's my code:

glTexParamateri (GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri
(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);

Bob
02-26-2001, 02:34 AM
Either you try to use some feature that is not supported in hardware on the TNT2, or you setup a pixelformat that TNT2 does not like. In both cases, the driver will fall back to software rendering, and therefore it will go slow.

02-26-2001, 02:42 AM
Thanx. A last question: What is better? Direct3D or OpenGL? What should I use to make a 3D-Engine?

Moz
02-26-2001, 03:54 AM
Well, if you're not already into D3D it might be difficult to learn.
I learnt OpenGL in a few weeks by reading the red book and the API appeared to be very clear and understandable from the start, the code is very explicit.
I tried to look at some code for D3D and to read a book about it and I must say that it looks like Chinese to me (I don't speak Chinese http://www.opengl.org/discussion_boards/ubb/wink.gif).

As for which is better for a 3D engine, I would say it depends on what you want to do. If it's only for Windows, you might want to try D3D. But anyway, if you don't want to waste valuable time trying to understand the API, I'd say use OpenGL, it's at least as fast (if not more) and easier.

Bob
02-26-2001, 07:31 AM
Asking about what API is better is kind of silly. The answer highly depends on WHERE you ask the question. Here, on the official OpenGL board, most of us prefers OpenGL over D3D. And I would not be surprised that if you asked the same question on a DX-only board, the answer would be more or less the opposite.

Use whatever API you are most familiar with. None of them is better/faster/more flexible that the other.

lee
02-26-2001, 09:27 AM
i have a rage 128 w/ opengl support. i installed descent 3 on my computer, and it let me choose if i wanted to use opengl or D3D. i chose opengl, and it said "due to bugs in the microsoft library, it may not work right blah blah blah." i chose it anyway, and it didn't! it sucked. so i switched it to D3D and it works fine. so it really depends on what you wanted to use it for, and HOW you write the program, of course. [but if microsoft would be ethical http://www.opengl.org/discussion_boards/ubb/eek.gif and write a nice library i guess we wouldn't have this problem]

Tim Stirling
02-26-2001, 09:38 AM
I would start with opengl becuase most people find it easier than dx. Once you are good and understand more about 3d you could try dx by which time you should find it easier to learn with your OGL background. You will then also be able to decide which one you personly prefer. If you are insane you could also try to write an engine which can use both APIs. http://www.opengl.org/discussion_boards/ubb/smile.gif

Elixer
02-26-2001, 09:39 AM
Wait, that didn't make sense. When Descent 3 said that, they don't know what they are talking about. Unles of course they are using software emulation. If they are using hardware acceleration, then opengl32.dll calls the correct .dll for whatever card you have. Now, I can believe that the rage 128 drivers for openGL might be broken, in fact, I know they are in some apps, since I have seen the ATI's opengl .dll crash. (D'OH!)

It took ATI over a year to get good drivers for DX, and the openGL drivers they currently have are OK for the most part, although they still have some issues.

02-26-2001, 09:41 AM
Yes, I WOULD choose openGL BUT with my TNT2 it would be very slow... http://www.opengl.org/discussion_boards/ubb/frown.gif

Teofuzz
02-26-2001, 11:07 AM
Maybe you are using a texture with W,H not a power of two?
A pixelformat that is not supported by your card?
Linear filtering is slower than GL_NEAREST, however a cube on my slow k6 233 and voodoo2 runs at 80-90fps with vsync disabled...
Good work!
tFz

02-26-2001, 12:08 PM
I've found the solution!
Now OpenGL runs very fast. I forgot to switch an option in my TNT2-Dialog.

02-27-2001, 05:30 PM
I'm a Descent freak, and I can tell you now that D3 takes an @$$ load of power to run well, and ATI's cards don't like it too well. I use a GeForce2 GTS, and it runs very well, even without tweaking my system appropriately. http://www.opengl.org/discussion_boards/ubb/smile.gif

lee - D3 rocks in Glide (3Dfx boards only), but it is really tight on driver requirements. It has to have everything work as it should to look any good, or even to run. D3D will probably run best more most people. And this makes no difference as to what you should use. D3 was designed around Glide, and D3D support was added halfway into development. OpenGL support was put in because it was becoming more popular, but back in late 1998, most OpenGL drivers weren't even complete, much less bug-free. One thing is always dependent upon another.

Elixer - They only used HW acceleration for D3, but as someone else said, OpenGL will fall back to software if it can't do something (although D3 usually barfs when it does). ATI's drivers suck altogether, and my dad made the mistake of getting himself an Xpert 98, so I should know http://www.opengl.org/discussion_boards/ubb/smile.gif

BTW, if anyone wants a place to talk about D3, go to www.descentbb.net. (http://www.descentbb.net.) Great place, busy with posters day and night.