Jump to content
  • Advertisement
Sign in to follow this  

How to Get WorldViewProjection Matrix in OpenGL?

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

my code: void display() { float WorldViewMatrix[16]; float ProjectionMatrix[16]; ... /////////////////////////////// //// the code to set the camera /////////////////////////////// glMatrixMode(GL_MODELVIEW); glGetFloatv(GL_MODELVIEW_MATRIX,WorldViewMatrix); glMatrixMode(GL_PROJECTION); glGetFloatv(GL_PROJECTION_MATRIX,ProjectionMatrix); cgSetMatrixParameterfr(cgp_WorldViewMatrix,WorldViewMatrix); cgSetMatrixParameterfr(cgp_ProjectionMatrix,ProjectionMatrix); cgUpdateProgramParameters(m_CGProgram); ... } CG file: vOutPut C2E1v_green(float3 position : POSITION ,const uniform float4x4 WorldView,const uniform float4x4 Projection) { vOutPut OUT; OUT.position = mul(WorldView, float4(position.xyz, 1.0)); OUT.position = mul(Projection,OUT.position); float dis = length(OUT.position); OUT.color = float4(0.0,1.0,0.0,1.0); return OUT; } but I can't get a normal scene.the scene was distorted . why? How to get the WorldViewProjection Matrix in OpenGL?

Share this post

Link to post
Share on other sites
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!