|
QUESTIONS:
Can't get FSAA to work?!
Can't figure out how to do full screen exclusive
LINKS:
JOGL docs:
http://download.java.net/media/jogl/jogl-2.x-docs/
JOGL release builds:
http://download.java.net/media/jogl/builds/archive/
JOGL FAQ:
http://kenai.com/projects/jogl/pages/FAQ
Latest JOGL version is 2.0
* Not sure I understand the part about only using OpenGL v1.2
* Or using 'newt' versus AWT or Swing
* Or the part about supporting different OpenGL profiles
JOGL forums:
http://projectkenai.com/projects/jogl/forums/forum
http://www.javagaming.org/index.php/board,25.0.html
JOGL users guide
http://download.java.net/media/jogl/doc/userguide/
OpenGL docs:
http://www.opengl.org/documentation/
http://www.opengl.org/sdk/docs/man/
* Can't get JOGL 2.0 beta 10 to work. Using 1.1.1 for now...
GIST:
Y is up, Z is depth (decreasing value goes away from camera)
Project needs to link to jogl.jar (and native libs) plus gluegen.jar
Java app extends GLCanvas and implements GLEventListener
Set the GL object, and init some global settings on it
Instantiate the GLU object as a member variable
Instantiate an FPSAnimator thread and start() it
Function display() gets called on every frame:
On GLEventListener methods:
init() - inits stuff. May or may not run more than once...
display() - draws stuff on every frame. Recipe:
Get GL object
Clear screen
Set camera
Draw things.
reshape() - called when window is resized
displayChanged() - not supported ATM
"It is strongly recommended that applications always refetch the GL object out of the GLAutoDrawable
upon each call to the init(), display() and reshape() methods and pass the GL object down on the stack
to any drawing routines, as opposed to storing the GL in a field and referencing it from there."
GLCANVAS
"a heavyweight AWT widget which supports hardware acceleration and which is intended to be the primary widget used by applications"
GLWINDOW
com.sun.javafx.newt.opengl.GLWindow - subclasses com.sun.javafx.newt.Window
GL
Most all calls go thru here
Instantiate with DebugGL subclass to get stacktraces on exceptions
GLCAPABILITIES
FSAA:
GLCapabilities.setSampleBuffers(true);
GLCapabilities.setNumSamples(X); // where X is the number of samples per pixel
GLU
Helper class
glu.gluPerspective(fovInDegrees, aspectRatioWidthOverHeight, min, max);
glu.gluLookAt(posx,posy,posz, targetx,targety,targetz, upaxisx,upaxisy,upaxisz);
USEFUL:
Non-outdated tutorial
http://www.land-of-kain.de/docs/jogl/
INTERESTING:
CUDA bindings for Java (nVidia only)
www.jCUDA.org
OpenCL with Java
http://www.jocl.org/
JOGL NOTES FROM USER GUIDE:
If an application written using Jogl interacts in any way with the mouse or keyboard, the AWT is
processing these events and the multithreaded aspects of the program must be considered.
...
Both of these models (repaint-on-demand and repaint continually) still require the user to think
about which thread keyboard and mouse events are coming in on, and which thread is performing the
OpenGL rendering. OpenGL rendering may not occur directly inside the mouse or keyboard handlers,
because the OpenGL context for the drawable is not current at this point (hence the warning about
storing a GL object in a field, where it can be fetched and accidentally used by another thread).
However, a mouse or keyboard listener may invoke GLAutoDrawable.display().
It is generally recommended that applications perform as little work as possible inside their mouse
and keyboard handlers to keep the GUI responsive. However, since OpenGL commands can not be run from
directly within the mouse or keyboard event listener, the best practice is to store off state when
the listener is entered and retrieve this state during the next call to GLEventListener.display().
GLU
Jogl contains support for the GLU (OpenGL Utility Library) version 1.3. Is a pure Java port, so
overcomes lack of GLU 1.3 support in Windows or something. To use the GLU, simply instantiate a
GLU object via new GLU() at the beginning of your program. The methods on the GLU object may be
called at any point when an OpenGL context is current. Because the GLU implementation is not
thread-safe, one GLU object should be created for each GLEventListener or other entity performing
OpenGL rendering in a given thread.
Windows
For correct operation, it is necessary to specify the system property -Dsun.java2d.noddraw=true
when running JOGL applications on Windows; this system property disables the use of DirectDraw by
Java2D. There are driver-level incompatibilities between DirectDraw and OpenGL which manifest
themselves as application crashes, poor performance, bad flickering, and other artifacts. This poor
behavior may exhibit itself when OpenGL and DirectDraw are simply used in the same application, not
even just in the same window, so disabling Java2D's DirectDraw pipeline and forcing it to use its
GDI pipeline is the only way to work around these issues. Java Web Start applications may set this
system property by adding the following line to the <resources> section of the JNLP file:
<property name="sun.java2d.noddraw" value="true"/>
|
|
Page last modified on January 08, 2010, at 02:56 PM
|
|