Archived

This topic is now archived and is closed to further replies.

TThirion

Strange Cg/GL Transformation Problem

Recommended Posts

So I'm doing Cg fragment lighting in OpenGL. When I use the fixed functionality pipeline, I do this and get correct output.
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
	glTranslatef(0, 0, -5.0f);
	glRotatef(theta, 0.25f, 0.634f, 0.26f);
	glGetFloatv(GL_MODELVIEW_MATRIX, modelView);
	cgGLSetMatrixParameterfc(modelViewProj, modelView);
	glutSolidTeapot(2.0f);
glPopMatrix();
glutSwapBuffers();
As you can see I pass in the current Modelview matrix as a column-major matrix. But when I enable the appropriate profile, and bind my programs, It seems as though the translation did not occur at all; the camera is inside the teapot. The rotation may or may not be happening. Here's the relevant Cg code:
uniform float4x4 modelViewProj
...
oPosition = mul(modelViewProj, position);
Any clues? Thanks, TT [edited by - TThirion on May 20, 2004 5:59:53 PM]

Share this post


Link to post
Share on other sites
ModelViewProjMatrix=ModelViewMatrix*ProjectionMatrix



"C lets you shoot yourself in the foot rather easily. C++ allows you to reuse the bullet!"

Share this post


Link to post
Share on other sites