Archived

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

Eber Kain

Fill rate problem

Recommended Posts

Im haveing some fill rate related problems when drawing the background texture for a project. What can i do to fix it. Example : Without BG game runs at about 1700 fps Wit BG its about 250 fps The background is 4 large polys with a 256x256 mipmapped texture attached to each. Im useing 2D Ortho Perspective. blending makes no difference

Share this post


Link to post
Share on other sites
hmmm, that may be normal. i have done the same thing except i used one quad and scaled it 320,240,0 which makes it 640,480. and my mipmaped texture it 640,480 yet i get 600+ fps but drops to 450+ with object moving around.

just try one poly and one texture and see how things go then.

Share this post


Link to post
Share on other sites
Mind me, you don''t need mimapping for background textures since they always have the same dimensions on the screen.

How are organized the polygons ? Something like a skybox ?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:

Without BG game runs at about 1700 fps
Wit BG its about 250 fps



I''d say that''s pretty normal, with a screen filling poly, especially at higher resolutions. What 3D card do you have ?

- AH

Share this post


Link to post
Share on other sites
Eber Kain: Try turning BG on/off on real scene (something like +25000 triangles) and some math/AI running. And then you''ll see the real difference in fps. There is virtualy none.

Share this post


Link to post
Share on other sites
DarkWing: you''re definately right, but IMHO this topic does discuss of how fast we can implement a BG.
Whatever the application is, if the BG draw faster without losing quality, then it''s better

oh and I forgot to say something that seemed obvious to me : without mipmapping, the result will be faster. that''s why I suggest to remove them. And if the texture is choosen correctly, there will be NO difference ! Please remember that the texture needs to be resized to fit "correctly" without mipmapping.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
> without mipmapping, the result will be faster.

And it will take less texture memory.

- AH

Share this post


Link to post
Share on other sites
how should the texture be set up? for me i can only use mipmaped images for my BG''s every time i try to set the texture to something else i get a blank quad??

Share this post


Link to post
Share on other sites
I guess you use the gluBuild2DMipmaps function.
In this case, you will not have any problem because the glu checks the image dimensions for you and resizes it if necessary.

I think you have a blank quad because your image is not good :
- Either the image size exceeds the graphics card texture capability (kind of "out of memory"),
- Or the image size is not 2^n.

Defining a texture without mipmap
Instead of using :
gluBuild2DMipmaps(GL_TEXTURE_2D, internal_format, width, height, format, GL_UNSIGNED_BYTE, pixels);
Use :
glTexImage2D(GL_TEXTURE_2D, 0, internal_format, width, height, 0, format, GL_UNSIGNED_BYTE, pixels);
(where "internal_format" and "format" are probably GL_RGB or GL_RGBA, and where "pixels" is an array of GLubyte pointing to the pixel data).

Share this post


Link to post
Share on other sites
According to the OGL specs, OGL assumes a texture doesn''t exist if the filtering mode is set to GL_x_MIPMAP_x and it doesn''t have mipmaps, so set it to GL_LINEAR. If your texture actually takes up the same amount of pixels on-screen as are in the bitmap, you could even use GL_NEAREST without any loss in quality whatsoever. You can do that anyway, of course. It might result in a slight speedup as well.

Share this post


Link to post
Share on other sites
Hello there,

Also check your clear statement ( if you have one )

if its

glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);

then you only need

glClear(GL_DEPTH_BUFFER_BIT);

as you are clearing the color buffer when you output the quad(s).

Also ensure youve disabled all non essential glStates ie
blending,lighing.

use flat shading.

glShadeModel(GL_SMOOTH);

Disable any depth testing and depth buffer write''s.

glDisable(GL_DEPTH_TEST);
glDepthMask(GL_FALSE);

Make sure the texture environment mode is set to GL_DECAL.

glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_DECAL);

Switch off texture filtering on the BG textures.

Make sure you only use a GL_RGB texture to minimize texture size.

If your card supports it look at texture compression as well.



Hope it helps

Mark


Share this post


Link to post
Share on other sites
start your renderer like this

- clear DEPTH_BIT //glClear(GL_DEPTH_BUFFER_BIT);
//do not clean the color bit if you always
//draw your background
- turn to flat shading //glShadeModel(GL_FLAT);
- disable depth test //glDisable(GL_DEPTH_TEST);
- draw the box
- render the rest

Oztan.

Share this post


Link to post
Share on other sites
quote:
use flat shading.
glShadeModel(GL_SMOOTH);

Nice one, Mark

Also, there''s no need to disable depth writing with :
glDepthMask(GL_FALSE);
since disabling depth testing both diable depth reading and depth writing, with :
glDisable(GL_DEPTH_TEST);

Share this post


Link to post
Share on other sites