Hi,
My engine is complete, and while writing a tech game with it, I decided to add a particle system using nvidia point sprites, for g3+.
But, they’re not showing up right. I can see them sometimes, but they’re always 1 pixel thick(I.e a texture line) and don’t fit in with the scene at all.
This is the code I use to render them.
BBD void BBC Particle_RenderNV(){
particle *p;
GLuint lockedTex;
glEnable(GL_BLEND);
glBlendFunc(GL_ONE,GL_ONE);
glEnable(GL_TEXTURE_2D);
glEnable(GL_POINT_SPRITE_NV);
glTexEnvf(GL_POINT_SPRITE_NV,GL_COORD_REPLACE_NV,GL_TRUE);
//glPointParameterf(GL_POINT_SPRITE_R_MODE_NV,GL_ZERO);
glPointSize(1);
glLoadIdentity();
glPushMatrix();
glRotatef(camroll,0,0,1);
glRotatef(campitch,1,0,0);
glRotatef(camyaw,0,1,0);
glPushMatrix();
glTranslatef(camx,camy,camz);
glBegin(GL_POINTS);
for(int j=0;j<parc;j++){
p=sys[j];
if(!p->texture==lockedTex){
glBindTexture(GL_TEXTURE_2D,p->texture);
lockedTex=p->texture;}
glVertex3f(p->x,p->y,p->z);
};
glEnd();
glDisable(GL_TEXTURE_2D);
glDisable(GL_POINT_SPRITE_NV);
glPopMatrix();
glPopMatrix();
};
Camx,camy,camz/pitch/yaw/roll are what I use to render my scene. Which all displays fine btw, using vbos.
I guess my question is, how do I integrate the particles into the same viewport as I render my objects.
I figured simply setting up the same camera position, then using glVertex with the particles world position would do it.
I also tried manually setting the viewport for each particle, then passing a vert at 0,0,0. Identical code to what my mesh renderer uses, but this time, I could only see if I moved far away from 0,0,0 and while looking down. barely.
Any ideas where I’m going wrong?