|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gl4java.GLContext
The base manager class for the OpenGL language mapping for Java !
If you are interessting in further Documentation and/or the history of GL4Java follow the following link.
The GL4Java Documentation
All native libraries and GLFunc* and GLUFunc* implementations can/should be loaded right here !
doLoadNativeLibraries createGLFunc createGLUFuncTo check the library versions, you can start the main function with
java gl4java.GLContext
This class creates a GLContext in the constructor which fits to the native Window of the given Component !
glc2glj - A simple c to java converter for C- and GL-types
The native libraries are plattform depended.
The default native library's are:Make sure that this library is installed in your library path. The library path is for Unices one path of the environment variable ´LD_LIBRARY_PATH´ and for Windows 32 ´c:/winnt/system32´ (WinNT) or 'c:/windows/system' (Windows 95) . Or it should be installed in the 'jre/bin' or 'Netscape/communicator/Program/java/bin' path !GL4JavaJauGljJNI (jdk ==1.1), GL4JavaJauGljJNI12 (jdk ==1.2), GL4JavaJauGljJNI13 (jdk ==1.3) GL4JavaJauGljJNI14 (jdk >=1.4)
To check wich version and vendors are currently used, just call while a GLContext is created :
Or just run at the command line:
java gl4java.GLContext -info
To have a convinient usage, e.g. automatic resizing, GLContext and painting/gl-rendering, some classes in the package gl4java.awt may help you.
E.g.: gl4java.awt.GLCanvasinit to create the java-stuff and GL-inits display to render one frame, called by paint reshape to reshape (window resize)
Or look for animation at gl4java.awt.GLAnimCanvas !
IF you remove/release a The component which is binded to this GLContext, you have to release the GLContext also - while calling:
gljDestroybefore releasing/dispose it´s Window !
We also define our own OpenGL extension. This extension functions start with the prefix glj like you can see here:
THIS FUNCTIONS ARE FOR USERS PURPOSES: ====================================== doLoadNativeLibraries createGLFunc createGLUFunc gljIsInit gljMakeCurrent gljSwap gljFree gljDestroy gljGetNativeLibVersion gljGetClassVersion gljShowVersions gljCheckGL gljCheckGLTypes gljResize
You can see our example demo sources:
olympicCvs.java as java source glLogoCvs.java as java source glDemosCvs.java as java source
If you are interessting in further Documentation, downloading the latest version, and/or the history of GL4Java click on the following link.
The GL4Java Homepage
Field Summary | |
protected java.awt.Component |
_comp
the light- or heavy component where GL commands should be drawn |
protected java.awt.Component |
_compHeavy
the heavy component where GL commands should be drawn if the _comp component is a swing (light) component, this component contains its heavy parent ! |
protected java.awt.Container |
containerWindow
|
protected boolean |
createOwnWindow
We normally do not have to create an own Window ! This is the default visual property ... |
static java.lang.String |
defGLFunc14Class
|
static java.lang.String |
defGLFuncClass
The default GLFunc implementation |
static java.lang.String |
defGljLib
The default GLContext/GLFunc/GLUFunc native library for all |
static java.lang.String |
defGljMSWinLib
The default extra native library for Windows 95/NT && MS-JVM |
static java.lang.String |
defGLUFunc14Class
|
static java.lang.String |
defGLUFuncClass
The default GLUFunc implementation |
static java.lang.String |
defNativeGLLibMacOS9
The default native GL library ... |
static java.lang.String |
defNativeGLLibMacOSX
The default native GL library ... |
static java.lang.String |
defNativeGLLibWin32
The default native GL library ... |
static java.lang.String |
defNativeGLLibX11
The default native GL library ... |
static java.lang.String |
defNativeGLULibMacOS9
The default native GLU library ... |
static java.lang.String |
defNativeGLULibMacOSX
The default native GLU library ... |
static java.lang.String |
defNativeGLULibWin32
The default native GLU library ... |
static java.lang.String |
defNativeGLULibX11
The default native GLU library ... |
protected long |
displayHandle
|
protected GLCapabilities |
glCaps
The GLCapabilities .. |
protected long |
glContext
We will store the GL Context right here. |
protected static int |
glContextNumber
|
protected boolean |
glEnabled
Flag to check, if the OpenGL-Context is active ! |
static boolean |
gljClassDebug
Flag's to enable/disable verbose Information. |
static boolean |
gljNativeDebug
|
static boolean |
gljThreadDebug
|
protected boolean |
isInitialized
|
protected static boolean |
libsLoaded
Flag is the native library is loaded. |
protected boolean |
mustResize
The resize flag, which indicates a resize for the next paint function ! This flag will bes set in 'componentResized' and will be cleared after resize (glViewport) in sDisplay !! |
protected boolean |
offScreenRenderer
Do we use offscreen rendering X11: pixmap eq window-ressources, window eq. |
protected java.awt.Dimension |
offScrnSize
The custom set offscreen Size If this is set to != null, the offscreen pixmap is used in this size, not in the components-size (-> faster if smaller) Must be set via createOffScreenCtx |
static int |
OsMac9
Variable to tell is where windows or not (X11) Usally X11 ;-)) Ok - lets give one to the Max :-) |
static int |
OsMacX
Variable to tell is where windows or not (X11) Usally X11 ;-)) Ok - lets give one to the Max :-) |
static int |
OsUnknown
Variable to tell is where windows or not (X11) Usally X11 ;-)) Ok - lets give one to the Max :-) |
static int |
OsWindoof
Variable to tell is where windows or not (X11) Usally X11 ;-)) Ok - lets give one to the Max :-) |
static int |
OsX11
Variable to tell is where windows or not (X11) Usally X11 ;-)) Ok - lets give one to the Max :-) |
protected long |
pixmapHandle
Xwindow data AND Windows data for the widget |
protected GLContext |
sharedGLContext
The context with witch display lists and textures will be shared. |
protected long |
sharedGLContextNative
|
protected java.awt.Dimension |
size
|
static java.lang.String |
version
the version of this java-class |
protected long |
windowHandle
|
Constructor Summary | |
|
GLContext(java.awt.Component comp,
GLFunc glf,
GLUFunc gluf)
Constructor First the GLContext is fetched from the Component itself ! To do so, the Component is set visible if it is not ! We use a visual with doubleBuffer and NO stereoView ! Do not force a new native window ! If a GLContext is fetched, it is current ! |
|
GLContext(java.awt.Component comp,
GLFunc glf,
GLUFunc gluf,
boolean _doubleBuffer,
boolean _stereoView)
Constructor First the GLContext is fetched from the Component itself ! To do so, the Component is set visible if it is not ! If a GLContext is fetched, it is current ! ! WARNING ! This flag is just for testing purpose !!! |
|
GLContext(java.awt.Component comp,
GLFunc glf,
GLUFunc gluf,
boolean _doubleBuffer,
boolean _stereoView,
boolean _rgba)
Constructor First the GLContext is fetched from the Component itself ! To do so, the Component is set visible if it is not ! If a GLContext is fetched, it is current ! |
protected |
GLContext(java.awt.Component comp,
GLFunc glf,
GLUFunc gluf,
boolean _createOwnWindow,
boolean _offScreenRenderer,
boolean _doubleBuffer,
boolean _stereoView,
boolean _rgba,
int _stencilBits,
int _accumSize,
GLContext _sharedGLContext,
java.awt.Dimension _offScrnSize)
Constructor This privat constructor is for all possible compinations and is called from the customized constructors. |
|
GLContext(java.awt.Component comp,
GLFunc glf,
GLUFunc gluf,
boolean _createOwnWindow,
boolean _doubleBuffer,
boolean _stereoView,
boolean _rgba,
int _stencilBits)
Constructor First the GLContext is fetched from the Component itself ! To do so, the Component is set visible if it is not ! If a GLContext is fetched, it is current ! |
|
GLContext(java.awt.Component comp,
GLFunc glf,
GLUFunc gluf,
boolean _createOwnWindow,
boolean _doubleBuffer,
boolean _stereoView,
boolean _rgba,
int _stencilBits,
int _accumSize)
Constructor First the GLContext is fetched from the Component itself ! To do so, the Component is set visible if it is not ! If a GLContext is fetched, it is current ! |
|
GLContext(java.awt.Component comp,
GLFunc glf,
GLUFunc gluf,
boolean _createOwnWindow,
boolean _doubleBuffer,
boolean _stereoView,
boolean _rgba,
int _stencilBits,
int _accumSize,
GLContext _sharedGLContext)
Constructor First the GLContext is fetched from the Component itself ! To do so, the Component is set visible if it is not ! If a GLContext is fetched, it is current ! |
|
GLContext(java.awt.Component comp,
GLFunc glf,
GLUFunc gluf,
boolean _doubleBuffer,
boolean _stereoView,
boolean _rgba,
int _stencilBits)
Constructor First the GLContext is fetched from the Component itself ! To do so, the Component is set visible if it is not ! If a GLContext is fetched, it is current ! |
|
GLContext(java.awt.Component comp,
GLFunc glf,
GLUFunc gluf,
boolean _doubleBuffer,
boolean _stereoView,
boolean _rgba,
int _stencilBits,
int _accumSize)
Constructor First the GLContext is fetched from the Component itself ! To do so, the Component is set visible if it is not ! If a GLContext is fetched, it is current ! |
protected |
GLContext(java.awt.Component comp,
GLFunc glf,
GLUFunc gluf,
boolean _createOwnWindow,
boolean _offScreenRenderer,
java.awt.Dimension _offScrnSize,
GLCapabilities _glCaps,
GLContext _sharedGLContext)
Constructor This privat constructor is for all possible compinations and is called from the customized constructors. |
|
GLContext(java.awt.Component comp,
GLFunc glf,
GLUFunc gluf,
GLCapabilities _glCaps,
GLContext _sharedGLContext)
Constructor First the GLContext is fetched from the Component itself ! To do so, the Component is set visible if it is not ! If a GLContext is fetched, it is current ! |
Method Summary | |
void |
createGLContext(java.awt.Graphics g)
createGLContext gets the window handle and calls gljInit, so the gl-context will be initialised here. |
static GLFunc |
createGLFunc(java.lang.String vendorClass)
Support of loading a vendors GLFunc implementation Try to load the Class, if succesfull we do return the instance of it. |
static GLUFunc |
createGLUFunc(java.lang.String vendorClass)
Support of loading a vendors GLUFunc implementation Try to load the Class, if succesfull we do return the instance of it. |
static GLContext |
createOffScreenCtx(GLFunc glf,
GLUFunc gluf,
boolean _stereoView,
boolean _rgba,
int _stencilBits,
int _accumSize,
GLContext _sharedGLContext)
Constructor Function for offscreen rendering ! First the GLContext is fetched from the Component itself ! To do so, the Component is set visible if it is not ! If a GLContext is fetched, it is current ! |
static GLContext |
createOffScreenCtx(GLFunc glf,
GLUFunc gluf,
boolean _stereoView,
boolean _rgba,
int _stencilBits,
int _accumSize,
GLContext _sharedGLContext,
java.awt.Dimension _offScrnSize)
Constructor Function for offscreen rendering ! First the GLContext is fetched from the Component itself ! To do so, the Component is set visible if it is not ! If a GLContext is fetched, it is current ! |
static boolean |
doLoadNativeLibraries(java.lang.String gljLibName,
java.lang.String nativeGLLibName,
java.lang.String nativeGLULibName)
Support of loading the native library seperatly. |
protected void |
finalize()
|
int |
getAccumSize()
Query the visual property ... |
GLCapabilities |
getGLCapabilities()
Query the visual property ... |
GLFunc |
getGLFunc()
Used to return the user given GLFunc implementation |
GLUFunc |
getGLUFunc()
Used to return the user given GLUFunc implementation |
static java.lang.String |
getJVMVendor()
|
static java.lang.String |
getJVMVersion()
|
static int |
getJVMVersionMajor()
|
static int |
getJVMVersionMinor()
|
long |
getNativeGLContext()
Get the native GL Context ! |
static int |
getNativeGLContextNumber()
|
static java.lang.String |
getNativeOSName()
|
static int |
getNativeOSType()
Get the native OS-Type ! |
long |
getNativeWindoHandle()
Deprecated. The native window handle is no more accessible through this method since JDK >= 1.3 ! |
GLContext |
getSharedGLContext()
Get the optional shared GL Context ! |
int |
getStencilBitNumber()
Query the visual property ... |
boolean |
gljCheckGL()
|
static boolean |
gljCheckGLTypes()
native C function to check the gl types. |
boolean |
gljDestroy()
gljDestroy destroy´s the GL Context This function should be called when removing a GLContext !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Call gljFree befor this method, to be sure .. |
static boolean |
gljFetchGLFunctions(java.lang.String gllibname,
java.lang.String glulibname,
boolean force)
This functions fetches/dispatches the GL/GLU functions, which must be allready loaded via the doLoadNativeLibraries function ! |
boolean |
gljFree()
gljFree free´s the GL Context This MUST be called at last in your display function ! |
boolean |
gljFree(boolean force)
gljFree free´s the GL Context This MUST be called at last in your display function ! |
static java.lang.String |
gljGetClassVendor()
function to achieve the java-class vendor ! now it is possible to check the java-class at runtime ! |
static java.lang.String |
gljGetClassVersion()
function to achieve the java-class version ! now it is possible to check the java-class at runtime ! |
static long |
gljGetCurrentContext()
gljGetCurrentContext fetches the current native GL-Context, which is attached to this _native_ thread ! |
static java.lang.String |
gljGetNativeLibVendor()
native C function to achieve the native lib vendor ! now it is possible to check the native-lib at runtime ! |
static java.lang.String |
gljGetNativeLibVersion()
native C function to achieve the native lib version ! now it is possible to check the native-lib at runtime ! |
java.lang.String |
gljGetVersions()
function to achieve complete version info Be sure that the native library must be loaded ! |
java.lang.String |
gljGetVersions(boolean verbose)
|
protected void |
gljInit()
Initializes the gl-context. |
boolean |
gljIsCurrent()
gljIsCurrent checks if the current Thread holds the GL context of this GLContext instance ! |
boolean |
gljIsInit()
Checks if the gl-context is Initializes If returns true, gljInit is allready called and a valid gl-context is achieved. |
boolean |
gljIsRequested()
gljIsRequested checks if the this GLContext instance's native context is requested by another thread ! |
boolean |
gljMakeCurrent()
gljMakeCurrent checks whether GL4Java is initializes AND makes the GL-Context current for this thread. |
boolean |
gljMakeCurrent(boolean freeContextFirst)
Deprecated. The argument freeContextFirst is obsolete ! |
static void |
gljReadPixelGL2AWT(int pack_rowlen,
int pack_x,
int pack_y,
int x,
int y,
int width,
int height,
int format,
int type,
int bufferName,
byte[] pixelGLDest)
This functions reads the pixel from the GL frame and puts it into the pixelDest array, while using hardware correct AWT and GL pixel format, using GL_BGR and BufferedImage.TYPE_3BYTE_BGR ! |
static void |
gljReadPixelGL2AWT(int pack_rowlen,
int pack_x,
int pack_y,
int x,
int y,
int width,
int height,
int format,
int type,
int bufferName,
int[] pixelDest)
This functions reads the pixel from the GL frame and puts it into the pixelDest array, while converting them correctly to the AWT pixel format, using GL_BGRA and BufferedImage.TYPE_INT_ARGB ! |
static void |
gljReadPixelGL2AWT(int pack_rowlen,
int pack_x,
int pack_y,
int x,
int y,
int width,
int height,
int format,
int type,
int bufferName,
short[] pixelDest)
This functions reads the pixel from the GL frame and puts it into the pixelDest array, while converting them correctly to the AWT pixel format, using GL_RGB and BufferedImage.TYPE_USHORT_565_RGB ! |
void |
gljResize(int width,
int height)
Resizes the gl-viewport Should be called, if the component is resized. |
java.awt.Frame |
gljShowVersions()
function to show complete version info into an extra Frame Be sure that the native library must be loaded ! |
boolean |
gljSwap()
swap method are for double buffering |
static boolean |
gljTestGLProc(java.lang.String name,
boolean verbose)
This functions checks the existence of the GL functions ! |
protected boolean |
hasJAWTSurfaceChanged(long thisWin)
native C function of GLJ Library, which query if the JAWT Surface has changed ! Use this after gljMakeCurrent -> jawt_lock ! If true, we need a new GLContext ! |
boolean |
isDoubleBuffer()
Query the visual property ... |
boolean |
isEnabled()
This function queries, if the GL-Context is enabled ! |
static boolean |
isMicrosoftJVM()
|
static boolean |
isNetscapeJVM()
|
boolean |
isOwnWindowCreated()
Query the visual property ... |
boolean |
isRGBA()
Query the visual property ... |
boolean |
isStereoView()
Query the visual property ... |
protected static boolean |
loadJAWT()
Routine which causes jawt.dll/libjawt.so to be loaded if that is how the window handles are being obtained. |
static boolean |
loadNativeLibraries(java.lang.String gljLibName,
java.lang.String glLibName,
java.lang.String gluLibName)
Deprecated. The arguments glLibName and gluLibName are obsolete, because all glj/gl/glu stuff resides within the gljLib ! Now you can use doLoadNativeLibraries ! |
static void |
main(java.lang.String[] args)
Test to load the native library, GLFunc and GLUFunc implementation ! If succesfull, a Frame will created and the GL-Infos (vendor, ...) are shown in it ! |
protected boolean |
openOpenGLNative(java.awt.Component canvas)
native C function to open the OpenGLwidget |
void |
run()
For MSJVM Only ! This functions fetches the window-handle within a special thread ! |
void |
setEnabled(boolean b)
This function enables, disables the GL-Context ! If false is given, the openGL renderer/context is disabled and disconected (gljFree is called, if initialized) ! If disabled, all GL Functions are disabled but the Destroy & Free are not ! |
void |
setGLFunc(GLFunc _gl)
Used to set the user given GLFunc implementation |
void |
setGLUFunc(GLUFunc _glu)
Used to set the user given GLUFunc implementation |
void |
setVisible(boolean visible)
Own setVisible This one set's us visible - and wait's for that result ! |
protected static boolean |
useJAWT()
native C function of GLJ Library, which query if it uses the JDK 1.3 JAWT interface to fetch the native window handle |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected boolean isInitialized
protected static boolean libsLoaded
gljIsInit()
public static final java.lang.String defGljMSWinLib
public static final java.lang.String defGljLib
public static final java.lang.String defGLFuncClass
public static final java.lang.String defGLFunc14Class
public static final java.lang.String defGLUFuncClass
public static final java.lang.String defGLUFunc14Class
public static final java.lang.String defNativeGLLibX11
public static final java.lang.String defNativeGLLibMacOS9
public static final java.lang.String defNativeGLLibMacOSX
public static final java.lang.String defNativeGLLibWin32
public static final java.lang.String defNativeGLULibX11
public static final java.lang.String defNativeGLULibMacOS9
public static final java.lang.String defNativeGLULibMacOSX
public static final java.lang.String defNativeGLULibWin32
public static final java.lang.String version
public static boolean gljClassDebug
public static boolean gljThreadDebug
public static boolean gljNativeDebug
protected long glContext
createGLContext(java.awt.Graphics)
,
gljInit()
protected static int glContextNumber
protected GLContext sharedGLContext
createGLContext(java.awt.Graphics)
,
gljInit()
protected long sharedGLContextNative
protected long pixmapHandle
createGLContext(java.awt.Graphics)
,
gljInit()
protected long windowHandle
protected long displayHandle
protected java.awt.Container containerWindow
protected java.awt.Dimension offScrnSize
JComponent.paint(java.awt.Graphics)
,
createOffScreenCtx(gl4java.GLFunc, gl4java.GLUFunc, boolean, boolean, int, int, gl4java.GLContext)
protected boolean glEnabled
isEnabled()
,
setEnabled(boolean)
protected boolean offScreenRenderer
GLContext(java.awt.Component, gl4java.GLFunc, gl4java.GLUFunc, boolean, boolean, java.awt.Dimension, gl4java.GLCapabilities, gl4java.GLContext)
protected boolean createOwnWindow
isOwnWindowCreated()
,
GLContext(java.awt.Component, gl4java.GLFunc, gl4java.GLUFunc, boolean, boolean, java.awt.Dimension, gl4java.GLCapabilities, gl4java.GLContext)
protected GLCapabilities glCaps
GLContext(java.awt.Component, gl4java.GLFunc, gl4java.GLUFunc, boolean, boolean, java.awt.Dimension, gl4java.GLCapabilities, gl4java.GLContext)
protected boolean mustResize
GLCanvas.sDisplay()
protected java.awt.Dimension size
protected java.awt.Component _comp
protected java.awt.Component _compHeavy
public static final int OsWindoof
public static final int OsUnknown
public static final int OsX11
public static final int OsMac9
public static final int OsMacX
Constructor Detail |
protected GLContext(java.awt.Component comp, GLFunc glf, GLUFunc gluf, boolean _createOwnWindow, boolean _offScreenRenderer, java.awt.Dimension _offScrnSize, GLCapabilities _glCaps, GLContext _sharedGLContext)
comp
- the users component for the gl-contextglf
- the users selected GLFunc implementationglf
- the users selected GLUFunc implementation_createOwnWindow
- the flag for the visual property_offScreenRenderer
- the flag for the visual property_offScrnSize
- the fixed offscreen pixmap size_glCaps
- the GLCapabilities_sharedGLContext
- the shared GLContextprotected GLContext(java.awt.Component comp, GLFunc glf, GLUFunc gluf, boolean _createOwnWindow, boolean _offScreenRenderer, boolean _doubleBuffer, boolean _stereoView, boolean _rgba, int _stencilBits, int _accumSize, GLContext _sharedGLContext, java.awt.Dimension _offScrnSize)
comp
- the users component for the gl-contextglf
- the users selected GLFunc implementationglf
- the users selected GLUFunc implementation_createOwnWindow
- the flag for the visual property_offScreenRenderer
- the flag for the visual property_doubleBuffer
- the flag for the visual property_stereoView
- the flag for the visual property_rgba
- the flag for the visual property_stencilBits
- the flag for the visual property_accumSize
- the flag for the visual property_sharedGLContext
- the shared GLContext_offScrnSize
- the fixed offscreen pixmap sizepublic GLContext(java.awt.Component comp, GLFunc glf, GLUFunc gluf, GLCapabilities _glCaps, GLContext _sharedGLContext)
comp
- the users component for the gl-contextglf
- the users selected GLFunc implementationglf
- the users selected GLUFunc implementation_glCaps
- the GLCapabilities_sharedGLContext
- the shared GLContextpublic GLContext(java.awt.Component comp, GLFunc glf, GLUFunc gluf, boolean _createOwnWindow, boolean _doubleBuffer, boolean _stereoView, boolean _rgba, int _stencilBits, int _accumSize, GLContext _sharedGLContext)
comp
- the users component for the gl-contextglf
- the users selected GLFunc implementationglf
- the users selected GLUFunc implementation_createOwnWindow
- the flag for the visual property_doubleBuffer
- the flag for the visual property_stereoView
- the flag for the visual property_rgba
- the flag for the visual property_stencilBits
- the flag for the visual property_accumSize
- the flag for the visual property_sharedGLContext
- the shared GLContextpublic GLContext(java.awt.Component comp, GLFunc glf, GLUFunc gluf, boolean _createOwnWindow, boolean _doubleBuffer, boolean _stereoView, boolean _rgba, int _stencilBits, int _accumSize)
comp
- the users component for the gl-contextglf
- the users selected GLFunc implementationglf
- the users selected GLUFunc implementation_createOwnWindow
- the flag for the visual property_doubleBuffer
- the flag for the visual property_stereoView
- the flag for the visual property_rgba
- the flag for the visual property_stencilBits
- the flag for the visual property_accumSize
- the flag for the visual propertypublic GLContext(java.awt.Component comp, GLFunc glf, GLUFunc gluf, boolean _createOwnWindow, boolean _doubleBuffer, boolean _stereoView, boolean _rgba, int _stencilBits)
comp
- the users component for the gl-contextglf
- the users selected GLFunc implementationglf
- the users selected GLUFunc implementation_createOwnWindow
- the flag for the visual property_doubleBuffer
- the flag for the visual property_stereoView
- the flag for the visual property_rgba
- the flag for the visual property_stencilBits
- the flag for the visual propertypublic GLContext(java.awt.Component comp, GLFunc glf, GLUFunc gluf, boolean _doubleBuffer, boolean _stereoView, boolean _rgba, int _stencilBits, int _accumSize)
comp
- the users component for the gl-contextglf
- the users selected GLFunc implementationglf
- the users selected GLUFunc implementation_doubleBuffer
- the flag for the visual property_stereoView
- the flag for the visual property_rgba
- the flag for the visual property_stencilBits
- the flag for the visual propertypublic GLContext(java.awt.Component comp, GLFunc glf, GLUFunc gluf, boolean _doubleBuffer, boolean _stereoView, boolean _rgba, int _stencilBits)
comp
- the users component for the gl-contextglf
- the users selected GLFunc implementationglf
- the users selected GLUFunc implementation_doubleBuffer
- the flag for the visual property_stereoView
- the flag for the visual property_rgba
- the flag for the visual property_stencilBits
- the flag for the visual propertypublic GLContext(java.awt.Component comp, GLFunc glf, GLUFunc gluf, boolean _doubleBuffer, boolean _stereoView, boolean _rgba)
comp
- the users component for the gl-contextglf
- the users selected GLFunc implementationglf
- the users selected GLUFunc implementation_doubleBuffer
- the flag for the visual property_stereoView
- the flag for the visual property_rgba
- the flag for the visual property_stencilBits
- the flag for the visual propertypublic GLContext(java.awt.Component comp, GLFunc glf, GLUFunc gluf, boolean _doubleBuffer, boolean _stereoView)
comp
- the users component for the gl-contextglf
- the users selected GLFunc implementationglf
- the users selected GLUFunc implementation_doubleBuffer
- the flag for the visual property_stereoView
- the flag for the visual propertypublic GLContext(java.awt.Component comp, GLFunc glf, GLUFunc gluf)
comp
- the users component for the gl-contextglf
- the users selected GLFunc implementationglf
- the users selected GLUFunc implementationMethod Detail |
public final long getNativeGLContext()
glContext
public static final int getNativeGLContextNumber()
public final long getNativeWindoHandle()
windowHandle
public final GLContext getSharedGLContext()
sharedGLContext
public static int getNativeOSType()
OsWindoof
,
OsUnknown
,
OsX11
,
OsMac9
,
OsMacX
public static java.lang.String getNativeOSName()
public final GLCapabilities getGLCapabilities()
glCaps
,
GLContext(java.awt.Component, gl4java.GLFunc, gl4java.GLUFunc, boolean, boolean, java.awt.Dimension, gl4java.GLCapabilities, gl4java.GLContext)
public final boolean isDoubleBuffer()
glCaps
,
GLContext(java.awt.Component, gl4java.GLFunc, gl4java.GLUFunc, boolean, boolean, java.awt.Dimension, gl4java.GLCapabilities, gl4java.GLContext)
public final int getStencilBitNumber()
glCaps
,
GLContext(java.awt.Component, gl4java.GLFunc, gl4java.GLUFunc, boolean, boolean, java.awt.Dimension, gl4java.GLCapabilities, gl4java.GLContext)
public final int getAccumSize()
glCaps
,
GLContext(java.awt.Component, gl4java.GLFunc, gl4java.GLUFunc, boolean, boolean, java.awt.Dimension, gl4java.GLCapabilities, gl4java.GLContext)
public final boolean isStereoView()
glCaps
,
GLContext(java.awt.Component, gl4java.GLFunc, gl4java.GLUFunc, boolean, boolean, java.awt.Dimension, gl4java.GLCapabilities, gl4java.GLContext)
public final boolean isRGBA()
glCaps
,
GLContext(java.awt.Component, gl4java.GLFunc, gl4java.GLUFunc, boolean, boolean, java.awt.Dimension, gl4java.GLCapabilities, gl4java.GLContext)
public final boolean isOwnWindowCreated()
createOwnWindow
,
GLContext(java.awt.Component, gl4java.GLFunc, gl4java.GLUFunc, boolean, boolean, java.awt.Dimension, gl4java.GLCapabilities, gl4java.GLContext)
public static final boolean loadNativeLibraries(java.lang.String gljLibName, java.lang.String glLibName, java.lang.String gluLibName)
The user must call loadNativeLibrary ! E.g. he can add the default loader like this:
static { if(GLContext.loadNativeLibraries(null, null, null)==false) System.out.println("could not load def. native libs."); }
gljLibName
- The name of the GLContex/GLFunc/GLUFunc
native library.
If gljLibName==null, the default library will be used !glLibName
- deprecatedgluLibName
- deprecateddefGljLib
public static final boolean doLoadNativeLibraries(java.lang.String gljLibName, java.lang.String nativeGLLibName, java.lang.String nativeGLULibName)
GLTOOL_USE_GLLIB - OpenGL library name GLTOOL_USE_GLULIB - GLU library namethese environment variables does _always_ overrides any given ones at this point !! The name of the library is named e.g.: "GL4JavaJauGljJNI" at the Java level, or "libGL4JavaJauGljJNI.so" at the solaris level, or "GL4JavaJauGljJNI.dll" at the win32 level :-).
The user must call doLoadNativeLibrary ! E.g. he can add the default loader like this:
static { if(GLContext.doLoadNativeLibraries(null, null, null)==false) System.out.println("could not load def. native libs."); }
gljLibName
- The name of the GLContex/GLFunc/GLUFunc
native library.
If gljLibName==null, the default library will be used !nativeGLLibName
- The name of the native GL library.
If nativeGLLibName==null, the default library will be used !nativeGLULibName
- The name of the native GLU library.
If nativeGLULibName==null, the default library will be used !defGljLib
,
defNativeGLLibX11
,
defNativeGLLibMacOS9
,
defNativeGLLibMacOSX
,
defNativeGLLibWin32
,
defNativeGLULibX11
,
defNativeGLULibMacOS9
,
defNativeGLULibMacOSX
,
defNativeGLULibWin32
public static void main(java.lang.String[] args)
args,
- a list of args,
-GLLib public static java.lang.String getJVMVersion()
public static int getJVMVersionMajor()
public static int getJVMVersionMinor()
public static java.lang.String getJVMVendor()
public static boolean isNetscapeJVM()
public static boolean isMicrosoftJVM()
public static final GLContext createOffScreenCtx(GLFunc glf, GLUFunc gluf, boolean _stereoView, boolean _rgba, int _stencilBits, int _accumSize, GLContext _sharedGLContext)
glf
- the users selected GLFunc implementationglf
- the users selected GLUFunc implementation_stereoView
- the flag for the visual property_rgba
- the flag for the visual property_stencilBits
- the flag for the visual property_sharedGLContext
- the shared GLContextpublic static final GLContext createOffScreenCtx(GLFunc glf, GLUFunc gluf, boolean _stereoView, boolean _rgba, int _stencilBits, int _accumSize, GLContext _sharedGLContext, java.awt.Dimension _offScrnSize)
glf
- the users selected GLFunc implementationglf
- the users selected GLUFunc implementation_stereoView
- the flag for the visual property_rgba
- the flag for the visual property_stencilBits
- the flag for the visual property_sharedGLContext
- the shared GLContext_offScrnSize
- the fixed offscreen pixmap sizeprotected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
gljDestroy()
public final void setGLFunc(GLFunc _gl)
public final void setGLUFunc(GLUFunc _glu)
public final GLFunc getGLFunc()
public final GLUFunc getGLUFunc()
public static final GLFunc createGLFunc(java.lang.String vendorClass)
vendorClass
- The name of the GLFunc implementation.
If vendorSuffix==null, the default implementation
"GLFuncJauJNI" (-> GL4Java.GLFuncJauJNI.class )
will be used !defGLFuncClass
public static final GLUFunc createGLUFunc(java.lang.String vendorClass)
vendorClass
- The name of the GLUFunc implementation.
If vendorSuffix==null, the default implementation
"GLUFuncJauJNI" (-> GL4Java.GLUFuncJauJNI.class )
will be used !defGLUFuncClass
public void setVisible(boolean visible)
visible
- boolean: visible==true, hide==falsepublic final void createGLContext(java.awt.Graphics g)
g
- the graphics reference,
where we will get the native window handle from.GLContext(java.awt.Component, gl4java.GLFunc, gl4java.GLUFunc, boolean, boolean, java.awt.Dimension, gl4java.GLCapabilities, gl4java.GLContext)
protected final void gljInit() throws GL4JavaInitException
GL4Java.GL4JavaInitException
- this class throws an exception
if the native call to create a OpenGL context failed.createGLContext(java.awt.Graphics)
,
GLCanvas.paint(java.awt.Graphics)
,
GLCanvas.init()
public void run()
run
in interface java.lang.Runnable
public final boolean gljIsInit()
The user can use this method to check if he can start rendering and to be sure his initialisation (init) is done !
If you use gl4java.awt.GLCanvas, you should use the cvsIsInit method !
gljInit()
,
GLCanvas.cvsIsInit()
public final void gljResize(int width, int height)
protected static final boolean useJAWT()
protected static final boolean loadJAWT()
protected final boolean hasJAWTSurfaceChanged(long thisWin)
protected final boolean openOpenGLNative(java.awt.Component canvas)
public static final boolean gljCheckGLTypes()
public final boolean gljCheckGL()
public final boolean gljIsCurrent()
gljIsRequested()
,
gljMakeCurrent()
,
getNativeGLContext()
,
gljGetCurrentContext()
public final boolean gljIsRequested()
gljIsCurrent()
,
gljMakeCurrent()
,
getNativeGLContext()
,
gljGetCurrentContext()
public final boolean gljMakeCurrent()
This functions now optimizes the context-switch ! The context is changed, only if :
- another thread has requested this context -> release it this gives the other thread a chance to get it .. - this thread does not own the current context
You MUST encapsulate your OpenGL call's within:
- gljMakeCurrent() YOUR OpenGL commands here ! - gljFree()
gljSwap()
,
GLCanvas.display()
,
GLCanvas.sDisplay()
public final boolean gljMakeCurrent(boolean freeContextFirst)
freeContextFirst
- is obsolete !public static final long gljGetCurrentContext()
public final boolean gljDestroy()
gljMakeCurrent()
,
gljFree()
,
gljSwap()
public final boolean gljFree()
This functions now optimizes the context-switch ! The context is changed, only if :
- another thread has requested this context -> release it
gljFree()
,
gljIsCurrent()
,
gljIsRequested()
,
gljMakeCurrent()
,
gljSwap()
,
GLCanvas.display()
,
GLCanvas.sDisplay()
public final boolean gljFree(boolean force)
This functions now optimizes the context-switch ! The context is changed, only if one of the following is true:
- another thread has requested this context - the force flag is true - this thread is the AWT thread - the component of this context does _not_ implement GLRunnable - the calling thread is not the thread, this GLRunnable component holds !
gljIsCurrent()
,
gljIsRequested()
,
gljMakeCurrent()
,
gljSwap()
,
GLRunnable.run()
public final boolean gljSwap()
public void setEnabled(boolean b)
gljMakeCurrent()
,
gljDestroy()
,
gljFree()
public boolean isEnabled()
setEnabled(boolean)
,
gljMakeCurrent()
public static final boolean gljFetchGLFunctions(java.lang.String gllibname, java.lang.String glulibname, boolean force)
doLoadNativeLibraries(java.lang.String, java.lang.String, java.lang.String)
public static final boolean gljTestGLProc(java.lang.String name, boolean verbose)
public static final void gljReadPixelGL2AWT(int pack_rowlen, int pack_x, int pack_y, int x, int y, int width, int height, int format, int type, int bufferName, int[] pixelDest)
public static final void gljReadPixelGL2AWT(int pack_rowlen, int pack_x, int pack_y, int x, int y, int width, int height, int format, int type, int bufferName, short[] pixelDest)
public static final void gljReadPixelGL2AWT(int pack_rowlen, int pack_x, int pack_y, int x, int y, int width, int height, int format, int type, int bufferName, byte[] pixelGLDest)
public static final java.lang.String gljGetNativeLibVendor()
public static final java.lang.String gljGetNativeLibVersion()
public static final java.lang.String gljGetClassVersion()
public static final java.lang.String gljGetClassVendor()
public final java.lang.String gljGetVersions()
public final java.lang.String gljGetVersions(boolean verbose)
public final java.awt.Frame gljShowVersions()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |