Beispiel #1
0
static void Draw(void)
{
   static GLfloat theQuad[3] = { 0.25, 0.0, 1/60.0 };

   glClear(GL_COLOR_BUFFER_BIT); 

   glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
   glPointSize(8.0);
   glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, theQuad); 


   glBegin(GL_POINTS);
   glColor3f(1,0,0); 
   glVertex3f( 0.9, -0.9, -10.0);
   glColor3f(1,1,0); 
   glVertex3f( 0.9,  0.9, -5.0);
   glColor3f(1,0,1); 
   glVertex3f(-0.9,  0.9, -30.0);
   glColor3f(0,1,1); 
   glVertex3f(-0.9,  -0.9, -20.0);
   glEnd();

   glFlush();

   if (doubleBuffer) {
      glutSwapBuffers();
   }
}
Beispiel #2
0
void __glXDisp_PointParameterfvARB(GLbyte *pc)
{
	glPointParameterfvARB(
		*(GLenum *)(pc + 0),
		(GLfloat *)(pc + 4)
	);
}
 inline void VL_glPointParameterfv( GLenum pname, const GLfloat* params)
 {
   if (glPointParameterfv)
     glPointParameterfv(pname,(GLfloat*)params);
   else
   if (glPointParameterfvARB)
     glPointParameterfvARB(pname,(GLfloat*)params);
   else
   if (glPointParameterfvEXT)
     glPointParameterfvEXT(pname,(GLfloat*)params);
   else
     VL_UNSUPPORTED_FUNC();
 }
Beispiel #4
0
void SimpleSparkle::draw() {
    glClear(GL_COLOR_BUFFER_BIT);
    glMatrixMode (GL_MODELVIEW);
    glLoadIdentity ();
    
    glColor3f(1.0, 1.0, 1.0);
    glEnable(GL_TEXTURE_2D);
    glEnable( GL_BLEND );
    glBlendFunc( GL_SRC_ALPHA, GL_ONE );
        // This is how will our point sprite's size will be modified by 
    // distance from the viewer
    float quadratic[] =  { 1.0f, 0.0f, 0.01f };
    glPointParameterfvARB( GL_POINT_DISTANCE_ATTENUATION_ARB, quadratic );

    // Query for the max point size supported by the hardware
    float maxSize = 0.0f;
    glGetFloatv( GL_POINT_SIZE_MAX_ARB, &maxSize );

    // Clamp size to 100.0f or the sprites could get a little too big on some  
    // of the newer graphic cards. My ATI card at home supports a max point 
    // size of 1024.0f!
    if( maxSize > 100.0f )
        maxSize = 100.0f;

    glPointSize( pointSize );

    // The alpha of a point is calculated to allow the fading of points 
    // instead of shrinking them past a defined threshold size. The threshold 
    // is defined by GL_POINT_FADE_THRESHOLD_SIZE_ARB and is not clamped to 
    // the minimum and maximum point sizes.
    //glPointParameterfARB( GL_POINT_FADE_THRESHOLD_SIZE_ARB, 60.0f );

    glPointParameterfARB( GL_POINT_SIZE_MIN_ARB, 1.0f );
    glPointParameterfARB( GL_POINT_SIZE_MAX_ARB, maxSize );

    // Specify point sprite texture coordinate replacement mode for each 
    // texture unit
    glTexEnvf( 0x8861, 0x8862, GL_TRUE );

    glEnable( 0x8861 );


    glDrawArrays(GL_POINTS, 0, count);
//     glBegin(GL_POINTS);
//       glVertex2f(vertexArray[1], 0.0);
//     glEnd();
    glDisable( 0x8861 );
    glDisable(GL_BLEND);
    glDisable(GL_TEXTURE_2D);

}
void PointParticle::render(){
	
	//TODO alguams dessas funcoes sao de inicializacao do opengl
	//e devem ficar em outro local
	float quadratic[] =  { 1.0f, 0.0f, 0.01f };
	glPointParameterfvARB( GL_POINT_DISTANCE_ATTENUATION_ARB, quadratic );
    glPointParameterfARB( GL_POINT_FADE_THRESHOLD_SIZE_ARB, 60.0f );
    glPointParameterfARB( GL_POINT_SIZE_MIN_ARB, 1.0f );
    glPointParameterfARB( GL_POINT_SIZE_MAX_ARB, 100.0f );

    glTexEnvf( GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE );
    glEnable( GL_POINT_SPRITE_ARB );
    glPointSize( size );
	
	glBegin( GL_POINTS );
		glColor4f( color[0], color[1], color[2], 1 - fade / life);
		glVertex3f( position[0], position[1], position[2] );
	glEnd();

	glDisable( GL_POINT_SPRITE_ARB );

};
 void GLStateCacheManagerImp::setPointParameters(GLfloat *attenuation, float minSize, float maxSize)
 {
     if (minSize != mPointSizeMin)
     {
         mPointSizeMin = minSize;
         const Ogre::RenderSystemCapabilities* caps = dynamic_cast<GLRenderSystem*>(Root::getSingleton().getRenderSystem())->getCapabilities();
         if (caps->hasCapability(RSC_POINT_EXTENDED_PARAMETERS))
             glPointParameterf(GL_POINT_SIZE_MIN, mPointSizeMin);
         else if (caps->hasCapability(RSC_POINT_EXTENDED_PARAMETERS_ARB))
             glPointParameterfARB(GL_POINT_SIZE_MIN, mPointSizeMin);
         else if (caps->hasCapability(RSC_POINT_EXTENDED_PARAMETERS_EXT))
             glPointParameterfEXT(GL_POINT_SIZE_MIN, mPointSizeMin);
     }
     if (maxSize != mPointSizeMax)
     {
         mPointSizeMax = maxSize;
         const Ogre::RenderSystemCapabilities* caps = dynamic_cast<GLRenderSystem*>(Root::getSingleton().getRenderSystem())->getCapabilities();
         if (caps->hasCapability(RSC_POINT_EXTENDED_PARAMETERS))
             glPointParameterf(GL_POINT_SIZE_MAX, mPointSizeMax);
         else if (caps->hasCapability(RSC_POINT_EXTENDED_PARAMETERS_ARB))
             glPointParameterfARB(GL_POINT_SIZE_MAX, mPointSizeMax);
         else if (caps->hasCapability(RSC_POINT_EXTENDED_PARAMETERS_EXT))
             glPointParameterfEXT(GL_POINT_SIZE_MAX, mPointSizeMax);
     }
     if (attenuation[0] != mPointAttenuation[0] || attenuation[1] != mPointAttenuation[1] || attenuation[2] != mPointAttenuation[2])
     {
         mPointAttenuation[0] = attenuation[0];
         mPointAttenuation[1] = attenuation[1];
         mPointAttenuation[2] = attenuation[2];
         const Ogre::RenderSystemCapabilities* caps = dynamic_cast<GLRenderSystem*>(Root::getSingleton().getRenderSystem())->getCapabilities();
         if (caps->hasCapability(RSC_POINT_EXTENDED_PARAMETERS))
             glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, &mPointAttenuation[0]);
         else if (caps->hasCapability(RSC_POINT_EXTENDED_PARAMETERS_ARB))
             glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION, &mPointAttenuation[0]);
         else if (caps->hasCapability(RSC_POINT_EXTENDED_PARAMETERS_EXT))
             glPointParameterfvEXT(GL_POINT_DISTANCE_ATTENUATION, &mPointAttenuation[0]);
     }
 }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBPointParameters_nglPointParameterfvARB__IJ(JNIEnv *__env, jclass clazz, jint pname, jlong paramsAddress) {
    glPointParameterfvARBPROC glPointParameterfvARB = (glPointParameterfvARBPROC)tlsGetFunction(1257);
    intptr_t params = (intptr_t)paramsAddress;
    UNUSED_PARAM(clazz)
    glPointParameterfvARB(pname, params);
}
Beispiel #8
0
CatchSparksEffect::CatchSparksEffect(EffectSettings *conf)
    : Effect()
{
  flowerCount = conf->getIntegerOrDefault("flowercount", 30);
  blossomCount = conf->getIntegerOrDefault("blossomcount", 3);
  sparkCount = conf->getIntegerOrDefault("sparkcount", 30);
  blossomsize = conf->getFloatOrDefault("blossomsize", 12.0);
  sparksize = conf->getFloatOrDefault("sparksize", 10.0);

  xd = 4.0 / env->getMatrixWidth();
  yd = 2.0 / env->getMatrixHeight();

  Flower::setSparkCount(sparkCount);
  Flower::setBlossomCount(blossomCount);
  Flower::setAreaDetector(&detector);
  Flower::setxyd(xd, yd);
  flowers = new Flower[flowerCount];

  int verticesTotal = flowerCount * (blossomCount + sparkCount);
  vertices = new GLfloat[2 * verticesTotal];
  colors = new GLfloat[4 * verticesTotal];

  for ( int i = 0; i < verticesTotal; ++i) {
    vertices[2*i] = 0.0;
    vertices[2*i+1] = 0.0;
    colors[4*i] = 1.0;
    colors[4*i+1] = 1.0;
    colors[4*i+2] = 1.0;
    colors[4*i+3] = 1.0;
  }

  unsigned int sparkoffset = blossomCount * 2 * flowerCount; // sparks are stored behind blossoms
  for (unsigned int i = 0; i < flowerCount; ++i) {
    flowers[i].setBlossomPointers(vertices + i * 2 * blossomCount, colors + i * 4 * blossomCount);
    flowers[i].setSparksPointers(vertices + sparkoffset + i * 2 * sparkCount, colors + 2*sparkoffset + i * 4 * sparkCount);
    flowers[i].reset();
  }

  RGBAbmp *pic = loadBmp("data/blossom.bmp");

  glGenTextures(1, &blossomTex);
  glBindTexture(GL_TEXTURE_2D, blossomTex);
  int textureType = GL_RGB;
  if (pic->bpp == 32) 
  textureType = GL_RGBA ;
  gluBuild2DMipmaps(GL_TEXTURE_2D, pic->bpp/8, pic->width, 
                                    pic->height, textureType, GL_UNSIGNED_BYTE, pic->data);
  glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
  glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR);	
  delete pic->data;
  delete pic;

  pic = loadBmp("data/whiteflare.bmp");

  glGenTextures(1, &sparkTex);
  glBindTexture(GL_TEXTURE_2D, sparkTex);
  if (pic->bpp == 32) 
  textureType = GL_RGBA ;
  gluBuild2DMipmaps(GL_TEXTURE_2D, pic->bpp/8, pic->width, 
                                    pic->height, textureType, GL_UNSIGNED_BYTE, pic->data);
  glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
  glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR);	
  delete pic->data;
  delete pic;

  glEnableClientState(GL_VERTEX_ARRAY);
  glEnableClientState(GL_COLOR_ARRAY);

  glVertexPointer(2, GL_FLOAT,0, vertices);
  glColorPointer(4, GL_FLOAT,0, colors);

  glColor3f(1.0, 1.0, 1.0);
  glEnable(GL_TEXTURE_2D);
  glEnable( GL_BLEND );
  glBlendFunc( GL_SRC_ALPHA, GL_DST_ALPHA );
  // This is how will our point sprite's size will be modified by 
  // distance from the viewer
  float quadratic[] =  { 1.0f, 0.0f, 0.01f };
  glPointParameterfvARB( GL_POINT_DISTANCE_ATTENUATION_ARB, quadratic );

  glPointParameterfARB( GL_POINT_SIZE_MIN_ARB, 1.0f );
  glPointParameterfARB( GL_POINT_SIZE_MAX_ARB, 100.0f );

  // Specify point sprite texture coordinate replacement mode for each 
  // texture unit
  glTexEnvf( 0x8861, 0x8862, GL_TRUE );

    glEnable( 0x8861 );
}
Beispiel #9
0
void ParticleSprayerTool::render(DTS::DataItem* dataItem) const
{
   // draw all emitter objects
   drawEmitters();

   // save current attribute state
   #ifdef MESA
   // GL_POINT_BIT causes GL enum error
   glPushAttrib(GL_LIGHTING_BIT | GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
   #else
   glPushAttrib(GL_LIGHTING_BIT | GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_POINT_BIT);
   #endif

   glDisable(GL_LIGHTING);
   glDepthMask(GL_FALSE);

   glEnable(GL_POINT_SMOOTH);
   glEnable(GL_BLEND);
   glBlendFunc(GL_SRC_ALPHA, GL_ONE);

   glEnable(GL_TEXTURE_2D);
   glBindTexture(GL_TEXTURE_2D, dataItem->spriteTextureObjectId);
   glTexEnvf(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE);
   glEnable(GL_POINT_SPRITE_ARB);

   float particleRadius=data.point_radius;//*1000.0;

   // Query the OpenGL viewing frustrum
   GLFrustum<float> frustum;
   frustum.setFromGL();   

   #ifdef GHETTO
   if (0)
   #else
   if (dataItem->hasShaders)
   #endif
   {
      /* Calculate the scaled point size for this frustum: */
      GLfloat scaledParticleRadius=frustum.getPixelSize() * particleRadius / frustum.getEyeScreenDistance();

      /* Enable the vertex/fragment shader: */
      glEnable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB);
      glUseProgramObjectARB(dataItem->programObject);
      glUniform1fARB(dataItem->scaledParticleRadiusLocation, scaledParticleRadius);
      glUniform1iARB(dataItem->tex0Location, 0);
   }
   else
   {
      glPointSize(particleRadius
            * Vrui::getNavigationTransformation().getScaling());

      GLfloat linear[3]= { 0.0, 1 / 5.0, 0.0 };
      glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, linear);

      //
      // NOTE::the following scaling calculation does not work properly
      // in the CAVE. This is due to changes in the OpenGL library and
      // cannot be fixed. On a 2D screen the scaling should look correct.
      //

      // Calculate the nominal pixel size for particles
      float pointSizeCounter=frustum.getPixelSize() * 2.0f * particleRadius;

      float pointSizeDenominator=frustum.getEyeScreenDistance();

      // Query the maximum point size accepted by glPointSize(...)
      GLfloat pointSizeRange[2];
      glGetFloatv(GL_SMOOTH_POINT_SIZE_RANGE, pointSizeRange);

      // Enable point parameters
      glPointSize(pointSizeRange[1]); // select the maximum point size
      pointSizeCounter/=pointSizeRange[1]; // adjust the point size numerator
      GLfloat attenuation[3]= { 0.0f, 0.0f, 0.0f };
      attenuation[2]=Math::sqr(pointSizeDenominator / pointSizeCounter);
      glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, attenuation);

   }

   glBindBufferARB(GL_ARRAY_BUFFER_ARB, dataItem->vertexBufferId);
   glEnableClientState(GL_VERTEX_ARRAY);
   glEnableClientState(GL_COLOR_ARRAY);

   if (dataItem->versionDS != data.currentVersion)
   {
      dataItem->numParticlesDS = data.particles.size();
      glBufferDataARB(GL_ARRAY_BUFFER_ARB, dataItem->numParticlesDS * sizeof(PointParticle), &data.particles[0], GL_DYNAMIC_DRAW_ARB);
      dataItem->versionDS = data.currentVersion;
   }

   glInterleavedArrays(GL_C4UB_V3F, sizeof(PointParticle), 0);


   // Care needed if particle number has changed but we haven't updated buffer.
   glDrawArrays(GL_POINTS, 0, dataItem->numParticlesDS);

   glDisableClientState(GL_COLOR_ARRAY);
   glDisableClientState(GL_VERTEX_ARRAY);

   #ifndef GHETTO
   if (dataItem->hasShaders)
   #endif
   {
      glUseProgramObjectARB(0);
      glDisable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB);
   }

   glBindTexture(GL_TEXTURE_2D, 0);
   glDisable(GL_TEXTURE_2D);
   glDisable(GL_POINT_SPRITE_ARB);

   // restore previous attribute state
   glPopAttrib();
}
Beispiel #10
0
int
main(int argc, char **argv)
{
  int i;

  glutInitWindowSize(600,300);
  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_MULTISAMPLE);

  for (i=1; i<argc; i++) {
    if(!strcmp("-noms", argv[i])) {
      glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
      printf("forcing no multisampling\n");
    } else if(!strcmp("-nomipmaps", argv[i])) {
      useMipmaps = 0;
    } else if(!strcmp("-nearest", argv[i])) {
      linearFiltering = 0;
    }
  }
  glutCreateWindow("sprite blast");
  glewInit();
  glutReshapeFunc(reshape);
  glutDisplayFunc(redraw);
  glutMouseFunc(mouse);
  glutMotionFunc(mouseMotion);
  glutVisibilityFunc(visible);
  glutKeyboardFunc(key);
  glutCreateMenu(menu);
  glutAddMenuEntry("Reset time", 0);
  glutAddMenuEntry("Constant", 1);
  glutAddMenuEntry("Linear", 2);
  glutAddMenuEntry("Quadratic", 3);
  glutAddMenuEntry("Blend on", 4);
  glutAddMenuEntry("Blend off", 5);
  glutAddMenuEntry("Threshold 1", 6);
  glutAddMenuEntry("Threshold 10", 7);
  glutAddMenuEntry("Point smooth on", 8);
  glutAddMenuEntry("Point smooth off", 9);
  glutAddMenuEntry("Point size 16", 10);
  glutAddMenuEntry("Point size 32", 11);
  glutAddMenuEntry("Point size 64", 12);
  glutAddMenuEntry("Toggle spin", 13);
  glutAddMenuEntry("200 points ", 14);
  glutAddMenuEntry("500 points ", 15);
  glutAddMenuEntry("1000 points ", 16);
  glutAddMenuEntry("2000 points ", 17);
  glutAddMenuEntry("Quit", 666);
  glutAttachMenu(GLUT_RIGHT_BUTTON);

  makePointList();
  makeSpriteTextures();
  makeFragShader();

  glShadeModel(GL_FLAT);
  glEnable(GL_DEPTH_TEST);
  glEnable(GL_POINT_SMOOTH);
  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  glPointSize(32.0);
#ifdef GL_ARB_point_parameters
  glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, theQuad);
#endif

  glutMainLoop();
  return 0;             /* ANSI C requires main to return int. */
}
Beispiel #11
0
static void
menu(int option)
{
  switch (option) {
  case 0:
    makePointList();
    break;
#ifdef GL_ARB_point_parameters
  case 1:
    glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, constant);
    break;
  case 2:
    glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, linear);
    break;
  case 3:
    glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, theQuad);
    break;
#endif
  case 4:
    blend = 1;
    break;
  case 5:
    blend = 0;
    break;
#ifdef GL_ARB_point_parameters
  case 6:
    glPointParameterfARB(GL_POINT_FADE_THRESHOLD_SIZE_ARB, 1.0);
    break;
  case 7:
    glPointParameterfARB(GL_POINT_FADE_THRESHOLD_SIZE_ARB, 10.0);
    break;
#endif
  case 8:
    glEnable(GL_POINT_SMOOTH);
    smooth = 1;
    break;
  case 9:
    glDisable(GL_POINT_SMOOTH);
    smooth = 0;
    break;
  case 10:
    glPointSize(16.0);
    break;
  case 11:
    glPointSize(32.0);
    break;
  case 12:
    glPointSize(64.0);
    break;
  case 13:
    spin = 1 - spin;
    if (animate && (spin || motion)) {
      glutIdleFunc(idle);
    } else {
      glutIdleFunc(NULL);
    }
    break;
  case 14:
    numPoints = 200;
    break;
  case 15:
    numPoints = 500;
    break;
  case 16:
    numPoints = 1000;
    break;
  case 17:
    numPoints = 2000;
    break;
  case 666:
    exit(0);
  }
  glutPostRedisplay();
}
Beispiel #12
0
void DotSpreaderTool::render(DTS::DataItem* dataItem) const
{
   // if dragging locator render release sphere
   if (active and !data.running)
   {
      // save current attribute state
      #ifdef MESA
      // GL_POINT_BIT causes GL enum error
      glPushAttrib(GL_LIGHTING_BIT | GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
      #else
      glPushAttrib(GL_LIGHTING_BIT | GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_POINT_BIT);
      #endif

      glDisable(GL_LIGHTING);

      // save current location
      glPushMatrix();

      // move to center of sphere
      glTranslatef(org[0], org[1], org[2]);

      // compute radius of sphere
      float radius=Math::sqrt((pos[0] - org[0]) * (pos[0] - org[0]) + (pos[1]
            - org[1]) * (pos[1] - org[1]) + (pos[2] - org[2]) * (pos[2]
            - org[2]));

      GLUquadricObj *quadric=gluNewQuadric();

      // draw transparent sphere
      gluQuadricDrawStyle(quadric, GLU_FILL);
      glDepthMask(GL_FALSE);
      glEnable(GL_BLEND);
      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

      glColor4f(0.0f, 0.6f, 1.0f, 0.2f);

      gluSphere(quadric, radius, 10, 15);
      glDisable(GL_BLEND);

      // draw surrounding wireframe (solid)
      gluQuadricDrawStyle(quadric, GLU_LINE);
      glDepthMask(GL_TRUE);
      glColor4f(0.0f, 0.8f, 1.0f, 1.0f);

      gluSphere(quadric, radius, 10, 15);
      glDepthMask(GL_FALSE);

      gluDeleteQuadric(quadric);

      // restore previous position
      glPopMatrix();
      // restore previous attribute state
      glPopAttrib();
   }
   // if simulation is running draw particles
   else if (data.running)
   {
      // save current attribute state
      #ifdef MESA
      // GL_POINT_BIT causes GL enum error
      glPushAttrib(GL_LIGHTING_BIT | GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
      #else
      glPushAttrib(GL_LIGHTING_BIT | GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_POINT_BIT);
      #endif

      glDisable(GL_LIGHTING);
      glDepthMask(GL_FALSE);

      glEnable(GL_POINT_SMOOTH);
      glEnable(GL_BLEND);
      glBlendFunc(GL_SRC_ALPHA, GL_ONE);

      glEnable(GL_TEXTURE_2D);
      glBindTexture(GL_TEXTURE_2D, dataItem->spriteTextureObjectId);
      glTexEnvf(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE);
      glEnable(GL_POINT_SPRITE_ARB);

      float particleRadius=data.point_radius;

      // Query the OpenGL viewing frustum
      GLFrustum<float> frustum;
      frustum.setFromGL();

      #ifdef GHETTO
      if (0)
      #else
      if (dataItem->hasShaders)
      #endif
      {
         /* Calculate the scaled point size for this frustum: */
         GLfloat scaledParticleRadius=frustum.getPixelSize() * particleRadius
               / frustum.getEyeScreenDistance();

         /* Enable the vertex/fragment shader: */
         glEnable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB);
         glUseProgramObjectARB(dataItem->programObject);
         glUniform1fARB(dataItem->scaledParticleRadiusLocation, scaledParticleRadius);
         glUniform1iARB(dataItem->tex0Location, 0);
      }
      else
      {
         glPointSize(particleRadius
               * Vrui::getNavigationTransformation().getScaling());

         GLfloat linear[3]= { 0.0, 1 / 5.0, 0.0 };
         glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, linear);

         //
         // NOTE::the following scaling calculation does not work properly
         // in the CAVE. This is due to changes in the OpenGL library and
         // cannot be fixed. On a 2D screen the scaling should look correct.
         //

         // Query the OpenGL viewing frustum
         GLFrustum<float> frustum;
         frustum.setFromGL();

         // Calculate the nominal pixel size for particles
         float pointSizeCounter=frustum.getPixelSize() * 2.0f * particleRadius;

         float pointSizeDenominator=frustum.getEyeScreenDistance();

         // Query the maximum point size accepted by glPointSize(...)
         GLfloat pointSizeRange[2];
         glGetFloatv(GL_SMOOTH_POINT_SIZE_RANGE, pointSizeRange);

         // Enable point parameters
         glPointSize(pointSizeRange[1]); // select the maximum point size
         pointSizeCounter/=pointSizeRange[1]; // adjust the point size numerator
         GLfloat attenuation[3]= { 0.0f, 0.0f, 0.0f };
         attenuation[2]=Math::sqr(pointSizeDenominator / pointSizeCounter);
         glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, attenuation);
      }

      glBindBufferARB(GL_ARRAY_BUFFER_ARB, dataItem->vertexBufferId);
      glEnableClientState(GL_VERTEX_ARRAY);
      glEnableClientState(GL_COLOR_ARRAY);

      // If data has been modified, send to graphics card
      if (dataItem->versionDS != data.currentVersion)
      {
         dataItem->numParticlesDS = data.numPoints;
         glBufferDataARB(GL_ARRAY_BUFFER_ARB, dataItem->numParticlesDS
               * sizeof(ColorPoint), &data.particles[0], GL_DYNAMIC_DRAW_ARB);

         dataItem->versionDS = data.currentVersion;
      }

      glInterleavedArrays(GL_C4UB_V3F, sizeof(ColorPoint), 0);

      glDrawArrays(GL_POINTS, 0, dataItem->numParticlesDS);

      glDisableClientState(GL_COLOR_ARRAY);
      glDisableClientState(GL_VERTEX_ARRAY);

      #ifndef GHETTO
      if (dataItem->hasShaders)
      #endif
      {
         glUseProgramObjectARB(0);
         glDisable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB);
      }

      glBindTexture(GL_TEXTURE_2D, 0);
      glDisable(GL_TEXTURE_2D);
      glDisable(GL_POINT_SPRITE_ARB);
      glDisable(GL_BLEND);

      // restore previous attribute state
      glPopAttrib();
   }
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBPointParameters_nglPointParameterfvARB(JNIEnv *env, jclass clazz, jint pname, jlong pfParams, jlong function_pointer) {
	const GLfloat *pfParams_address = (const GLfloat *)(intptr_t)pfParams;
	glPointParameterfvARBPROC glPointParameterfvARB = (glPointParameterfvARBPROC)((intptr_t)function_pointer);
	glPointParameterfvARB(pname, pfParams_address);
}