Sign in to follow this  

How to Get WorldViewProjection Matrix in OpenGL?

This topic is 3477 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(, 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