• Advertisement
Sign in to follow this  

Cubemapping Views -- Camera Error

This topic is 3413 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, Well I finally got most of cubemapping figured out. One problem left though. The problem arises in that the reflections I'm seeing look completely wrong--i.e., they aren't in the right place on the reflecting object. When rendering to the texture, I set the view using gluLookAt(). I assume this is where the problem is. Here's the code (Python):
cubefaces = [GL_TEXTURE_CUBE_MAP_POSITIVE_X,
             GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
             GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
             GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
             GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
             GL_TEXTURE_CUBE_MAP_NEGATIVE_Z]
for i in xrange(0,6,1):
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
        glLoadIdentity()
        if   i == 0: gluLookAt(x,y,z, 1, 0, 0,0,1,0)
        elif i == 1: gluLookAt(x,y,z,-1, 0, 0,0,1,0)
        elif i == 2: gluLookAt(x,y,z, 0, 1, 0,1,0,0)
        elif i == 3: gluLookAt(x,y,z, 0,-1, 0,1,0,0)
        elif i == 4: gluLookAt(x,y,z, 0, 0, 1,0,1,0)
        elif i == 5: gluLookAt(x,y,z, 0, 0,-1,0,1,0)
        #Draw objects that will be reflected.  (Turning off cubemapping first, then reenabling it after)
        glTexImage2D(cubefaces,0,GL_RGB,ReflectionMapSize,ReflectionMapSize,0,GL_RGB,GL_UNSIGNED_BYTE,RenderToTextureData())
        #The last function as an argument to glTexImage2D() renders the view (it simply grabs what's in the framebuffer)
        #And so on finalising texture here...

This may not be where the problem lies--if not just say so. Ideas why this isn't working? Thanks, Geometrian [Edited by - Geometrian on October 12, 2008 9:31:26 PM]

Share this post


Link to post
Share on other sites
Advertisement
Actually, it doesn't seem to work. The trouble is, when moving the camera, strange things happen. I got the impression it was working because it seems to work only when the camera doesn't move, i.e., the world is moved. However, when gluLookAt() is called, and the camera moved in a horizontal plane, it doesn't work:
Strangely, moving in a vertical plane works:
This is a truly bizaare error. Ideas?
Thanks,
G

Share this post


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

  • Advertisement