Jump to content
  • Advertisement
Sign in to follow this  
kitman20022002

OpenGL How can I inverse the pitch it only have the viewmatrix (OpenGL)

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

How can I inverse the pitch if I only have the viewmatrix in OpenGL, as describe from this video
from 11:19 to 12:19 thanks
Edited by kitman20022002

Share this post


Link to post
Share on other sites
Advertisement

All you have to do is invert the y-axis (multiply by -1).  If you are using glRotate etc, then you could call glGetFloatv() get the matrix and invert the proper #'s in the matrix.  You could try applying a glScalef(0,-1,0) as the last matrix after your current camera matrix. I believe that will work.

Share this post


Link to post
Share on other sites

tempCam = inverse(m_viewMatrix);

I assuming you mean this tempCam[1].y *= -1; , am I'm correct? I try this does not work 

 

and also I try these

 

tempCam[2] = glm::reflect(tempView[2] , glm::vec4(1,0,0,1));
tempCam[2].w = 0.0f;
 
and also changing the fg shader code to    
vec4 tmp = vec4(1.0 / pos.w);     
vec4 projCoord = pos * tmp;     
projCoord += vec4(1.0);     
projCoord *= vec4(0.5);  
vec4 reflectColor =texture(reflectionTexture , projCoord.xy);
 
 
and 
 tempCam [0].y *= -1;
 tempCam [1].y *= -1;
  tempCam [2].y *= -1;
 
 
and 
 
tempCam[2] = glm::reflect(tempCam[2] , glm::vec4(1,0,0,1));
tempCam[2].w = 0.0f;
tempCam[1].y *= -1;
 
glm::mat4 tempView = inverse(tempCam);
drawScene(m_projection , inverse(tempCam ));
 
but does not work as well?
 
and also not using glRotate at all becasue my camera is handle by 
Utility::freeMovement( m_cameraMatrix, a_deltaTime, static_cast<float>(m_cameraSpeed));
Edited by kitman20022002

Share this post


Link to post
Share on other sites

Well assuming tempCam matrix stores the matrix as an array of 16 floats:

tempCam[4], tempCam[5], tempCam[6] should be multiplied by -1.

Edited by dpadam450

Share this post


Link to post
Share on other sites

Still didn't work,and by the way tempCam[2] means column2, so tempCam[4], tempCam[5], tempCam[6] will give me column4 , 5, 6 which does not exists, but I forgot I can draw line to help me debug it so the ANSWER is I find out was:

tempCam[2].y *= -1.0f;
tempCam[3].x *= -1.0f;
tempCam[3].z *= -1.0f; 
 

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!