public class Overlay extends Object
Constructor and Description |
---|
Overlay(GLDrawable drawable)
Creates a new Java 2D overlay on top of the specified
GLDrawable.
|
Modifier and Type | Method and Description |
---|---|
void |
beginRendering()
Begins the OpenGL rendering process for the overlay.
|
boolean |
contentsLost()
Indicates whether the Java 2D contents of the overlay were lost
since the last time
createGraphics() was called. |
Graphics2D |
createGraphics()
Creates a
Graphics2D instance for
rendering into the overlay. |
void |
draw(int x,
int y,
int width,
int height)
Draws the specified sub-rectangle of the overlay on top of the
OpenGL drawable.
|
void |
draw(int screenx,
int screeny,
int overlayx,
int overlayy,
int width,
int height)
Draws the specified sub-rectangle of the overlay at the
specified x and y coordinate on top of the OpenGL drawable.
|
void |
drawAll()
Draws the entire contents of the overlay on top of the OpenGL
drawable.
|
void |
endRendering()
Ends the OpenGL rendering process for the overlay.
|
void |
markDirty(int x,
int y,
int width,
int height)
Marks the given region of the overlay as dirty.
|
public Overlay(GLDrawable drawable)
public Graphics2D createGraphics()
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.Graphics2D
object for
rendering into the backing store of this rendererpublic boolean contentsLost()
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.public void markDirty(int x, int y, int width, int height)
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.x
- the x coordinate (in Java 2D coordinates -- relative to
upper left) of the region to updatey
- the y coordinate (in Java 2D coordinates -- relative to
upper left) of the region to updatewidth
- the width of the region to updateheight
- the height of the region to updateGLException
- If an OpenGL context is not current when this method is calledpublic void drawAll() throws GLException
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.GLException
- If an OpenGL context is not current when this method is calledpublic void beginRendering() throws GLException
GLException
- If an OpenGL context is not current when this method is calledpublic void endRendering() throws GLException
GLException
- If an OpenGL context is not current when this method is calledpublic void draw(int x, int y, int width, int height) throws GLException
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.x
- the lower-left x coordinate (relative to the lower left
of the overlay) of the rectangle to drawy
- the lower-left y coordinate (relative to the lower left
of the overlay) of the rectangle to drawwidth
- the width of the rectangle to drawheight
- the height of the rectangle to drawGLException
- If an OpenGL context is not current when this method is calledpublic void draw(int screenx, int screeny, int overlayx, int overlayy, int width, int height) throws GLException
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.screenx
- the on-screen x coordinate at which to draw the rectanglescreeny
- the on-screen y coordinate (relative to lower left) at
which to draw the rectangleoverlayx
- the x coordinate of the pixel in the overlay of
the lower left portion of the rectangle to drawoverlayy
- the y coordinate of the pixel in the overlay
(relative to lower left) of the lower left portion of the
rectangle to drawwidth
- the width of the rectangle to drawheight
- the height of the rectangle to drawGLException
- If an OpenGL context is not current when this method is calledCopyright 2010 JogAmp Community.