Incorrect Depth view

Hi guy.
I have small issue

I’m working about spiral shape particle swarm
This is my code

double a = 0;
    float y = 0;
    for(int i = 0; i < 100; i +=2){
        ofSetColor(i+150, i, 255);
        glTranslated(ofGetWidth()/2+sin(a)*200, y, -ofGetHeight()+cos(a)*300);
        ofCircle(0, 0, 20);
        ofSetColor(0, 0, 0);
        ofCircle(0, 0, 20);
        a = a + inc;
        y += 15;

In this code
I write ‘Z’ position data so small circle in far form the camera
but in this graphic small circle is in front of big circle
How can I fix it?


first you should use ofPushMatrix(), ofTranslate( ) and ofPopMatrix() instead of its GL counterparts, as the OF functions will work properly regardless of the renderer.

As for your problem, you need to activate the depth test using ofEnableDepthTest() this will sort properly the circles.

My issue is solved thank you roymacdonald

no problem.
Be aware that enabling the depth test is a bit expensive and it can make other things to behave improperly. To disable it you can use ofDisableDepthTest().