GL_POINT_SPRITES_ARB w/ 6600gt really slow....

Started by
3 comments, last by chracatoa 18 years, 9 months ago
So I'm using point sprites, vertex buffers, interleaved arrays, pbuffers, mipmapping, vertex and fragment programs and I'm getting 4 seconds per frame using an NVidia 6600gt for about 800000 point sprites. When I run the same code in my ATI 9800 pro, I get 60 fps!!! WTH? What is the problem? I've heard that old ATI drivers had problems with point sprites, but I never heard anything about NVidia problems with it. My 6600gt is not PCI Express, but I have tested in a different system using one 6600gt with PCI Express with similar results. How am I so sure the problem is with the point sprites? I have an implementation where everything is the same except that I'm using triangles - and the nvidia card is faster. (if this is not the appropriate forum, please let me know where I could post this question. Thanks!) Here are some parts of my code:

Init:-----------------------------------------------
  glClearColor(0.0,0.0,0.0,1.0);
  glShadeModel(GL_SMOOTH);
  gtex.MakeSplat(); // 5 levels of mipmapping
  glGenTextures(1,texName);
  glBindTexture(GL_TEXTURE_2D, texName[0]);
  gtex.BindTexture();
  glEnable(GL_TEXTURE_2D);
  glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
  glDisable(GL_BLEND);
  glDisable(GL_ALPHA_TEST);
  glDisable(GL_LIGHTING);
  glDisable(GL_DEPTH_TEST); 
  glDisable(GL_DITHER);
  glEnable(GL_SMOOTH);
  glHint(GL_POLYGON_SMOOTH_HINT,GL_FASTEST);

  glBindProgramARB(GL_VERTEX_PROGRAM_ARB, _vpFinalVertex);
  glProgramEnvParameter4fARB(GL_VERTEX_PROGRAM_ARB,1, ...);
  glEnable(GL_VERTEX_PROGRAM_ARB);

  glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, _fpNormalizeAlpha);
  glProgramEnvParameter4fARB(GL_FRAGMENT_PROGRAM_ARB,1, ...);

  glEnable(GL_FRAGMENT_PROGRAM_ARB);

  pbuffer->Initialize(RX,RY);
  pbuffer->BeginCapture();
    glDisable(GL_LIGHTING);
    glDisable(GL_DEPTH_TEST); 
    glDisable(GL_DITHER);
    glClearColor(0, 0, 0, 0.0);
    glEnable(GL_ALPHA_TEST);
    glEnable(GL_BLEND);
    glEnable(GL_FLAT);
    glHint(GL_POLYGON_SMOOTH_HINT,GL_FASTEST);
    glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
    glEnable(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D, texName[0]);
    glGenBuffersARB(1, &vbuffer));
    glBindBufferARB(GL_ARRAY_BUFFER_ARB,vbuffer);
    glBufferDataARB(GL_ARRAY_BUFFER_ARB,sizeof(SPts)*ValidSplats,Pts,GL_STATIC_DRAW_ARB);
 
    glInterleavedArrays(GL_C4F_N3F_V3F,0,OFFSET(0));
    glEnable( GL_POINT_SPRITE_ARB );

    glPointParameterfARB(GL_POINT_SIZE_MIN_ARB, 1.0);
    glPointParameterfARB(GL_POINT_SIZE_MAX_ARB, 32.0);
    glPointParameterfARB(GL_POINT_FADE_THRESHOLD_SIZE_ARB, 1.0);
    GLfloat atten_params[] = { 0.0, 0.1, 0.0 };
    glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, atten_params);

    glTexEnvf( GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE );

    glBindProgramARB(GL_VERTEX_PROGRAM_ARB, _vpCalcWeight[axis]);
    glProgramEnvParameter4fARB(GL_VERTEX_PROGRAM_ARB,1, H, 1.0/(1.0-H),0,0);
	   glEnable(GL_VERTEX_PROGRAM_ARB);
	   glDisable(GL_POINT_SMOOTH);

  pbuffer->EndCapture();


Rendering (display):-----------------------------------------------
  glClear(GL_COLOR_BUFFER_BIT | GL_ACCUM_BUFFER_BIT);
  pbuffer->BeginCapture();
    if (...) 
      glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE);
    else
      glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

      glClear(GL_COLOR_BUFFER_BIT | GL_ACCUM_BUFFER_BIT ); 
      glPointSize( pointspritesize );
      glMatrixMode(GL_PROJECTION);
      glLoadIdentity();
      gluPerspective(Vfov,1.0,1.0,100000.0);
      glMatrixMode(GL_MODELVIEW);
      glLoadIdentity();
      gluLookAt(EyePoint.x,EyePoint.y,EyePoint.z,
            LookPoint.x,LookPoint.y,LookPoint.z,
            Up.x,Up.y,Up.z);
      glProgramEnvParameter4fARB(GL_VERTEX_PROGRAM_ARB,2,...);
      glDrawArrays(GL_POINTS,0,ValidSplats);
    pbuffer->EndCapture();

  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluPerspective(Vfov,1.0,1.0,100000.0);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  gluLookAt(EyePoint.x,EyePoint.y,EyePoint.z,
            LookPoint.x,LookPoint.y,LookPoint.z,
            Up.x,Up.y,Up.z);

  glActiveTexture(texARB[0]);
  pbuffer->Bind();
  pbuffer->EnableTextureTarget();

  glProgramEnvParameter4fARB(GL_VERTEX_PROGRAM_ARB,2,...);

  glBegin(GL_QUADS);
    glTexCoord2f(0,1); glVertex3fv(&pc1.x);
    glTexCoord2f(1,1); glVertex3fv(&pc2.x);
    glTexCoord2f(1,0); glVertex3fv(&pc3.x);
    glTexCoord2f(0,0); glVertex3fv(&pc4.x);
  glEnd();

  pbuffer->DisableTextureTarget();

  glutSwapBuffers();

edited by _the_phantom_
If you are going to post lots of source code please use the source tags, see the forum faq for details on the tags used on this message board [Edited by - _the_phantom_ on June 17, 2005 10:35:31 AM]
Advertisement
try running with glintercept
it looks like u have a few gl bugs there that should be picked up by it
Going from my own experiences using point sprites, you should avoid them if at all possible. I have an ATI card (X800XT) and just drawing one point sprite caused havoc to my system- bringing it to a complete halt. It seems there are definitely bugs in OGLs point sprite system and you should try and avoid it if possible.

You can do your own billboarding either in software or on a vertex shader. It requires a little extra effort to be sure but at least you can be certain that it will work, both for ATI and NVIDIA cards.
Ok, I've tried GLInterceptor and I fixed some dumb (but harmless) opengl mistakes. Now I only get errors after I close my application (for whatever reason).

But without success...

Moreover, I have found this on the internet:

9800xt vs. 6800 Ultra Point Sprites

Still, it's too slow - and it's not 2x slower, it's like 200x slower - therefore there must be something wrong here...

Darragh: I think you may be right, there isn't much code out there using point sprites - except one that draws a small number of particles...

GL Intercept Log. Version : 0.42    Compile Date: Mar 30 2005    Run on: Fri Jun 17 19:38:08 2005===================================================GLDriver - Shutdown - Current OpenGL context 0x10000?GLDriver - Shutdown - Outstanding OpenGL context 0x10000 ?GLDriver - Shutdown - Outstanding OpenGL context 0x10001 ?GLDriver - Shutdown - Outstanding OpenGL context 0x10002 ?GLDriver - Shutdown - Outstanding OpenGL context 0x10003 ?ImageManager::Destructor - OpenGL id 1 is still active. (Image Memory leak?)ImageManager::Destructor - OpenGL id 2 is still active. (Image Memory leak?)ImageManager::Destructor - OpenGL id 3 is still active. (Image Memory leak?)ImageManager::Destructor - OpenGL id 4 is still active. (Image Memory leak?)ShaderManager::Destructor - OpenGL id 1 is still active. (Shader Memory leak?)ShaderManager::Destructor - OpenGL id 2 is still active. (Shader Memory leak?)ShaderManager::Destructor - OpenGL id 3 is still active. (Shader Memory leak?)ShaderManager::Destructor - OpenGL id 4 is still active. (Shader Memory leak?)ShaderManager::Destructor - OpenGL id 5 is still active. (Shader Memory leak?)===================================================Log End.
Just so you know, I have found the solution. Link
here.

This topic is closed to new replies.

Advertisement