JOGL v2.6.0-rc-20250706
JOGL, High-Performance Graphics Binding for Java™ (public API).
com.jogamp.opengl.util.awt.Overlay Class Reference

Provides a Java 2D overlay on top of an arbitrary GLDrawable, making it easier to do things like draw text and images on top of an OpenGL scene while still maintaining reasonably good efficiency. More...

Collaboration diagram for com.jogamp.opengl.util.awt.Overlay:

Public Member Functions

 Overlay (final GLDrawable drawable)
 Creates a new Java 2D overlay on top of the specified GLDrawable. More...
 
Graphics2D createGraphics ()
 Creates a Graphics2D instance for rendering into the overlay. More...
 
boolean contentsLost ()
 Indicates whether the Java 2D contents of the overlay were lost since the last time createGraphics was called. More...
 
void markDirty (final int x, final int y, final int width, final int height)
 Marks the given region of the overlay as dirty. More...
 
void drawAll () throws GLException
 Draws the entire contents of the overlay on top of the OpenGL drawable. More...
 
void beginRendering () throws GLException
 Begins the OpenGL rendering process for the overlay. More...
 
void endRendering () throws GLException
 Ends the OpenGL rendering process for the overlay. More...
 
void draw (final int x, final int y, final int width, final int height) throws GLException
 Draws the specified sub-rectangle of the overlay on top of the OpenGL drawable. More...
 
void draw (final int screenx, final int screeny, final int overlayx, final int overlayy, final int width, final int height) throws GLException
 Draws the specified sub-rectangle of the overlay at the specified x and y coordinate on top of the OpenGL drawable. More...
 

Detailed Description

Provides a Java 2D overlay on top of an arbitrary GLDrawable, making it easier to do things like draw text and images on top of an OpenGL scene while still maintaining reasonably good efficiency.

Definition at line 51 of file Overlay.java.

Constructor & Destructor Documentation

◆ Overlay()

com.jogamp.opengl.util.awt.Overlay.Overlay ( final GLDrawable  drawable)

Creates a new Java 2D overlay on top of the specified GLDrawable.

Definition at line 58 of file Overlay.java.

Member Function Documentation

◆ beginRendering()

void com.jogamp.opengl.util.awt.Overlay.beginRendering ( ) throws GLException

Begins the OpenGL rendering process for the overlay.

This is separated out so advanced applications can render independent pieces of the overlay to different portions of the drawable.

Exceptions
GLExceptionIf an OpenGL context is not current when this method is called

Definition at line 132 of file Overlay.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ contentsLost()

boolean com.jogamp.opengl.util.awt.Overlay.contentsLost ( )

Indicates whether the Java 2D contents of the overlay were lost since the last time createGraphics was called.

This method should be called immediately after calling createGraphics to see whether the entire contents of the overlay need to be redrawn or just the region the application is interested in updating.

Returns
whether the contents of the overlay were lost since the last render

Definition at line 87 of file Overlay.java.

◆ createGraphics()

Graphics2D com.jogamp.opengl.util.awt.Overlay.createGraphics ( )

Creates a Graphics2D instance for rendering into the overlay.

The returned object should be disposed of using the normal Graphics.dispose() method once it is no longer being used.

Returns
a new Graphics2D object for rendering into the backing store of this renderer

Definition at line 70 of file Overlay.java.

Here is the call graph for this function:

◆ draw() [1/2]

void com.jogamp.opengl.util.awt.Overlay.draw ( final int  screenx,
final int  screeny,
final int  overlayx,
final int  overlayy,
final int  width,
final int  height 
) throws GLException

Draws the specified sub-rectangle of the overlay at the specified x and y coordinate on top of the OpenGL drawable.

beginRendering and endRendering must be used in conjunction with this method to achieve proper rendering results. This method should be called while the OpenGL context for the drawable is current, and after your OpenGL scene has been rendered.

Parameters
screenxthe on-screen x coordinate at which to draw the rectangle
screenythe on-screen y coordinate (relative to lower left) at which to draw the rectangle
overlayxthe x coordinate of the pixel in the overlay of the lower left portion of the rectangle to draw
overlayythe y coordinate of the pixel in the overlay (relative to lower left) of the lower left portion of the rectangle to draw
widththe width of the rectangle to draw
heightthe height of the rectangle to draw
Exceptions
GLExceptionIf an OpenGL context is not current when this method is called

Definition at line 187 of file Overlay.java.

Here is the call graph for this function:

◆ draw() [2/2]

void com.jogamp.opengl.util.awt.Overlay.draw ( final int  x,
final int  y,
final int  width,
final int  height 
) throws GLException

Draws the specified sub-rectangle of the overlay on top of the OpenGL drawable.

beginRendering and endRendering must be used in conjunction with this method to achieve proper rendering results. This method should be called while the OpenGL context for the drawable is current, and after your OpenGL scene has been rendered.

Parameters
xthe lower-left x coordinate (relative to the lower left of the overlay) of the rectangle to draw
ythe lower-left y coordinate (relative to the lower left of the overlay) of the rectangle to draw
widththe width of the rectangle to draw
heightthe height of the rectangle to draw
Exceptions
GLExceptionIf an OpenGL context is not current when this method is called

Definition at line 162 of file Overlay.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawAll()

void com.jogamp.opengl.util.awt.Overlay.drawAll ( ) throws GLException

Draws the entire contents of the overlay on top of the OpenGL drawable.

This is a convenience method which encapsulates all portions of the rendering process; if this method is used, beginRendering, endRendering, etc. should not be used. This method should be called while the OpenGL context for the drawable is current, and after your OpenGL scene has been rendered.

Exceptions
GLExceptionIf an OpenGL context is not current when this method is called

Definition at line 120 of file Overlay.java.

Here is the call graph for this function:

◆ endRendering()

void com.jogamp.opengl.util.awt.Overlay.endRendering ( ) throws GLException

Ends the OpenGL rendering process for the overlay.

This is separated out so advanced applications can render independent pieces of the overlay to different portions of the drawable.

Exceptions
GLExceptionIf an OpenGL context is not current when this method is called

Definition at line 142 of file Overlay.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ markDirty()

void com.jogamp.opengl.util.awt.Overlay.markDirty ( final int  x,
final int  y,
final int  width,
final int  height 
)

Marks the given region of the overlay as dirty.

This region, and any previously set dirty regions, will be automatically synchronized with the underlying Texture during the next draw or drawAll operation, at which point the dirty region will be cleared. It is not necessary for an OpenGL context to be current when this method is called.

Parameters
xthe x coordinate (in Java 2D coordinates – relative to upper left) of the region to update
ythe y coordinate (in Java 2D coordinates – relative to upper left) of the region to update
widththe width of the region to update
heightthe height of the region to update
Exceptions
GLExceptionIf an OpenGL context is not current when this method is called

Definition at line 106 of file Overlay.java.

Here is the call graph for this function:

The documentation for this class was generated from the following file: