Jump to content
  • Advertisement

Archived

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

TThirion

Strange Cg/GL Transformation Problem

This topic is 5175 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!