Java-Gaming.org    
Featured games (78)
games approved by the League of Dukes
Games in Showcase (428)
Games in Android Showcase (89)
games submitted by our members
Games in WIP (466)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Errors with NeHe JOGL ports.  (Read 963 times)
0 Members and 1 Guest are viewing this topic.
Offline uvBear

Junior Newbie





« Posted 2011-05-09 17:44:27 »

Hi everyone, I'm new here. Spent the last few days trawling these forums looking for a thread to participate in without making myself look a fool, with no luck! At last I have a reason post Smiley

I'm working my way through the JOGL ports of the NeHe OpenGL tutorials, and I've come across some function calls that, as far as I can tell, don't exist for me. An example would be the following code, found in lesson 2.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
public void reshape(GLDrawable gLDrawable, int x, int y, int width, int height)
    {
      final GL gl = gLDrawable.getGL();
      final GLU glu = gLDrawable.getGLU();

      if (height <= 0) // avoid a divide by zero error!
       height = 1;
      final float h = (float)width / (float)height;
      gl.glViewport(0, 0, width, height);
      gl.glMatrixMode(GL.GL_PROJECTION);
      gl.glLoadIdentity();
      glu.gluPerspective(45.0f, h, 1.0, 20.0);
      gl.glMatrixMode(GL.GL_MODELVIEW);
      gl.glLoadIdentity();
    }


The first two function calls, to getGL() and getGLU(), I see very often in the tutorials I stumble across. However, to get this code working I've had to change it to:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height)
    {
       final GL2 gl = drawable.getGL().getGL2();
        final GLU glu = new GLU();

        ...

        gl.glMatrixMode(GL2.GL_PROJECTION);
        ...
        gl.glMatrixMode(GL2.GL_MODELVIEW);
        ...
    }


Have certain functions been removed from the later versions of JOGL? If so, is there somewhere I can look to find all the changes? I'm relatively new to both Java and JOGL, and so I'm unsure if the workaround I'm being forced to use is the correct way to do so.

EDIT: Typo.
Offline pjt33
« Reply #1 - Posted 2011-05-09 19:24:29 »

A lot of stuff has been removed from OpenGL, and NeHe is long out of date. Unfortunately I'm not sure what has replaced it.
Offline Nitram

Senior Newbie


Medals: 1



« Reply #2 - Posted 2011-05-09 19:32:30 »

The layout of JOGL changed a while back.

When the NeHe tutorials were written the GL interface was a collecting of every single function OpenGL supported. How ever OpenGL is layered into different versions and not every device/driver supports all those versions. To give the developer a greater control about the requirements of the application, the JOGL interface was changed to reflect the layers of OpenGL.

This page gives a good overview about the Jogl layout: link

Basically the GL interface now contains only those functions that are shared over every single version of OpenGL. For the most functions you need to specify your level of OpenGL more in detail.

At the end, the functions moved around, but none got removed. Everything is still there, you just have to find it.

Nitram

Playable work in progress online RPG: http://illarion.org
Jabber user: nitram0815@jabber.ccc.de
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline uvBear

Junior Newbie





« Reply #3 - Posted 2011-05-09 19:50:21 »

Thanks for the responses guys, and thanks a lot for the link Smiley

I'm having trouble finding up-to-date tutorials, especially ones that have been ported to java. I bought myself the 3.0/3.1 edition of the OpenGL RedBook to get myself started, and getting the examples running with JOGL involves an annoying amount of trial and error for me Sad maybe I ought to rewrite a few of the NeHe tutorials myself for the current JOGL version once I get my head around it Cheesy
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (78 views)
2014-04-15 18:08:23

BurntPizza (70 views)
2014-04-15 03:46:01

UprightPath (81 views)
2014-04-14 17:39:50

UprightPath (66 views)
2014-04-14 17:35:47

Porlus (82 views)
2014-04-14 15:48:38

tom_mai78101 (106 views)
2014-04-10 04:04:31

BurntPizza (166 views)
2014-04-08 23:06:04

tom_mai78101 (262 views)
2014-04-05 13:34:39

trollwarrior1 (212 views)
2014-04-04 12:06:45

CJLetsGame (221 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!