Jump to content
  • Advertisement
Sign in to follow this  
Peronet

OpenGL Environment map using GLSL- can't get right orientation to work

This topic is 4441 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 there! I am currently working on a cubemap using GLSL, I have gotten it to work quite well for a static scene, but as I am changing the view position in OpenGL using gluLookAt the texture coordinates for the lookup is still not changed. What happens is that when I move around in my environment, the reflections on objects are always the same regarding "eye position in world". I was thinking that an inverse matrix of the view matrix might do the trick or using the glMatrixMode(GL_TEXTURE) to align the environmentmap to the world orientation. I have been trying this out for a while, aswell as trying to recalculate the vectors using world coordinates in the shader to do the trick but then i got some crazy texture-morphing going on and no success. Anyone has any tips or tricks to fix the cubemap orientation to change in the right way as I move around in space?

Share this post


Link to post
Share on other sites
Advertisement
Got the rotation to run now at least, now only the angles are the problemb as I move around the scene, hope I will work that out today.

I just use the glMatrixMode(GL_TEXTURE) and then use the OpenGL rotate commands to get the right rotation according to the vectors from the cubemap to the origin and the eyevector. The axis to rotate around can be found using the cross product between those vectors and the angle can be computed using the dot product and some trigfunc.

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.

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!