Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Don't forget to read Tuesday's email newsletter for your chance to win a free copy of Construct 2!


Knut

Member Since 04 Sep 2012
Offline Last Active Sep 11 2012 02:28 PM

Posts I've Made

In Topic: SOLVED: Problem with gluProject

10 September 2012 - 01:35 PM

Solved this issue like this:

[source lang="java"]screenPos.z = -(screenPos.z * (zFar - zNear) + zNear);[/source]

In Topic: SOLVED: Problem with gluProject

05 September 2012 - 01:48 PM

Yes, depth test is enabled.

Are you sure I should add +/- 10 after gluProject? I want to draw a range indicator around the cube, so I would imagine I want to add some offset to the cube position, and then project that?

In Topic: SOLVED: Problem with gluProject

05 September 2012 - 10:14 AM

Oh, sorry...I have attached the pictures here. The first picture shows a cube rendered at [0,0,0], and selection markers which are rendered in ortho mode. They are rendered with z value 0.0, and the x and y values calculated using gluProject. This is working fine.
Posted Image

In the second picture I try to render a quad. I give gluProject x and z values of -10 and +10, and y value 0, so it should intersect the cube. The quad is textured with a cross, which should end up inside the cube, and depth testing is enabled (I hoped some would end up behind the cube). However, as you can see from the second picture, it is distorted.
Posted Image

The distortion seems to be less if I move the camera further away.

Any ideas what might cause this effect? Any help would be greatly appreciated.

I posted it here because I consider myself a beginner, at least to game programming, and I think this function (gluProject) is quite basic. If I posted it wrong, I appologise for that.

Thanks
Knut

PARTNERS