Jump to content
  • Advertisement
Sign in to follow this  

OpenGL Ray Tracing problems

This topic is 3655 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 All! This is my first time posting on GameDev, quite exciting! I very recently got into computer graphics and am using OpenGL to do my learning. At this point I'm working on a ray tracer and am getting some strange behavior, I think. So here's the code I'm working with (it's the display function hooked to glutDisplayFunc):
void display(void)

    GLdouble projection[16];
    GLdouble modelview[16];
    GLint viewport[4];
    GLdouble objx,objy,objz;


    for (int x = 0; x < 128; x++)
        for (int y = 0; y < 128; y++)
            cout << "pixel (x,y=" << x << "," << y << ") => " << objx << " " << objy << " " << objz << endl;

I'm using gluUnProject to get my pixel coordinates in object space so I can compute my ray vector. The picture will be 128x128 pixels. My question is - does this look right as far as correctly using gluUnProject to get the pixel coordinates? All of my objx, objy, and objz values come out to 49.xxxx. The numbers seemed strange to me because if I combined these numbers with that of my camera coordinates then it would produce very similar vectors for all of my rays. I guess I'm just really unsure of myself since I'm so new at this, but I'm hoping to get some positive feedback from all you pros out there :) Thanks for taking the time to read. Regards, Forkbomb [Edited by - Forkbomb on December 6, 2008 1:30:54 PM]

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!