OpenGL Transformation issues

Started by
-1 comments, last by Xetheriel 18 years ago
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[y] * m2[x];
	}
	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?

This topic is closed to new replies.

Advertisement