PDA

View Full Version : General OpenGL questions



miikkal
12-05-2000, 01:07 AM
1. Is it OK to use textureimage which have different height than width.
Or does texture dimensions allways have to be width=height?

2. Is there any speed differenses if I draw four rectangles with GL_TRIANGLES or GL_TRIANGLE_STRIP??

Eric
12-05-2000, 01:15 AM
1. Is it OK to use textureimage which have different height than width.
Or does texture dimensions allways have to be width=height?

Yes, you can, providing both width and height are a power of 2 i.e.:

128x64, 512x32, 256x256 are acceptable.
On the other hand, you can not use 333x222 directly (although it works with gluBuildMipmaps).


2. Is there any speed differenses if I draw four rectangles with GL_TRIANGLES or GL_TRIANGLE_STRIP?? ?

If you draw 4 rectangles with GL_TRIANGLES, you need 8 triangles i.e. 24 vertices.
If you draw the same 4 rectangles with GL_TRIANGLE_STRIP, you need only 4 vertices per rectangle i.e. 16 vertices (that is, if your rectangles do not share edges between them).

As you can see, it is a much better idea to use GL_TRIANGLE_STRIP: you optimize your bandwidth (instead of passing a lot of boring vertices to your gfx card, you could pass it a lot more interesting things !).

I know some drivers will detect that you are indeed passing a strip but I really believe you had better doing it in your own code...

Hope this will help you !

Regards.

Eric