PDA

View Full Version : Textures vs. light Geometry



ymish
01-03-2004, 06:31 AM
Hi,

I wanted to know what is faster to render 150 white triangles or 512x512 texture so I did the following test:

I took 512x512 textures with one byte per texel.
Then I did the same tests with 128x128 and 256x256.
I rendered 10,000 textures. On the other hand, I rendered polygons with 150 triangles each.

I have used the following command for textures:

glTexImage2D( GL_TEXTURE_2D, 0, GL_ALPHA8, mAlphaImposter.width, mAlphaImposter[i].height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, mAlphaImposter[i].imageData);

My tests are with screen of 750x512..

Results:
========

Rendering 10,000 Polygons (150 triangles each):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1. non-sensitive to the screen size (fill-rate).
2. 19.3fps when the polygons positioned all over the screen (very close to them).
3. 20.0fps when the polygons are little far (smaller area in the screen).

Rendering 10,000 different Textures:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1. The results are the same for 128x128, 256x256 and 512x512
textures.
2. sensitive to the screen size (fill-
rate).
3. 13.3fps when the Textures positioned all over the screen
(little faster when the screen is smaller).
4. 14.5fps when the textures are far (positioned only on a small part of the screen).

I stress that I don't use vertex array for the polygons, but rather display lists.

Probably the reason for the results comes from binding of the textures. Every one of the 10,000 rendered textures is binded every frame with
glBindTexture(GL_TEXTURE_2D, textureName);

I also stress that I don't put the textures on the video RAM because I still don't know how to do that http://www.opengl.org/discussion_boards/ubb/smile.gif

will the textures "win" if I put them on the video RAM? will they still be sensitive to the fill rate?
I will also be happy to get a link to a nice tutorial about saving textures on the video RAM.

Thanks for any response.

Jan
01-03-2004, 07:44 AM
You cannot put textures into VRAM. Neither are you able to put textures into SysMem.

In fact in OpenGL it is not possible to put textures ANYWHERE.

All you do is to load a texture - somewhere. The driver handles the rest, which means, that your textures are in VRAM, when the texture gets used and in SysMem, if VRAM is full and the texture currently does not get used.

So, no, you won´t get any speed up, because your texture already was in VRAM.

Jan.

JanHH
01-03-2004, 08:49 AM
WHAT did you do???? quite confusing..

"I wanted to know what is faster to render 150 white triangles or 512x512 texture"

do you mean 150 untextured vs. 150 texture triangles? or 150 polygons vs. one texture with a size of 512x512 texels? or pixels? WHAT did you compare??

"I took 512x512 textures"
this means you created 512 x 512 = 262144 textures? or one with that size? and how did you render ist?

"I rendered 10,000 textures"

what is "rendering a texture"? you cannot render textures without drawing polygons.. or did you render something and copied it to texture image? or did you render 150 polygons with 10,000 textures on them?

"I rendered polygons with 150 triangles each."

a polygon is something that cannot be made up of 150 triangles. you mean a 3d object, not a polygon?

sorry I don't want to annoy you but what you have written is totally confusing, mainly to language reasons, it is not at all clear what you have done.

Jan

ymish
01-03-2004, 09:38 AM
Hi Jan,

Ok, lets see.



do you mean 150 untextured vs. 150 texture triangles? or 150 polygons vs. one texture with a size of 512x512 texels? or pixels? WHAT did you compare??

I ment 150 untextured white triangles vs. one texture (two textured triangles) with a size of 512x512 texels.

To see what is faster to render I rendered:
A. 10,000 polygons.
B. 10,000 textures.

From my results, A. turned to be faster.




"I took 512x512 textures"
this means you created 512 x 512 = 262144 textures? or one with that size? and how did you render ist?

You are right, I was confusing..
I ment texture with size of 512x512 texels.



"I rendered 10,000 textures"
what is "rendering a texture"? you cannot render textures without drawing polygons.. or did you render something and copied it to texture image? or did you render 150 polygons with 10,000 textures on them?

texture = Quadrangular texture = two textured triangles.

In A: I have rendered grid of 20x500 polygons (each polygon is represented by 150 untextured solid white triangles).

In B: I have rendered grid of 20x500 textures, namely 10,000 textures.




"I rendered polygons with 150 triangles each."
a polygon is something that cannot be made up of 150 triangles. you mean a 3d object, not a polygon?

I did not render 3D object. I rendered a polygon.
Polygon = 150 white triangles on the same plane.
How did I construct the polygon? I took some polygon and triangulated it, thus I got 150 white triangles.



sorry I don't want to annoy you but what you have written is totally confusing, mainly to language reasons, it is not at all clear what you have done.

Jan, you are not annoying me at all, sorry for the confusion http://www.opengl.org/discussion_boards/ubb/smile.gif
Ask more questions if you are still confused.