[IMG]http://img690.imageshack.us/img690/7592/12946613.jpg[/IMG]

why is there a hole in my cube when I rotate it like this?

colors:
front side is red
back side is white
left side is blue
right side is green
top side is yellow
bottom is teal

Recommended Answers

All 7 Replies

Could have something to do with depth.

Lets see some source code and then I'll be able to help you out more.

this the code of my opengl cube, depth test is enabled

private void Display()
        {
            Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);
            Gl.glLoadIdentity();
          
            Gl.glRotated(_xAngle, 1, 0, 0);
            Gl.glRotated(_yAngle, 0, 1, 0);
            Gl.glRotated(_zAngle, 0, 0, 1);
           
            Gl.glBegin(Gl.GL_QUADS);
            //front
            Gl.glColor3d(1,0,0);
            Gl.glVertex3d(0.75,0.75,-0.75);
            Gl.glVertex3d(-0.75, 0.75, -0.75);
            Gl.glVertex3d(-0.75, -0.75, -0.75);
            Gl.glVertex3d(0.75, -0.75, -0.75);
            //right
            Gl.glColor3d(0, 1, 0);
            Gl.glVertex3d(0.75, 0.75, 0.75);
            Gl.glVertex3d(0.75, 0.75, -0.75);
            Gl.glVertex3d(0.75, -0.75, -0.75);
            Gl.glVertex3d(0.75, -0.75, 0.75);
            //left
            Gl.glColor3d(0, 0, 1);
            Gl.glVertex3d(-0.75, 0.75, 0.75);
            Gl.glVertex3d(-0.75, 0.75, -0.75);
            Gl.glVertex3d(-0.75, -0.75, -0.75);
            Gl.glVertex3d(-0.75, -0.75, 0.75);
            //back
            Gl.glColor3d(1, 1, 1);
            Gl.glVertex3d(-0.75, 0.75, 0.75);
            Gl.glVertex3d(0.75, 0.75, 0.75);
            Gl.glVertex3d(0.75, -0.75, 0.75);
            Gl.glVertex3d(-0.75, -0.75, 0.75);
            //top
            Gl.glColor3d(1, 1, 0);
            Gl.glVertex3d(0.75, 0.75, 0.75);
            Gl.glVertex3d(-0.75, 0.75, 0.75);
            Gl.glVertex3d(-0.75, 0.75, -0.75);
            Gl.glVertex3d(0.75, 0.75, -0.75);
            //bottom
            Gl.glColor3d(0, 1, 1);
            Gl.glVertex3d(0.75, -0.75, -0.75);
            Gl.glVertex3d(-0.75, -0.75, -0.75);
            Gl.glVertex3d(-0.75, -0.75, 0.75);
            Gl.glVertex3d(0.75, -0.75, 0.75);
            Gl.glEnd();

            Gl.glFlush();
            Glut.glutSwapBuffers();
        }

I'm thinking that there is some kind of wall, like a limit.

is there a way to increase the space or do I really have to make it smaller?

Move the camera back by translating (0,0,-10) units in matrix mode projection.

I know the basics of setting up OpenGL stuff but it looks like you are using java where I know it in C++.

it looks like java but I'm really using C#, Taoframework OpenGL and FreeGlut.

Does matrixmode - projection mean that I'm moving the camera?

Yeah any translations/rotations done in projection modifies the camera and in modelview you are moving the objects.

I see, thanks :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.