PDA

View Full Version : Performance bottleneck glAlphaFunc



k.arts
07-07-2005, 07:32 AM
Hi!
I have a problem with the glAlphaFunc( ). Without using it, I got a speed of 2 ms /Process. (I use the GPU for processing some calculations).
When enabling GL_ALPHA_TEST I got a speed of 40ms+ /Process. I thought that alpha-testing is in hardware? So, how can this happen?
Here's the relevant code snippet:

glEnable( GL_STENCIL_TEST );
glEnable( GL_ALPHA_TEST );
glStencilOp( GL_REPLACE, GL_REPLACE, GL_REPLACE );

loop over i
{
//only draw when alpha == i
glAlphaFunc( GL_EQUAL, (float)(i+1) / 255.f );
glStencilFunc( GL_ALWAYS, i+1, 0xff );
glRasterPos2i( 1,0 );
glCopyPixels( ObjSize + 1, 0, ObjSize, PopSize, GL_COLOR );

)
glDisable( GL_STENCIL_TEST );
glDisable( GL_ALPHA_TEST );

When I outcomment glEnable( GL_ALPHA_TEST ), I got much better performance. So I think, that this alphatest is performed in software. But why?

Thanks a lot
PS: I got a Geforce 6800 GT with hardware acceleration fully enabled

k.arts
07-07-2005, 08:51 AM
Ok i have found the error. It was the driver. I had the latest nvidia driver, but of course (I am a lucky man ;) ) it did not work as it should. So I installed an old one and now it works fine.
So my solution to everybody:

<advice deleted by dorbie>
Edit by dorbie: before giving advice like that I suggest you learn a bit more about graphics hardware performance.