PDA

View Full Version : performance loss using textures in OpenGL 2.0



timbre
08-03-2006, 06:20 AM
My Application runs superfast on every machine with OpenGL previous to 2.0. OpenGL 1.5 Machines are slightly slower. But on OpenGL 2.0 machine Framerate breakes down to an avarage of circa 3 Frames with textures enabled. Disabling Textures makes it fly again (800 fps).

I experimented with pixelformates GL_RGB and so on but it in the end nothing changed.

I read that on OpenGL Textures are handled different under OpenGL 2.0 (beside npot) did i oversee something ?

any help is appreciated ...

pS. other OpenGL Apps run ultrasmooth instead ;(

thanks a lot

ZbuffeR
08-03-2006, 06:38 AM
Maybe you use costly super anisotropic trilinear filter, but on lower end cards it is not available so simple bilinear filtering is faster.
Or you don't use mipmapping, some drivers force automipmaps (faster).

Can you provide more details on the older machines ? cards, driver versions, gl versions ?

And how you configure and upload your texture ?

timbre
08-03-2006, 06:53 AM
Thanks for the quick reply.

The older machines use for example Intel integrated Graphix or a Radeon 9200SE.

Another Sample Application runs perfectly smooth on that OpenGL 2.0 machine, and I do not have set filtering inside the (slow) app.

timbre
08-03-2006, 07:03 AM
Must be an silly error...

The texture is set once by :

glGenTextures( 1, screenelement->GetTexture() );
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

glBindTexture( GL_TEXTURE_2D, *screenelement->GetTexture() );
glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_LINEAR );

glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, screenelement->GetTwoFoldTextureSize().X, screenelement->GetTwoFoldTextureSize().Y, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, screenelement->GetBitmapData()->Scan0 /*NULL*/ );

with screenelement->GetBitmapData()->Scan0 being a tranceparent image or Null, which later on is filled once by a npot image using subtexture call.
Using GL_RGB instead of GL_BGRA_EXT and GL_RGBA does not speed up.

The geometry itself is stored in a displaylist.

Within the renderloop i call:

glBindTexture(GL_TEXTURE_2D, *screenElement->GetTexture() );
glCallList( m_displaylist );

Maybe calling glBindtexture should be put in the displaylist ?

timbre
08-03-2006, 07:11 AM
I do not use mipmaps, but the fast sample app (http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=32) does not use Mipmaps aswell.

Relic
08-03-2006, 07:25 AM
What are the texture sizes in the slow case?

If they are non-power-of-two and your hardware doesn't HW accelerate that (extension ARB_texture_non_power_of_two not present), OpenGL 2.0 drivers must emulate that in SW because the functionality went into the core.

Again, what graphics board is slow?

Older HW not advertising NPOT textures should throw a GL error on glTexImage2D then and ignore the texture.

timbre
08-03-2006, 07:44 AM
The "slow" graphics board is an Ati Radeon x600/550.

The "fast" ones include GeForce 4 Ti 4400, Ati Radeon 9200SE, and Intel 82892/82855E GM/GME.

On all machines POT textures are used. The texture sizes are all the same on all machines and differ from 256x256 up to 512x512.

Relic
08-03-2006, 08:07 AM
Ok, one eliminated, plenty to go. ;)
Since this is isolated to enabled textures check all glTexParameters. Try different wrapping modes, glTexEnv modes, etc.
Disable all point, line and polygon smoothing.
Blending enabled? Logic ops? Other weird states?