本文整理汇总了Java中com.jogamp.opengl.GL2.glDisable方法的典型用法代码示例。如果您正苦于以下问题:Java GL2.glDisable方法的具体用法?Java GL2.glDisable怎么用?Java GL2.glDisable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.opengl.GL2
的用法示例。
在下文中一共展示了GL2.glDisable方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawPolygon
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void drawPolygon(final GL2 gl, final int xLowerLeft, final int yLowerLeft, final int width, final int height) {
gl.glPushMatrix();
gl.glDisable(GL.GL_DEPTH_TEST);
gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
gl.glEnable(GL.GL_BLEND);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL2.GL_CLAMP);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL2.GL_CLAMP);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST);
final double xRatio = (double) chip.getSizeX() / (double) width;
final double yRatio = (double) chip.getSizeY() / (double) height;
gl.glBegin(GL2.GL_POLYGON);
gl.glTexCoord2d(0, 0);
gl.glVertex2d(xLowerLeft, yLowerLeft);
gl.glTexCoord2d(xRatio, 0);
gl.glVertex2d(xRatio * width + xLowerLeft, yLowerLeft);
gl.glTexCoord2d(xRatio, yRatio);
gl.glVertex2d(xRatio * width + xLowerLeft, yRatio * height + yLowerLeft);
gl.glTexCoord2d(0, yRatio);
gl.glVertex2d(+xLowerLeft, yRatio * height + yLowerLeft);
gl.glEnd();
gl.glPopMatrix();
}
示例2: checkBlend
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/** Convenience method to check if blending in OpenGL is available, and if so, to turn it on.
*
* @param gl the GL2 context
*/
protected void checkBlend(GL2 gl) {
if (!hasBlendChecked) {
hasBlendChecked = true;
String glExt = gl.glGetString(GL.GL_EXTENSIONS);
if (glExt.indexOf("GL_EXT_blend_color") != -1) {
hasBlend = true;
}
}
if (hasBlend) {
try {
gl.glEnable(GL.GL_BLEND);
gl.glBlendFunc(GL.GL_ONE, GL.GL_ONE);
gl.glBlendEquation(GL.GL_FUNC_ADD);
} catch (GLException e) {
log.warning("tried to use glBlend which is supposed to be available but got following exception");
gl.glDisable(GL.GL_BLEND);
e.printStackTrace();
hasBlend = false;
}
}
}
示例3: display
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void display(Graphics3D graphics) {
AWTGraphics3D g = (AWTGraphics3D) graphics;
GL2 gl = g.getGL2(); // get the OpenGL 2 graphics context
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); // clear color and depth buffers
gl.glLoadIdentity(); // reset the model-view matrix
gl.glClearColor(1f,1f,1f,1f);
g.setColor(Color.WHITE);
gl.glTranslatef(0.0f, 0.0f, -15.0f); // translate into the screen
//gl.glScaled(150, 150, 150);
gl.glRotated(angleY, 0, 1, 0);
//Draw Models
//Start batch
gl.glEnable(GL.GL_DEPTH_TEST);
gl.glPushMatrix();
stone.renderTextured(gl);
gl.glPopMatrix();
gl.glPushMatrix();
gl.glDisable(GL.GL_CULL_FACE);
gl.glEnable(GL.GL_BLEND);
gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
tree.renderTextured(gl);
gl.glPopMatrix();
//End batch
gl.glDisable(GL.GL_DEPTH_TEST);
//Rotate Models
if(rotate) {
angleY += 1;
}
}
示例4: stencil
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
* Renders the body using the stencil buffer to show multi-fixutre bodies
* as one body.
*
* @param gl the OpenGL files
*/
public void stencil(GL2 gl) {
// clear the stencil
gl.glClear(GL.GL_STENCIL_BUFFER_BIT);
// disable color
gl.glColorMask(false, false, false, false);
// enable stencil testing
gl.glEnable(GL.GL_STENCIL_TEST);
// fill the body into the stencil buffer
gl.glStencilFunc(GL.GL_ALWAYS, 1, -1);
gl.glStencilOp(GL.GL_KEEP, GL.GL_KEEP, GL.GL_REPLACE);
this.fill(gl);
// draw the body into the stencil buffer only keeping the
// overlapping portions
gl.glStencilFunc(GL.GL_NOTEQUAL, 1, -1);
gl.glStencilOp(GL.GL_KEEP, GL.GL_KEEP, GL.GL_REPLACE);
// set the line width so we dont have to render the body 4 times
float lw = RenderUtilities.setLineWidth(gl, 3.0f);
// enable color to draw the outline
gl.glColorMask(true, true, true, true);
this.setOutlineColor(gl);
this.draw(gl);
gl.glLineWidth(lw);
// disable the stencil test
gl.glDisable(GL.GL_STENCIL_TEST);
// fill the body
this.setFillColor(gl);
this.fill(gl);
}
示例5: enableCullFace
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
void enableCullFace(GL2 gl, boolean enabled){
if (enabled != cullFace){
if (enabled){
gl.glEnable(GL2.GL_CULL_FACE);
}else{
gl.glDisable(GL2.GL_CULL_FACE);
}
cullFace = enabled;
}
}
示例6: enableDepthTest
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
void enableDepthTest(GL2 gl, boolean enabled){
if (enabled != depthTest){
if (enabled){
gl.glEnable(GL2.GL_DEPTH_TEST);
}else{
gl.glDisable(GL2.GL_DEPTH_TEST);
}
depthTest = enabled;
}
}
示例7: enableBlend
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
void enableBlend(GL2 gl, boolean enabled){
if (enabled != blend){
if (enabled){
gl.glEnable(GL2.GL_BLEND);
gl.glBlendFunc (GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);
}else{
gl.glDisable(GL2.GL_BLEND);
}
blend = enabled;
}
}
示例8: enableTexture2D
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
void enableTexture2D(GL2 gl, boolean enabled){
if (enabled != texture2d){
if (enabled){
gl.glEnable(GL2.GL_TEXTURE_2D);
}else{
gl.glDisable(GL2.GL_TEXTURE_2D);
}
texture2d = enabled;
}
}
示例9: enableTexture3D
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
void enableTexture3D(GL2 gl, boolean enabled){
if (enabled != texture3d){
if (enabled){
gl.glEnable(GL2.GL_TEXTURE_3D);
}else{
gl.glDisable(GL2.GL_TEXTURE_3D);
}
texture3d = enabled;
}
}