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

Author Topic: gluPerspective "replacement"  (Read 16571 times)

0 Members and 1 Guest are viewing this topic.

Srejv

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
gluPerspective "replacement"
« on: November 12, 2007, 05:36:39 pm »
If you're only using glu.h for gluPerspective, you could use this snippet instead:

Code: [Select]
//additional includes
#include <math.h>

void
gluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar)
{
   GLdouble xmin, xmax, ymin, ymax;

   ymax = zNear * tan(fovy * M_PI / 360.0);
   ymin = -ymax;
   xmin = ymin * aspect;
   xmax = ymax * aspect;


   glFrustum(xmin, xmax, ymin, ymax, zNear, zFar);
}


Got it from this website: http://steinsoft.net/index.php?site=Programming/Code%20Snippets/OpenGL/gluperspective

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
gluPerspective "replacement"
« Reply #1 on: November 12, 2007, 05:42:49 pm »
Everyone having OpenGL installed should have GLU as well, so I don't think it's a problem. And I also use it to generate mipmaps in the OpenGL sample.

But thanks for the function, it can still be useful ;)
Laurent Gomila - SFML developer

 

anything