Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Cube rotating on its own axis in orthographic projection

$
0
0

@sorrentix wrote:

Hello everyone,
I know I am asking something quite silly, but I can’t figure out what am I doing wrong.
I have a cube, facing the “camera”, rotating on its y axis, in an ortograpic projection.
I have colored each face with a different color.
My main question is: shouldn’t I see just 1 or 2 faces (maximum) per every frame?
Thanks! =)

//--------------------------------------------------------------
void ofApp::setup(){

	
	ofSetColor(255, 0, 0);
	ofColor red(255, 0, 0);
	ofColor green(0, 255, 0);
	ofColor blue(0, 0, 255);
	ofColor cyan(0, 255, 255);
	
	box.set(size);
	box.setSideColor(0, red);
	box.setSideColor(1, green);
	box.setSideColor(2, blue);
	box.setSideColor(3, cyan);
}

//--------------------------------------------------------------
void ofApp::update(){

}

//--------------------------------------------------------------
void ofApp::draw(){


	ofSetMatrixMode(OF_MATRIX_PROJECTION);
	ofSetupScreenOrtho(800, 800, 0, 100);
	ofSetMatrixMode(OF_MATRIX_MODELVIEW);
	ofLoadIdentityMatrix();

	ofTranslate(0, 0, -40);

	gluLookAt(0, 0, -10, 0, 0, 0, 0, 1, 0);

	ofBackground(0);


	ofPushMatrix();
	   ofLoadIdentityMatrix();
	   ofTranslate(400 - size / 2, 400 - size / 2);
	   box.rotate(-1, 0, 1, 0);
	   box.draw();
	   box.drawAxes(100);
	ofPopMatrix();

}

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles