I’m working with texture arrays particle system modified from this thread: http://forum.openframeworks.cc/t/vbo-billboard-particle-system/2639/0
I modified it to translate to one of the particles (zooming into it). When this point/quad/sprite is at the front, however, all the other points behind it are being drawn on top of it, see attachments below.
Render():
ofPushMatrix();
ofTranslate(transX, transY, transZ);
ofCircle(pos[0].x, pos[0].y, pos[0].z, 20);
ofSetColor(255, 0, 0);
glEnable(GL_TEXTURE_2D);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
// bind tex coors
glBindBufferARB(GL_ARRAY_BUFFER_ARB, particleVBO[2]);
glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, (MAX_PARTICLES*4)*2*sizeof(float), texcords);
glTexCoordPointer(2, GL_FLOAT, 0, 0);
// bind color
glBindBufferARB(GL_ARRAY_BUFFER_ARB, particleVBO[0]);
glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, (MAX_PARTICLES*4)*4*sizeof(float), color);
glColorPointer(4, GL_FLOAT, 0, 0);
// bind vertices [these are quads]
glBindBufferARB(GL_ARRAY_BUFFER_ARB, particleVBO[1]);
glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, (MAX_PARTICLES*4)*3*sizeof(float), pos);
glVertexPointer(3, GL_FLOAT, 0, 0);
// draw the vbo
glDisable(GL_DEPTH_TEST);
ofEnableArbTex();
ofEnableAlphaBlending();
texture.getTextureReference().bind();
glDrawArrays(GL_QUADS, 0, MAX_PARTICLES*4);
texture.getTextureReference().unbind();
ofDisableAlphaBlending();
ofDisableArbTex();
glEnable(GL_DEPTH_TEST);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glDisable(GL_TEXTURE_2D);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
ofPopMatrix();
I set the transX, TransY and transZ to the particle that I want to display.
How come the particles/points/sprites behind this one are being displayed on top? Why are they not being clipped out? Where would I begin to have the different layers/levels clip?

