javax.media.opengl
Interface GLBase

All Known Subinterfaces:
GL, GL2, GL2ES1, GL2ES2, GL2GL3, GL3, GL3bc, GL4, GL4bc, GLES1, GLES2
All Known Implementing Classes:
DebugGL2, DebugGL3, DebugGL3bc, DebugGL4, DebugGL4bc, DebugGLES1, DebugGLES2, TraceGL2, TraceGL3, TraceGL3bc, TraceGL4, TraceGL4bc, TraceGLES1, TraceGLES2

public interface GLBase

The base interface from which all GL profiles derive, providing checked conversion down to concrete profiles, access to the OpenGL context associated with the GL and extension/function availability queries as described below.

While the APIs for vendor extensions are unconditionally exposed, the underlying functions may not be present. The method isFunctionAvailable(java.lang.String) should be used to query the availability of any non-core function before it is used for the first time; for example, gl.isFunctionAvailable("glProgramStringARB"). On certain platforms (Windows in particular), the most "core" functionality is only OpenGL 1.1, so in theory any routines first exposed in OpenGL 1.2, 1.3, and 1.4, 1.5, or 2.0 as well as vendor extensions should all be queried. Calling an unavailable function will cause a GLException to be raised.

isExtensionAvailable(java.lang.String) may also be used to determine whether a specific extension is available before calling the routines or using the functionality it exposes: for example, gl.isExtensionAvailable("GL_ARB_vertex_program");. However, in this case it is up to the end user to know which routines or functionality are associated with which OpenGL extensions. It may also be used to test for the availability of a particular version of OpenGL: for example, gl.isExtensionAvailable("GL_VERSION_1_5");.

Exceptions to the window system extension naming rules:


Method Summary
 int getBoundFramebuffer(int target)
          Return the framebuffer name bound to this context, see GL.glBindFramebuffer(int, int).
 GLContext getContext()
          Returns the GLContext associated which this GL object.
 int getDefaultDrawFramebuffer()
          Return the default draw framebuffer name.
 int getDefaultReadBuffer()
          Returns the default color buffer within the current bound getDefaultReadFramebuffer(), i.e.
 int getDefaultReadFramebuffer()
          Return the default read framebuffer name.
 Object getExtension(String extensionName)
          Returns an object providing access to the specified OpenGL extension.
 GL getGL()
          Casts this object to the GL interface.
 GL2 getGL2()
          Casts this object to the GL2 interface.
 GL2ES1 getGL2ES1()
          Casts this object to the GL2ES1 interface.
 GL2ES2 getGL2ES2()
          Casts this object to the GL2ES2 interface.
 GL2GL3 getGL2GL3()
          Casts this object to the GL2GL3 interface.
 GL3 getGL3()
          Casts this object to the GL3 interface.
 GL3bc getGL3bc()
          Casts this object to the GL3bc interface.
 GL4 getGL4()
          Casts this object to the GL4 interface.
 GL4bc getGL4bc()
          Casts this object to the GL4bc interface.
 GLES1 getGLES1()
          Casts this object to the GLES1 interface.
 GLES2 getGLES2()
          Casts this object to the GLES2 interface.
 GLProfile getGLProfile()
          Returns the GLProfile associated with this GL object.
 int getMaxRenderbufferSamples()
          Returns the maximum number of FBO RENDERBUFFER samples if full FBO is supported, otherwise false.
 Object getPlatformGLExtensions()
          Returns an object through which platform-specific OpenGL extensions (EGL, GLX, WGL, etc.) may be accessed.
 int getSwapInterval()
          Provides a platform-independent way to get the swap interval set by setSwapInterval(int).
 void glClearDepth(double depth)
          Aliased entrypoint of void glClearDepth(GLclampd depth); and void glClearDepthf(GLclampf depth); .
 void glDepthRange(double zNear, double zFar)
          Aliased entrypoint of void glDepthRange(GLclampd depth); and void glDepthRangef(GLclampf depth); .
 int glGetBoundBuffer(int target)
           
 long glGetBufferSize(int buffer)
           
 boolean glIsVBOArrayEnabled()
           
 boolean glIsVBOElementArrayEnabled()
           
 boolean hasBasicFBOSupport()
          Returns true if basic FBO support is available, otherwise false.
 boolean hasFullFBOSupport()
          Returns true if full FBO support is available, otherwise false.
 boolean hasGLSL()
          Indicates whether this GL object supports GLSL.
 boolean isExtensionAvailable(String glExtensionName)
          Returns true if the specified OpenGL extension can be used successfully through this GL instance given the current host (OpenGL client) and display (OpenGL server) configuration.
 boolean isFunctionAvailable(String glFunctionName)
          Returns true if the specified OpenGL core- or extension-function can be used successfully through this GL instance given the current host (OpenGL client) and display (OpenGL server) configuration.
 boolean isGL()
          Indicates whether this GL object conforms to any of the OpenGL profiles.
 boolean isGL2()
          Indicates whether this GL object conforms to the OpenGL ≤ 3.0 profile.
 boolean isGL2ES1()
          Indicates whether this GL object conforms to a GL2ES1 compatible profile.
 boolean isGL2ES2()
          Indicates whether this GL object conforms to a GL2ES2 compatible profile.
 boolean isGL2GL3()
          Indicates whether this GL object conforms to a GL2GL3 compatible profile.
 boolean isGL3()
          Indicates whether this GL object conforms to the OpenGL ≥ 3.1 core profile.
 boolean isGL3bc()
          Indicates whether this GL object conforms to the OpenGL ≥ 3.1 compatibility profile.
 boolean isGL4()
          Indicates whether this GL object conforms to the OpenGL ≥ 4.0 core profile.
 boolean isGL4bc()
          Indicates whether this GL object conforms to the OpenGL ≥ 4.0 compatibility profile.
 boolean isGLES()
          Indicates whether this GL object conforms to one of the OpenGL ES profiles, see isGLES1() and isGLES2().
 boolean isGLES1()
          Indicates whether this GL object conforms to the OpenGL ES1 ≥ 1.0 profile.
 boolean isGLES2()
          Indicates whether this GL object conforms to the OpenGL ES2 ≥ 2.0 profile.
 boolean isGLES2Compatible()
          Indicates whether this GL object is compatible with the core OpenGL ES2 functionality.
 boolean isNPOTTextureAvailable()
          Returns true if the GL context supports non power of two (NPOT) textures, otherwise false.
 boolean isTextureFormatBGRA8888Available()
           
 void setSwapInterval(int interval)
          Provides a platform-independent way to specify the minimum swap interval for buffer swaps.
 

Method Detail

isGL

boolean isGL()
Indicates whether this GL object conforms to any of the OpenGL profiles.


isGL4bc

boolean isGL4bc()
Indicates whether this GL object conforms to the OpenGL ≥ 4.0 compatibility profile. The GL4 compatibility profile includes the GL2, GL2ES1, GL2ES2, GL3, GL3bc and GL4 profile.


isGL4

boolean isGL4()
Indicates whether this GL object conforms to the OpenGL ≥ 4.0 core profile. The GL4 core profile includes the GL2ES2, and GL3 profile.


isGL3bc

boolean isGL3bc()
Indicates whether this GL object conforms to the OpenGL ≥ 3.1 compatibility profile. The GL3 compatibility profile includes the GL2, GL2ES1, GL2ES2 and GL3 profile.


isGL3

boolean isGL3()
Indicates whether this GL object conforms to the OpenGL ≥ 3.1 core profile. The GL3 core profile includes the GL2ES2 profile.


isGL2

boolean isGL2()
Indicates whether this GL object conforms to the OpenGL ≤ 3.0 profile. The GL2 profile includes the GL2ES1 and GL2ES2 profile.


isGLES1

boolean isGLES1()
Indicates whether this GL object conforms to the OpenGL ES1 ≥ 1.0 profile.


isGLES2

boolean isGLES2()
Indicates whether this GL object conforms to the OpenGL ES2 ≥ 2.0 profile.

Remark: ES2 compatible desktop profiles are not included. To query whether core ES2 functionality is provided, use isGLES2Compatible().

See Also:
isGLES2Compatible()

isGLES

boolean isGLES()
Indicates whether this GL object conforms to one of the OpenGL ES profiles, see isGLES1() and isGLES2().


isGL2ES1

boolean isGL2ES1()
Indicates whether this GL object conforms to a GL2ES1 compatible profile.


isGL2ES2

boolean isGL2ES2()
Indicates whether this GL object conforms to a GL2ES2 compatible profile.


isGLES2Compatible

boolean isGLES2Compatible()
Indicates whether this GL object is compatible with the core OpenGL ES2 functionality.

Returns:
true if this context is an ES2 context or implements the extension GL_ARB_ES2_compatibility, otherwise false

isGL2GL3

boolean isGL2GL3()
Indicates whether this GL object conforms to a GL2GL3 compatible profile.


hasGLSL

boolean hasGLSL()
Indicates whether this GL object supports GLSL.


getGL

GL getGL()
         throws GLException
Casts this object to the GL interface.

Throws:
GLException - if this GLObject is not a GL implementation

getGL4bc

GL4bc getGL4bc()
               throws GLException
Casts this object to the GL4bc interface.

Throws:
GLException - if this GLObject is not a GL4bc implementation

getGL4

GL4 getGL4()
           throws GLException
Casts this object to the GL4 interface.

Throws:
GLException - if this GLObject is not a GL4 implementation

getGL3bc

GL3bc getGL3bc()
               throws GLException
Casts this object to the GL3bc interface.

Throws:
GLException - if this GLObject is not a GL3bc implementation

getGL3

GL3 getGL3()
           throws GLException
Casts this object to the GL3 interface.

Throws:
GLException - if this GLObject is not a GL3 implementation

getGL2

GL2 getGL2()
           throws GLException
Casts this object to the GL2 interface.

Throws:
GLException - if this GLObject is not a GL2 implementation

getGLES1

GLES1 getGLES1()
               throws GLException
Casts this object to the GLES1 interface.

Throws:
GLException - if this GLObject is not a GLES1 implementation

getGLES2

GLES2 getGLES2()
               throws GLException
Casts this object to the GLES2 interface.

Throws:
GLException - if this GLObject is not a GLES2 implementation

getGL2ES1

GL2ES1 getGL2ES1()
                 throws GLException
Casts this object to the GL2ES1 interface.

Throws:
GLException - if this GLObject is not a GL2ES1 implementation

getGL2ES2

GL2ES2 getGL2ES2()
                 throws GLException
Casts this object to the GL2ES2 interface.

Throws:
GLException - if this GLObject is not a GL2ES2 implementation

getGL2GL3

GL2GL3 getGL2GL3()
                 throws GLException
Casts this object to the GL2GL3 interface.

Throws:
GLException - if this GLObject is not a GL2GL3 implementation

getGLProfile

GLProfile getGLProfile()
Returns the GLProfile associated with this GL object.


getContext

GLContext getContext()
Returns the GLContext associated which this GL object.


isFunctionAvailable

boolean isFunctionAvailable(String glFunctionName)
Returns true if the specified OpenGL core- or extension-function can be used successfully through this GL instance given the current host (OpenGL client) and display (OpenGL server) configuration.

By "successfully" we mean that the function is both callable on the machine running the program and available on the current display.

In order to call a function successfully, the function must be both callable on the machine running the program and available on the display device that is rendering the output (note: on non-networked, single-display machines these two conditions are identical; on networked and/or multi-display machines this becomes more complicated). These conditions are met if the function is either part of the core OpenGL version supported by both the host and display, or it is an OpenGL extension function that both the host and display support.

A GL function is callable if it is successfully linked at runtime, hence the GLContext must be made current at least once.

Parameters:
glFunctionName - the name of the OpenGL function (e.g., use "glBindRenderbufferEXT" or "glBindRenderbuffer" to check if GL.glBindRenderbuffer(int,int) is available).

isExtensionAvailable

boolean isExtensionAvailable(String glExtensionName)
Returns true if the specified OpenGL extension can be used successfully through this GL instance given the current host (OpenGL client) and display (OpenGL server) configuration.

Parameters:
glExtensionName - the name of the OpenGL extension (e.g., "GL_ARB_vertex_program").

hasBasicFBOSupport

boolean hasBasicFBOSupport()
Returns true if basic FBO support is available, otherwise false.

Basic FBO is supported if the context is either GL-ES >= 2.0, GL >= core 3.0 or implements the extensions GL_ARB_ES2_compatibility, GL_ARB_framebuffer_object, GL_EXT_framebuffer_object or GL_OES_framebuffer_object.

Basic FBO support may only include one color attachment and no multisampling, as well as limited internal formats for renderbuffer.

See Also:
GLContext.hasBasicFBOSupport()

hasFullFBOSupport

boolean hasFullFBOSupport()
Returns true if full FBO support is available, otherwise false.

Full FBO is supported if the context is either GL >= core 3.0 or implements the extensions ARB_framebuffer_object, or all of EXT_framebuffer_object, EXT_framebuffer_multisample, EXT_framebuffer_blit, GL_EXT_packed_depth_stencil.

Full FBO support includes multiple color attachments and multisampling.

See Also:
GLContext.hasFullFBOSupport()

getMaxRenderbufferSamples

int getMaxRenderbufferSamples()
Returns the maximum number of FBO RENDERBUFFER samples if full FBO is supported, otherwise false.

See Also:
GLContext.getMaxRenderbufferSamples()

isNPOTTextureAvailable

boolean isNPOTTextureAvailable()
Returns true if the GL context supports non power of two (NPOT) textures, otherwise false.

NPOT textures are supported in OpenGL >= 3, GLES2 or if the 'GL_ARB_texture_non_power_of_two' extension is available.

Returns:

isTextureFormatBGRA8888Available

boolean isTextureFormatBGRA8888Available()

setSwapInterval

void setSwapInterval(int interval)
Provides a platform-independent way to specify the minimum swap interval for buffer swaps. An argument of 0 disables sync-to-vertical-refresh completely, while an argument of 1 causes the application to wait until the next vertical refresh until swapping buffers. The default, which is platform-specific, is usually either 0 or 1. This function is not guaranteed to have an effect, and in particular only affects heavyweight onscreen components.

Throws:
GLException - if this context is not the current
See Also:
getSwapInterval()

getSwapInterval

int getSwapInterval()
Provides a platform-independent way to get the swap interval set by setSwapInterval(int).
If the interval is not set by setSwapInterval(int) yet, -1 is returned, indicating that the platforms default is being used.

See Also:
setSwapInterval(int)

getPlatformGLExtensions

Object getPlatformGLExtensions()
Returns an object through which platform-specific OpenGL extensions (EGL, GLX, WGL, etc.) may be accessed. The data type of the returned object and its associated capabilities are undefined. Most applications will never need to call this method. It is highly recommended that any applications which do call this method perform all accesses on the returned object reflectively to guard themselves against changes to the implementation.


getExtension

Object getExtension(String extensionName)
Returns an object providing access to the specified OpenGL extension. This is intended to provide a mechanism for vendors who wish to provide access to new OpenGL extensions without changing the public API of the core package. For example, a user may request access to extension "GL_VENDOR_foo" and receive back an object which implements a vendor-specified interface which can call the OpenGL extension functions corresponding to that extension. It is up to the vendor to specify both the extension name and Java API for accessing it, including which class or interface contains the functions.

Note: it is the intent to add new extensions as quickly as possible to the core GL API. Therefore it is unlikely that most vendors will use this extension mechanism, but it is being provided for completeness.


glClearDepth

void glClearDepth(double depth)
Aliased entrypoint of void glClearDepth(GLclampd depth); and void glClearDepthf(GLclampf depth); .


glDepthRange

void glDepthRange(double zNear,
                  double zFar)
Aliased entrypoint of void glDepthRange(GLclampd depth); and void glDepthRangef(GLclampf depth); .


glGetBoundBuffer

int glGetBoundBuffer(int target)
Parameters:
target - a GL buffer (VBO) target as used in GL.glBindBuffer(int, int), ie GL.GL_ELEMENT_ARRAY_BUFFER, GL.GL_ARRAY_BUFFER, ..
Returns:
the GL buffer (VBO) name bound to a target via GL.glBindBuffer(int, int) or 0 if unbound.

glGetBufferSize

long glGetBufferSize(int buffer)
Parameters:
buffer - a GL buffer name, generated with GL.glGenBuffers(int, int[], int) and used in GL.glBindBuffer(int, int), GL.glBufferData(int, long, java.nio.Buffer, int) or GL2.glNamedBufferDataEXT(int, long, java.nio.Buffer, int) for example.
Returns:
the size of the given GL buffer

glIsVBOArrayEnabled

boolean glIsVBOArrayEnabled()
Returns:
true if a VBO is bound to GL.GL_ARRAY_BUFFER via GL.glBindBuffer(int, int), otherwise false

glIsVBOElementArrayEnabled

boolean glIsVBOElementArrayEnabled()
Returns:
true if a VBO is bound to GL.GL_ELEMENT_ARRAY_BUFFER via GL.glBindBuffer(int, int), otherwise false

getBoundFramebuffer

int getBoundFramebuffer(int target)
Return the framebuffer name bound to this context, see GL.glBindFramebuffer(int, int).


getDefaultDrawFramebuffer

int getDefaultDrawFramebuffer()
Return the default draw framebuffer name.

May differ from it's default zero in case an framebuffer object (FBObject) based drawable is being used.


getDefaultReadFramebuffer

int getDefaultReadFramebuffer()
Return the default read framebuffer name.

May differ from it's default zero in case an framebuffer object (FBObject) based drawable is being used.


getDefaultReadBuffer

int getDefaultReadBuffer()
Returns the default color buffer within the current bound getDefaultReadFramebuffer(), i.e. GL_READ_FRAMEBUFFER, which will be used as the source for pixel reading commands, like GL.glReadPixels(int, int, int, int, int, int, java.nio.Buffer) etc.

For offscreen framebuffer objects this is GL.GL_COLOR_ATTACHMENT0, otherwise this is GL.GL_FRONT for single buffer configurations and GL.GL_BACK for double buffer configurations.



Copyright 2010 JogAmp Community.