public class DrawContext
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
DrawableQueue |
drawableQueue |
DrawableList |
drawableTerrain |
Vec3 |
eyePoint |
Matrix4 |
infiniteProjection |
Matrix4 |
modelview |
Matrix4 |
modelviewProjection |
PickedObjectList |
pickedObjects |
boolean |
pickMode |
Vec2 |
pickPoint |
Viewport |
pickViewport |
Matrix4 |
projection |
Matrix4 |
screenProjection |
Viewport |
viewport |
Constructor and Description |
---|
DrawContext() |
Modifier and Type | Method and Description |
---|---|
void |
activeTextureUnit(int textureUnit)
Specifies the OpenGL multitexture unit to make active.
|
void |
bindBuffer(int target,
int bufferId)
Makes an OpenGL buffer object bound to a specified target buffer.
|
void |
bindFramebuffer(int framebufferId)
Makes an OpenGL framebuffer object active.
|
void |
bindTexture(int textureId)
Makes an OpenGL texture 2D object bound to the current multitexture unit.
|
void |
contextLost() |
int |
currentBuffer(int target)
Returns the name of the OpenGL buffer object bound to the specified target buffer.
|
int |
currentFramebuffer()
Returns the name of the OpenGL framebuffer object that is currently active.
|
int |
currentProgram()
Returns the name of the OpenGL program object that is currently active.
|
int |
currentTexture()
Returns the name of the OpenGL texture 2D object currently bound to the active multitexture unit.
|
int |
currentTexture(int textureUnit)
Returns the name of the OpenGL texture 2D object currently bound to the specified multitexture unit.
|
int |
currentTextureUnit()
Returns the OpenGL multitexture unit that is currently active.
|
DrawableTerrain |
getDrawableTerrain(int index) |
int |
getDrawableTerrainCount() |
Drawable |
peekDrawable() |
Drawable |
pollDrawable() |
Color |
readPixelColor(int x,
int y,
Color result)
Reads the fragment color at a screen point in the currently active OpenGL frame buffer.
|
java.util.Set<Color> |
readPixelColors(int x,
int y,
int width,
int height)
Reads the unique fragment colors within a screen rectangle in the currently active OpenGL frame buffer.
|
void |
reset() |
void |
rewindDrawables() |
java.nio.ByteBuffer |
scratchBuffer(int capacity)
Returns a scratch NIO buffer suitable for use during drawing.
|
java.util.ArrayList<java.lang.Object> |
scratchList()
Returns a scratch list suitable for accumulating entries during drawing.
|
Framebuffer |
surfaceFramebuffer() |
BufferObject |
unitSquareBuffer()
Returns an OpenGL buffer object containing a unit square expressed as four vertices at (0, 1), (0, 0), (1, 1) and
(1, 0).
|
void |
useProgram(int programId)
Makes an OpenGL program object active as part of current rendering state.
|
public Vec3 eyePoint
public Viewport viewport
public Matrix4 projection
public Matrix4 modelview
public Matrix4 modelviewProjection
public Matrix4 infiniteProjection
public Matrix4 screenProjection
public DrawableQueue drawableQueue
public DrawableList drawableTerrain
public PickedObjectList pickedObjects
public Viewport pickViewport
public Vec2 pickPoint
public boolean pickMode
public void reset()
public void contextLost()
public Drawable peekDrawable()
public Drawable pollDrawable()
public void rewindDrawables()
public int getDrawableTerrainCount()
public DrawableTerrain getDrawableTerrain(int index)
public int currentFramebuffer()
public void bindFramebuffer(int framebufferId)
framebufferId
- the name of the OpenGL framebuffer object to make active, or 0 to make the default
framebuffer provided by the windowing system activepublic Framebuffer surfaceFramebuffer()
public int currentProgram()
public void useProgram(int programId)
programId
- the name of the OpenGL program object to make active, or 0 to make no program activepublic int currentTextureUnit()
public void activeTextureUnit(int textureUnit)
textureUnit
- the multitexture unit, one of GL_TEXTUREi, where i ranges from 0 to 32.public int currentTexture()
public int currentTexture(int textureUnit)
textureUnit
- the multitexture unit, one of GL_TEXTUREi, where i ranges from 0 to 32.public void bindTexture(int textureId)
textureId
- the name of the OpenGL texture 2D object to make active, or 0 to make no texture activepublic int currentBuffer(int target)
target
- the target buffer, either GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFERpublic void bindBuffer(int target, int bufferId)
target
- the target buffer, either GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFERbufferId
- the name of the OpenGL buffer object to make activepublic BufferObject unitSquareBuffer()
public Color readPixelColor(int x, int y, Color result)
x
- the screen point's X componenty
- the screen point's Y componentresult
- an optional pre-allocated Color in which to return the fragment color, or null to return a new
colorpublic java.util.Set<Color> readPixelColors(int x, int y, int width, int height)
x
- the screen rectangle's X componenty
- the screen rectangle's Y componentwidth
- the screen rectangle's widthheight
- the screen rectangle's heightpublic java.nio.ByteBuffer scratchBuffer(int capacity)
capacity
- the buffer's minimum capacity in bytespublic java.util.ArrayList<java.lang.Object> scratchList()