Results 1 to 4 of 4

Thread: A program to generate scenes

  1. #1
    Guest

    A program to generate scenes

    What is the best way to plot a pixel in a three dimensional graph based on the mouse position on the screen? When the user presses the mouse button the pixel should appear

    where the mouse cursor is (which can be an infinite number of points going away from
    the cursor position). I am guessing I should start by calculating a vector that
    represents all posible values where the point could be plotted. Then I would need to
    decide how far from the viewer to plot the point. I just have no idea how to go about
    this mathematically.

    This is for a simple project I am working on as part of my opengl education. I decided
    to create a program that I can use to generate vertex arrays of scenes more quickly than coding glVertex3f() a million times and figuring out all the vertices by hand.

  2. #2
    Senior Member Regular Contributor
    Join Date
    May 2000
    Location
    Oxford, England
    Posts
    472

    Re: A program to generate scenes

    gluUnProject

  3. #3
    Guest

    Re: A program to generate scenes

    Thank you for the reply. I had thought about trying to use gluUnProject but I came across a slight problem.

    gluUnProject:
    The gluUnProject function maps window coordinates to object coordinates.

    int gluUnProject(
    GLdouble winx,
    GLdouble winy,
    GLdouble winz,
    const GLdouble modelMatrix[16],
    const GLdouble projMatrix[16],
    const GLint viewport[4],
    GLdouble * objx,
    GLdouble * objy,
    GLdouble * objz
    );

    I believe that this function is used when you are trying to get the coordinates of an object that already exists. I am trying to figure out where to plot the object (in this case a point). I am going to look around some more on this function to see if I can actually use it. I will check back latter.

  4. #4
    Guest

    Re: A program to generate scenes

    sorry to have questioned you. I tried gluUnProject and so far it works perfectly. I just needed to set the winz variable to zero. Thanks a lot ya bloke.

Similar Threads

  1. scenes
    By phil67rpg in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 11-18-2004, 06:54 PM
  2. change scenes
    By nergal in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 10-28-2003, 11:23 AM
  3. switching scenes in program
    By nergal in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 10-04-2002, 03:30 AM
  4. Demo scenes ...
    By GL_SH in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 06-10-2002, 09:43 PM
  5. Creating 3D scenes
    By nexusone in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-12-2000, 12:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean