LWJGL
May 23, 2012, 03:35:31 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL 2.8.3 released!
 
   Home   Help Search Login Register  



Pages: [1]
  Print  
Author Topic: Texture loading issus with glu  (Read 445 times)
sublixt
Newbie
*
Posts: 5


« on: January 07, 2012, 14:29:32 »

Im trying to follow along with the NeHe tutorials and im trying to load a texture. Since devil is no longer supported I have tried using slick to load textures.  It works fine when I use this code
Code:
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GL11.glOrtho(0, 800, 0, 600, 1, -100);
GL11.glMatrixMode(GL11.GL_MODELVIEW);

but not this code which is what the tutorials use.
Code:
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GLU.gluPerspective(
    45.0f,
    (float) displayMode.getWidth() / (float) displayMode.getHeight(),
    0.1f,
    100.0f);
GL11.glMatrixMode(GL11.GL_MODELVIEW);

Is there a way to make the slick texture loading work with the glu code or is there another way I can load textures?
Logged
Fool Running
Nerdus Imperius
*****
Posts: 648


« Reply #1 on: January 09, 2012, 05:47:09 »

None of the code you posted will affect textures at all.
The difference between the two is probably that in the first one you can see what was drawn on the screen (which might use the texture) and in the other one you can't.
The second one uses a perspective view. If the tutorial is doing 2D rendering, then there is no use for a perspective view anyways.
Logged

Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option Grin
sublixt
Newbie
*
Posts: 5


« Reply #2 on: January 09, 2012, 08:09:54 »

Im new to lwjgl and opengl in general. Can you tell me what the difference between perspective and ortho is?
Logged
Fool Running
Nerdus Imperius
*****
Posts: 648


« Reply #3 on: January 09, 2012, 09:56:30 »

A perspective view is how we normally see objects (objects that are further away look smaller) and orthographic is where all objects are the same size no matter how far away they are.
The way it can make what is drawn on screen disappear is because in your first call (glOrtho) you are making a view that shows units from (0 to 800) and (0 to 600). No matter how far away from the camera the object is, if it is in that range it will appear.
However, in perspective mode your visible units change depending on how close the object is to the camera (e.g. when one unit away, the range might be (-2 to +2) and (-2 to +2) ). If your object was at (100,100) then it would appear in the glOrtho, but not in the perspective view.

Someone else can probably explain it better. Grin
Logged

Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option Grin
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines
SMFAds for Free Forums
Valid XHTML 1.0! Valid CSS!