本文整理匯總了Java中javax.media.opengl.GL2.glDepthMask方法的典型用法代碼示例。如果您正苦於以下問題:Java GL2.glDepthMask方法的具體用法?Java GL2.glDepthMask怎麽用?Java GL2.glDepthMask使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.media.opengl.GL2
的用法示例。
在下文中一共展示了GL2.glDepthMask方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: beginDrawLasso
import javax.media.opengl.GL2; //導入方法依賴的package包/類
private void beginDrawLasso(DrawContext dc) {
//GL gl = dc.getGL();
GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.
int attributeMask =
GL.GL_DEPTH_BUFFER_BIT // for depth test, depth mask and depth func
| GL2.GL_TRANSFORM_BIT // for modelview and perspective
| GL2.GL_VIEWPORT_BIT // for depth range
| GL2.GL_CURRENT_BIT // for current color
| GL2.GL_COLOR_BUFFER_BIT // for alpha test func and ref, and blend
| GL2.GL_DEPTH_BUFFER_BIT // for depth func
| GL2.GL_ENABLE_BIT; // for enable/disable changes
gl.glPushAttrib(attributeMask);
// Apply the depth buffer but don't change it.
gl.glEnable(GL.GL_DEPTH_TEST);
gl.glDepthFunc(GL.GL_ALWAYS);
gl.glDepthMask(false);
// Load a parallel projection with dimensions (viewportWidth, viewportHeight)
int[] viewport = new int[4];
gl.glGetIntegerv(GL.GL_VIEWPORT, viewport, 0);
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glPushMatrix();
gl.glLoadIdentity();
gl.glOrtho(0d, viewport[2], 0d, viewport[3], -1d, 1d);
gl.glMatrixMode(GL2.GL_MODELVIEW);
gl.glPushMatrix();
}
示例2: appearOnGLAutoDrawable
import javax.media.opengl.GL2; //導入方法依賴的package包/類
void appearOnGLAutoDrawable(GLAutoDrawable drawable, float angle) {
GL2 gl = drawable.getGL().getGL2();
texture.bind(gl);
gl.glDepthMask(false);
for (int index = particles.size() - 1; index >= 0; --index) {
Particle aParticle = particles.get(index);
aParticle.appearOnGLAutoDrawable(drawable, angle);
aParticle.move();
if (aParticle.isDead()) {
particles.remove(index);
}
}
gl.glDepthMask(true);
}
示例3: beginDrawIcons
import javax.media.opengl.GL2; //導入方法依賴的package包/類
@Override
protected void beginDrawIcons(DrawContext dc) {
GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.
this.oglStackHandler.clear();
int attributeMask =
GL.GL_DEPTH_BUFFER_BIT // for depth test, depth mask and depth func
| GL2.GL_TRANSFORM_BIT // for modelview and perspective
| GL2.GL_VIEWPORT_BIT // for depth range
| GL2.GL_CURRENT_BIT // for current color
| GL.GL_COLOR_BUFFER_BIT // for alpha test func and ref, and blend
| GL2.GL_TEXTURE_BIT // for texture env
| GL.GL_DEPTH_BUFFER_BIT // for depth func
| GL2.GL_ENABLE_BIT; // for enable/disable changes
this.oglStackHandler.pushAttrib(gl, attributeMask);
// Apply the depth buffer but don't change it.
if ((!dc.isDeepPickingEnabled())) {
gl.glEnable(GL.GL_DEPTH_TEST);
}
gl.glDepthMask(false);
// Suppress any fully transparent image pixels
gl.glEnable(GL2.GL_ALPHA_TEST);
gl.glAlphaFunc(GL.GL_GREATER, 0.001f);
// Load a parallel projection with dimensions (viewportWidth, viewportHeight)
this.oglStackHandler.pushProjectionIdentity(gl);
gl.glOrtho(0d, dc.getView().getViewport().width, 0d, dc.getView().getViewport().height, -16d, 16d);
this.oglStackHandler.pushModelview(gl);
this.oglStackHandler.pushTexture(gl);
if (dc.isPickingMode())
{
this.pickSupport.beginPicking(dc);
// Set up to replace the non-transparent texture colors with the single pick color.
gl.glEnable(GL.GL_TEXTURE_2D);
gl.glTexEnvf(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_COMBINE);
gl.glTexEnvf(GL2.GL_TEXTURE_ENV, GL2.GL_SRC0_RGB, GL2.GL_PREVIOUS);
gl.glTexEnvf(GL2.GL_TEXTURE_ENV, GL2.GL_COMBINE_RGB, GL2.GL_REPLACE);
}
else
{
gl.glEnable(GL.GL_TEXTURE_2D);
gl.glEnable(GL.GL_BLEND);
gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
}
//Only calculate pitch / heading once **
heading = this.computeHeading(dc.getView());
pitch = this.computePitch(dc.getView());
}
示例4: render
import javax.media.opengl.GL2; //導入方法依賴的package包/類
@Override
public void render(final DrawContext dc) {
final GL2 gl = dc.getGL().getGL2();
gl.glEnable(GL.GL_DEPTH_TEST);
// gl.glDepthFunc(GL.GL_LEQUAL);
gl.glDepthMask(true);
// gl.glDepthMask(false);
// gl.glDepthRange(0.0, 1.0);
try {
dc.getView().pushReferenceCenter(dc, _placePoint); // draw relative to the place point
// Pull the arrow triangles forward just a bit to ensure they show over the terrain.
dc.pushProjectionOffest(0.995);
// final Color color = this.getAttributes().getTextColor();
// final Color color = Color.RED;
final Color color = _lineColor;
gl.glColor4ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue(), (byte) 0xff);
gl.glLineWidth(1.0f);
// gl.glEnable(GL.GL_LINE_SMOOTH);
// gl.glHint(GL.GL_LINE_SMOOTH_HINT, GL.GL_NICEST);
// gl.glHint(GL.GL_LINE_SMOOTH_HINT, GL.GL_DONT_CARE);
gl.glBegin(GL2.GL_LINE_STRIP);
{
gl.glVertex3d(Vec4.ZERO.x, Vec4.ZERO.y, Vec4.ZERO.z);
gl.glVertex3d(//
_terrainPoint.x - _placePoint.x,
_terrainPoint.y - _placePoint.y,
_terrainPoint.z - _placePoint.z);
}
gl.glEnd();
} finally {
dc.popProjectionOffest();
dc.getView().popReferenceCenter(dc);
}
}
示例5: drawLine_Line
import javax.media.opengl.GL2; //導入方法依賴的package包/類
private void drawLine_Line(final DrawContext dc, final Vec4 annotationPoint) {
// Compute a terrain point if needed.
Vec4 terrainPoint = null;
if (this.altitudeMode != WorldWind.CLAMP_TO_GROUND) {
terrainPoint = dc.computeTerrainPoint(position.getLatitude(), position.getLongitude(), 0);
}
if (terrainPoint == null) {
return;
}
final GL2 gl = dc.getGL().getGL2();
if ((!dc.isDeepPickingEnabled())) {
gl.glEnable(GL.GL_DEPTH_TEST);
}
gl.glDepthFunc(GL.GL_LEQUAL);
// gl.glDepthFunc(GL.GL_GREATER); // draw the part that is behind an intersecting surface
gl.glDepthMask(true);
// gl.glDepthMask(false);
gl.glDepthRange(0.0, 1.0);
try {
dc.getView().pushReferenceCenter(dc, annotationPoint); // draw relative to the place point
//
// !!! THIS CAUSES A stack overflow1283 because there are only 4 available stack entries !!!
//
//
// // Pull the arrow triangles forward just a bit to ensure they show over the terrain.
// dc.pushProjectionOffest(0.95);
final Color color = this.getAttributes().getTextColor();
gl.glColor4ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue(), (byte) 0xff);
gl.glLineWidth(1.5f);
gl.glHint(GL.GL_LINE_SMOOTH_HINT, Polyline.ANTIALIAS_FASTEST);
gl.glEnable(GL.GL_LINE_SMOOTH);
// System.out.println((UI.timeStampNano() + " [" + getClass().getSimpleName() + "] ")
// + ("\t" + dc.getFrameTimeStamp()));
// GLLogger.logDepth(dc, getClass().getSimpleName());
// TODO remove SYSTEM.OUT.PRINTLN
gl.glBegin(GL2.GL_LINE_STRIP);
{
gl.glVertex3d(Vec4.ZERO.x, Vec4.ZERO.y, Vec4.ZERO.z);
gl.glVertex3d(//
terrainPoint.x - annotationPoint.x,
terrainPoint.y - annotationPoint.y,
terrainPoint.z - annotationPoint.z);
}
gl.glEnd();
// GLLogger.logDepth(dc, "trackpt");
} finally {
// dc.popProjectionOffest();
dc.getView().popReferenceCenter(dc);
}
}