Results 1 to 5 of 5

Thread: coordinates problem

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2009
    Posts
    6

    coordinates problem

    hi,
    i would like to know the coordinates of my object at clicked point.for this i use gluUnProject() function.

    i have declared glortho as

    glortho(-180,180,-90,90)


    it is showing xcoordinates from -180 to 180 correctly. but it is showing y coordinates faultly from -112 to 68. can anyone help me why this is happening like this.

    thanks and regards
    k. bhogasena reddy

  2. #2
    Senior Member Regular Contributor trinitrotoluene's Avatar
    Join Date
    Sep 2008
    Location
    Montérégie,Québec
    Posts
    362

    Re: coordinates problem

    I remember a long time ago, I had the same problem. I was using Qt. I used a QGLWidget embedded in a QMainWindow to draw with OpenGL. The problem is that I have used the screen coordinates of the QMainWindow and all my screen coordinates was 22 pixels too low. This appear to be the height of the tool bar of the QMainWindow. After I used the screen coordinate of the QMainWindow child widget and my screen coordinates was now ok. So 90 - 68 = 22 pixels. Maybe you made the same mistake.

    Can you post some source code to verify?

  3. #3
    Junior Member Newbie
    Join Date
    Jan 2009
    Posts
    6

    Re: coordinates problem

    yes,
    it's working now. thanks for u r reply.

    and i have one more question. i rendered filled concave polygons. how to render outerlines for those.

  4. #4
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: coordinates problem

    To render outlines, use the primitive mode GL_LINES. You may also need to look at glPolygonOffset to avoid z-fight, or render your object a little bit bigger with GL_LINES mode.

  5. #5
    Junior Member Newbie
    Join Date
    Jan 2009
    Posts
    6

    Re: coordinates problem

    yes,
    i rendered using LINE_LOOP. but i don't know is it correct method or any alternative

Similar Threads

  1. Help with coordinates problem.
    By hgwells in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 02-06-2019, 09:38 PM
  2. OpenGL Coordinates Problem
    By Shari in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 08-05-2008, 06:19 PM
  3. problem converting from win coordinates to object coordinates
    By openujs in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 09-07-2006, 01:27 PM
  4. Problem with large coordinates
    By berb in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 06-06-2004, 11:53 PM
  5. coordinates problem
    By in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 10-05-2000, 07:58 PM

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