Sign in to follow this  
Xetheriel

OpenGL OpenGL Transformation issues

Recommended Posts

Okay, so I have my transformation node setup to calculate the final transformation of the object under it to do this I do this:
	void Update()
	{
		this->FinalMatrix = LocalMatrix * ParentNode->FinalMatrix;
		glMatrixMode(GL_MODELVIEW);
		glPushMatrix();
		glLoadMatrixf(this->FinalMatrix.readArray());
		CSceneNode::Update();
		glPopMatrix();
	}
This should set FinalMatrix up and use it to draw the next model.. Here is the * operator overloaded
inline Matrix4 operator* (const Matrix4& m1, const Matrix4& m2) {
	Matrix4 retVal;
	for (int x=0;x<4;++x) for (int y=0;y<4;++y) {
		retVal(x)[y] = 0;
		for (int i=0;i<4;++i) retVal(x)[y] += m1[i][y] * m2[x][i];
	}
	return retVal;
}


And finally, I suppose you should see the drawglscene function:
void DrawGLScene () 
{ 

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);	
	glLoadIdentity();
	RootNode->Update();
	glLoadIdentity();
	Cam.SetPrespective();
	CheckKeys();
	CheckMouse();    

}


Now this code compiles fine, but when the program actually starts up, I'm not looking at what I should, I don't think the model is where it should be, my camera is locked, cant move it... What in the world is going on here? If you need more information just ring a bell, or am I doing something horribly wrong in my code I gave you?

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this