Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (594)
Games in Android Showcase (168)
games submitted by our members
Games in WIP (646)
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 1293 times)
0 Members and 1 Guest are viewing this topic.
Offline uvBear

Junior Newbie

« Posted 2011-05-09 15: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.

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);
      glu.gluPerspective(45.0f, h, 1.0, 20.0);

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:

public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height)
       final GL2 gl = drawable.getGL().getGL2();
        final GLU glu = new GLU();



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

« JGO Spiffy Duke »

Medals: 40
Projects: 4
Exp: 7 years

« Reply #1 - Posted 2011-05-09 17: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 17: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.


Playable work in progress online RPG:
Jabber user:
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 17: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.

Riven (22 views)
2015-07-03 11:22:16

deepthought (46 views)
2015-06-30 15:39:44

deepthought (49 views)
2015-06-30 15:39:09

deepthought (62 views)
2015-06-30 15:36:52

Za\'Anzabar (34 views)
2015-06-29 05:44:54

TritonDreyja (45 views)
2015-06-24 17:10:40

CopyableCougar4 (44 views)
2015-06-23 00:34:45

BurntPizza (48 views)
2015-06-21 20:36:46

cookiecompiler (91 views)
2015-06-11 15:42:53

cookiecompiler (54 views)
2015-06-11 15:41:14
How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14 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‑
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!