Jogl Tutorial: Difference between revisions

From JogampWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 30: Line 30:


= Hello Triangle =
= Hello Triangle =
[https://github.com/elect86/jogl-samples/blob/master/jogl-samples/src/helloTriangle/HelloTriangle.java Simple sample] that features GL4, pure newt, glWindow options, animator, indexed drawing, dinamic attribute and frag data binding, interleaved data, vao, vbo (with normalization on one attribute), ibo (with shorts), uniform, glsl program (with specific suffix) and matrix jogl util, gl error check, key listener and right way to dispose.
[https://github.com/elect86/helloTriangle Simple sample] that features GL4, pure newt, glWindow options, animator, indexed drawing, dinamic attribute and frag data binding, interleaved data, vao, vbo (with normalization on one attribute), ibo (with shorts), uniform, glsl program (with specific suffix) and matrix jogl util, gl error check, key listener and right way to dispose.


= Common Mistakes =
= Common Mistakes =

Revision as of 21:30, 31 January 2016

JogAmp's Static

JogAmp's Wiki

Hello Triangle

Simple sample that features GL4, pure newt, glWindow options, animator, indexed drawing, dinamic attribute and frag data binding, interleaved data, vao, vbo (with normalization on one attribute), ibo (with shorts), uniform, glsl program (with specific suffix) and matrix jogl util, gl error check, key listener and right way to dispose.

Common Mistakes

I suggest you to take a read to these two pages for a quick overview over the most common problems, it is a very useful reading, legacy sections are carefully signaled.

OpenGL GLSL

Another common mistake that may happen if you port code from C/C++ to Java is this one:

Caused by: com.jogamp.opengl.GLException: unpack pixel_buffer_object must be bound to call this method at jogamp.opengl.gl4.GL4bcImpl.checkBufferObject(GL4bcImpl.java:40621) at jogamp.opengl.gl4.GL4bcImpl.checkUnpackPBOBound(GL4bcImpl.java:40707) at jogamp.opengl.gl4.GL4bcImpl.glTexImage2D(GL4bcImpl.java:5535) at tests.gl320.Gl_320_fbo_blit.initTexture(Gl_320_fbo_blit.java:199)

This happens because in C/C++, when you just want to allocate the space for a texture using, for example, glTexImage2D, you should not pass 0 as the last argument, but null.


N.B: The use of color picking is NOT recommended on any hardware whose palette is partially emulated.

Wade's JOGL tutorials

Rami's JOGL tutorials

Justin's Getting Started with JOGL 2 Tutorials

Elect86's modern OpenGL examples

Nils Hoffmann's Netbeans Platform examples

Courses

LeoLoL.com Tutorials (Currently unreachable)

JOGL 1 tutorials

Ste3e's JOGL tutorials

(The old (not quite up-to-date) JOGL Userguide is currently available here)