Totally confused

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Totally confused

tomd
I am new to JOGL (and OpenGL). I am getting very confused by the tutorials. eg

    public void drawPyramid(GLAutoDrawable drawable) {
        GL gl = drawable.getGL();

        gl.glBegin(GL.GL_TRIANGLES);
        gl.glVertex3f(0.0f, 1.5f, 0.0f);
        gl.glVertex3f(-1.0f, -1.0f, 0.0f);
        gl.glVertex3f(1.0f, -1.0f, 0.0f);
        gl.glEnd();

    }

doesn't compile at all. Looking at the API, there is no glBegin, or glVertex3f. Has the code changed a lot since these tutorials were created? Or have I downloaded the wrong thing altogether?

TIA


Reply | Threaded
Open this post in threaded view
|

Re: Totally confused

Martin
Hello,
If you use JOGL2, you need to call drawable.getGL().getGL2().
Regards,
Martin
Reply | Threaded
Open this post in threaded view
|

Re: Totally confused

tomd
OK thanks that compiles now. Still not sure what has happened with the tutorials I have seen (from around 2007), have functions been moved out of GL into GL2?

Are there any more recent tutorials?

Is it a good idea to use GL2 (is it stable or experimental at the moment).

Reply | Threaded
Open this post in threaded view
|

Re: Totally confused

Martin
Well you should use the demos related to the current version of JOGL. I think I found them on Sven's Git: https://github.com/sgothel

I also added the demos to the trunk of Jzy3d that I am currently trying to port to JOGL2, so you can browse them online there:
http://code.google.com/p/jzy3d/source/browse/#svn/trunk/src/jogl/demos

JOGL2 works well for AWT canvases in Jzy3d, but not for Swing yet. But I still have lot of things to read and learn concerning the best ways to uses canvases in JOGL2.

Martin
Reply | Threaded
Open this post in threaded view
|

Re: Totally confused

Wade Walker
Administrator
In reply to this post by tomd
tomd wrote
Are there any more recent tutorials?
I've got a very recent tutorial at http://wadeawalker.wordpress.com/2010/10/09/tutorial-a-cross-platform-workbench-program-using-java-opengl-and-eclipse/. Justin also has a good beginner tutorial at https://sites.google.com/site/justinscsstuff/jogl-tutorials.

All the tutorials for JOGL 2 are listed at http://jogamp.org/wiki/index.php/Jogl_Tutorial.

tomd wrote
Is it a good idea to use GL2 (is it stable or experimental at the moment).
I wouldn't base a production-quality system on it quite yet, but it's improving rapidly. Our code at my workplace still uses JOGL 1.1.1a for stability, but we're evaluating JOGL 2 and will switch over as soon as our experiments show that it runs on all our platforms.