Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: GLcoordinates  (Read 1278 times)

0 Members and 1 Guest are viewing this topic.

Mr_Gnome

  • Newbie
  • *
  • Posts: 6
    • View Profile
GLcoordinates
« on: May 04, 2011, 08:05:23 am »
First off I know this question has been asked a billion times, but I'm not having a problem converting them. I'm having an issue with how I'm converting them.

This is some of my code, including how I convert the coordinates and my gluperspective
Code: [Select]

//VIDEO_WIDTH=800 VIDEO_HEIGHT=600
mGame.Click.x=(int)(((mouse.x*3.0)-(VIDEO_WIDTH/2))/3.0);
mGame.Click.y=(int)-(((mouse.y*3.0)-(VIDEO_HEIGHT/2))/3.0);

gluPerspective(90.0f, 1.3f, 1.0f, 0.0f);


I've figured out that the way I convert the coordinates basically assigns 3 SFML coordinates to 1 GL coordinate(at least I think) and this has a very undesirable effect on my Picking and pathfinding systems :/

This is an screenshot showing this issue:
http://img4.imageshack.us/img4/8531/examplebm.png
(the pointer is unmoved)
NOTE: I'll have smaller objects so an offset is a big issue

I don't think there's anything that will give me a perfect solution to this, and that's not what I'm asking for... but is there anything I could do to get the closest OpenGL coordinate?

NOTE: if you want to see more of my code just ask... I was just trying to prevent posting 800 or so lines.

EDIT:

I found a solution that works for me. Thanks anyway.