Hey all!
So I’m trying to work with some 3d boxes in ortho and I’m stumped at the first hurdle.
I’m using an ortho camera and for some odd reason if I also use ofEnableDepthTest() in my code any objects I have created start clipping in the background like I’ve shown bellow.
bool camBool;
ofCamera cam;
void ofApp::setup(){
camBool = false;
}
void ofApp::draw(){
if (camBool) {
cam.begin();
cam.enableOrtho();
}
ofEnableDepthTest();
if (!camBool) { ofTranslate(ofGetWidth()/2,ofGetHeight()/2); }
ofRotateXDeg(ofMap(sin(ofGetElapsedTimef()),-1,1,-90,90));
ofRotateZDeg(ofMap(sin(ofGetElapsedTimef() + 20),-1,1,-90,90));
ofFill();
ofSetColor(255);
ofDrawBox(100);
ofNoFill();
ofSetLineWidth(3);
ofSetColor(0);
ofDrawBox(100);
ofDisableDepthTest();
if (camBool) { cam.end(); }
}
void ofApp::keyPressed(int key){
camBool = !camBool;
}
Does anyone have a clue how to fix this?
Many thanks!