Jump to content

  • Log In with Google      Sign In   
  • Create Account


cec19

Member Since 09 Jan 2012
Offline Last Active Feb 09 2012 08:33 AM
-----

Posts I've Made

In Topic: Cubemap problems

16 January 2012 - 03:27 AM

Well, I don't use cube maps for implementing skyboxes, but I found something interesting about them in OpenGL.org. Maybe that is the solution for your problem.

http://www.opengl.org/wiki/Common_Mistakes#Creating_a_Cubemap_Texture

If you want I can post my code(or share a download link to it) so you can use it for your skyboxes.

In Topic: Mouse ray picking not working.

10 January 2012 - 05:10 AM

I managed to fix the problem. The code, which made things not work was in the display function:

void Display()
{
    glClearColor(0.0, 0.0, 0.0, 1.0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();


    glPushMatrix();
        ApplyCamera();
        DrawGrid(10000, 200);
        DrawObjects();

    glPopMatrix();

    DrawText();


    glutSwapBuffers();
}

Simply, the push and pop funcs are making sth wrong in my code(I am not so experienced and I can't tell exactly what). By removing them I managed to get good results for the depth buffers.

void Display()
{
    glClearColor(0.0, 0.0, 0.0, 1.0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();


    DrawText();

    ApplyCamera();
    DrawGrid(10000, 200);
    DrawObjects();


    glutSwapBuffers();
}

Thats it! If anyone can explain me why the pushing and popping matrices screws the whole algorithm please post. :)

PARTNERS