Jump to content
  • Advertisement
Sign in to follow this  
spek

OpenGL Setting OpenGL matrices in Cg - Slow

This topic is 3479 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

Hi, When trying to speed up things, I noticed that setting the ModelViewProjection matrix (OpenGL, Cg) is quite slow. So I tried the tips from this post: http://www.gamedev.net/community/forums/topic.asp?topic_id=501802 It seems that this trick works. But how does it come that the default method, cgGLSetStateMatrixParameter( handle, CG_GL_MODELVIEW_PROJECTION_MATRIX, CG_GL_MATRIX_IDENTITY ); shown in many demo's, is so slow? In my engine I have quite many different matrices that need to be set before start rendering. For example, each object has its own transformation/rotation, and background passes that require a different camera need to adjust the ModelViewProjection matrix as well. Is this a OpenGL/Cg problem? And/or should I change the way I render objects?
shaderX.apply();

< for each object that uses shaderX >
glPushMatrix;
glMultMatrixf( object.matrix );

<render object>

glPopMatrix;

shaderX.unApply();
Greetings, Rick

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!