LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: JaredBGreat on September 14, 2013, 02:26:09

Title: Has gluPerspective been removed? Is this a bug? Or are the tutorials wrong?
Post by: JaredBGreat on September 14, 2013, 02:26:09
EDIT: Never mind this, I figure out what I was missing (I just don't see why NetBeans didn't find the error); please excuse my n00bishness.

OK, I don't know if this should be here or in bugs, as the title suggests.  I've been programming on and off for a long time, albeit as a amateur, but am a noob at game program.  I've been watching and rewatching several video series (I sure with there was a book on this specifically).  Both series use the method gluPerspective(float fov, float aspectRatio, float nearClip, float farClip), which I can find as general OpenGL with Google.  The problem is, while it works in the video, whenever I use it NetBeans gives me an error and asks if I want to create it in the local class (apparently not finding it in lwjgl jar files, which I have imported -- 2d methods work just fine).  I've done import overkill but nothing seem to work:

package community.render;

import community.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.lwjgl.*;
import org.lwjgl.opengl.*;
import static org.lwjgl.opengl.GL11.*;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;


/**
*
* @author jared = JaredBGreat (Jared Blackburn)
*/
public class Camera {
   private float x, y, z;      // Position on each axis
   private float rx, ry, rz;   // Rotation about each axis
   private float fov;          // Field of View
   private float aspectRatio;  // Width / Height
   private float nearClip;     // Minimum view distance
   private float farClip;      // Maximum view distance
   
   
   public Camera(float x, float y, float z, float rx, float ry, float rz,
           float fov, float aspectRatio, float nearClip, float farClip) {
       this.x = x;
       this.y = y;
       this.z = z;
       this.rx = rx;
       this.ry = ry;
       this.rz = rz;
       this.fov = fov;
       this.aspectRatio = aspectRatio;
       this.nearClip = nearClip;
       this.farClip = farClip;
   }
   
   public Camera(float x, float y, float z, float rx, float ry, float rz,
           float fov, float nearClip, float farClip) {
       this.x = x;
       this.y = y;
       this.z = z;
       this.rx = rx;
       this.ry = ry;
       this.rz = rz;
       this.fov = fov;
       this.aspectRatio = UI.XSIZE / UI.YSIZE;
       this.nearClip = nearClip;
       this.farClip = farClip;
   }
   
   public Camera() {
       x = y = z = rx = ry = rz = 0f;
       fov = 70f;
       aspectRatio = UI.XSIZE / UI.YSIZE;
       nearClip = 0.296f;
       farClip = 1024f;
   }
   
   
   public void init3D() {
       glMatrixMode(GL_PROJECTION);
       glLoadIdentity();
       gluPerspective(fov, aspectRatio, nearClip, farClip);
   }
   
}


...with the very last line giving the error.  What am I doing wrong?  How can I fix this?
Title: Re: Has gluPerspective been removed? Is this a bug? Or are the tutorials wrong?
Post by: quew8 on September 14, 2013, 10:06:18
As I'm sure you've now figured out, any method starting with glu... is in LWJGL's GLU class. Any gl... is in the GLXX class, any al... is in the ALXX class etc..

I know you've figured it out, but I'm just posting the reply in case anyone searching for this problem arrives here only to find it resolved but with no answer. That can be infuriating.