shaders and ARB textures

Hi,

I’m trying to build a particle system that uses shaders for rendering. I started with a working system using GL_POINT_SPRITE, a simple texture, and additive blending. I was able to reproduce the sprites, sans blending or alpha using a shader and ofDisableArbTex(). However, when I leave ARB textures enabled, I can’t get it to work. I think I need ARB textures to do the next step, which involves masking and multitextures, but first I just want to get the sprites working with ARB textures.

I’m seeing two problems: first, the particles are always 1 pixel, despite GL_VERTEX_PROGRAM_POINT_SIZE_ARB and gl_PointSize = 10.0. Second, I can bump the particle size up with something like glPointParameterfARB(GL_POINT_SIZE_MIN_ARB, 10.0), but each particle is just a gray box (perhaps the average color of the texture, or the color of one pixel of the texture).

Here’s an excerpt from my app code:

  
  
                static void setup(){  
                        shader->setup("shader");  
  
                        Particle::particleTexture->loadImage("particle.png");  
                }  
  
                static void startDraw(){  
                        glEnable(GL_POINT_SPRITE_ARB);  
                        glEnable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB);  
                        glTexEnvi(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE);  
  
                        glEnable(GL_BLEND);  
                        glBlendFunc(GL_SRC_ALPHA, GL_ONE);  
                        glDisable(GL_LIGHTING);  
  
                        glBegin(GL_POINTS);  
  
                        shader->setTexture("particleTex", Particle::particleTexture->getTextureReference(), 0);  
                        shader->begin();  
                }  
  
                void draw(){  
                        glColor4f(r, g, b, multiplier * 0.1);  
                        glVertex3f(x, y, 0);  
                }  
  
                static void endDraw(ofImage * currentImg){  
                        shader->end();  
                        glEnd();  
                        glEnable(GL_LIGHTING);  
                        glDisable(GL_BLEND);  
                        glDisable(GL_POINT_SPRITE_ARB);  
                        glDisable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB);  
                }  
  
  

startDraw and endDraw are called once each frame for all particles, draw is called once for each particle.

Here’s my vertex shader:

  
  
void main() {  
        gl_PointSize = 10.0;  
  
        gl_Position = ftransform();  
        gl_FrontColor = gl_Color;  
        gl_TexCoord[0] = gl_MultiTexCoord0;  
}  
  

and my fragment shader:

  
  
uniform sampler2DRect particleTex;  
  
void main()  
{  
        vec4 color = texture2DRect(particleTex, gl_TexCoord[0].st);  
        gl_FragColor = color;  
}  
  

I’m running OS X 10.5.8 with a NVIDIA GeForce 9600M GT.

Any help or pointers would be greatly appreciated; I’ve been banging my head on this for far too long.