Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: back projecting from screen to camera space

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2005
    Posts
    17

    back projecting from screen to camera space

    Currently, I only know how to use opengl to project from camera space to screen via setting to GL_PROJECTION and setting gluPerspective.
    But what I need to do now is, given an already projected image in 2D taken by a camera, project that back onto a 2D quad in camera space.

    Let's say that the camera is located at 0,0,-3, looking at 0,0,0. How do I, given an image of x,y size, project that onto a quad of the same or smaller size (i know it's not going to fit) which will be part of a voxel slice in a cube.

    I've read a bit about doing ray traces from mouse positions to locate what you're clicking on in 3D space and I think this is connected, I just don't know how atm.

    My train of thought goes along the path of taking each corner of the image as a position of the mouse click and projecting that ray through the viewing volume to intersect with the plane which the slice lies on...

    Need some advice

    Joe.
    Joe.

  2. #2
    Junior Member Regular Contributor
    Join Date
    Aug 2005
    Posts
    148

    Re: back projecting from screen to camera space

    To get back to camera space, you need to invert the viewport and projection transformations. You could use gluUnProject for this, if you supply an identity matrix for the modelview...

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2005
    Posts
    17

    Re: back projecting from screen to camera space

    yes, good that was what i wanted to hear
    thank you,

    Joe.
    Joe.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •