本文整理汇总了Java中com.jogamp.opengl.GL2.glEnable方法的典型用法代码示例。如果您正苦于以下问题:Java GL2.glEnable方法的具体用法?Java GL2.glEnable怎么用?Java GL2.glEnable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.opengl.GL2
的用法示例。
在下文中一共展示了GL2.glEnable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void init(Graphics3D graphics) {
view = new FlyView(30, 3.6f, 0);
view.getAim().setAngleY(190);
AWTGraphics3D g = (AWTGraphics3D) graphics;
GL2 gl = g.getGL2(); // get the OpenGL graphics context
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // set background (clear) color
gl.glClearDepth(1.0f); // set clear depth value to farthest
gl.glEnable(GL.GL_DEPTH_TEST); // enables depth testing
gl.glDepthFunc(GL.GL_LEQUAL); // the type of depth test to do
gl.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); // best perspective correction
gl.glShadeModel(GL2.GL_SMOOTH); // blends colors nicely, and smoothes out lighting
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST);
gl.glTexEnvi(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_DECAL);
xAxis = new BoundingBox(new Vector3(0, -axisWidth/2, -axisWidth/2), new Vector3(axisSize, axisWidth/2, axisWidth/2));
yAxis = new BoundingBox(new Vector3(-axisWidth/2, 0, -axisWidth/2), new Vector3(axisWidth/2, axisSize, axisWidth/2));
zAxis = new BoundingBox(new Vector3(-axisWidth/2, -axisWidth/2, 0), new Vector3(axisWidth/2, axisWidth/2, axisSize));
}
示例2: annotate
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(final GLAutoDrawable drawable) {
if (!showHotPixels) {
return;
}
final GL2 gl = drawable.getGL().getGL2();
try {
gl.glEnable(GL.GL_BLEND);
gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
gl.glBlendEquation(GL.GL_FUNC_ADD);
}
catch (final GLException e) {
e.printStackTrace();
showHotPixels = false;
}
gl.glColor4f(.1f, .1f, 1f, .25f);
gl.glLineWidth(1f);
for (final HotPixel p : hotPixelSet) {
gl.glRectf(p.x - 1, p.y - 1, p.x + 2, p.y + 2);
}
}
示例3: init
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void init(Graphics3D graphics) {
//Init 3d Stuff
AWTGraphics3D g = (AWTGraphics3D) graphics;
GL2 gl = g.getGL2(); // get the OpenGL graphics context
gl.glClearColor(1.0f, 1.0f, 1.0f, 0.0f); // set background (clear) color
gl.glClearDepth(1.0f); // set clear depth value to farthest
gl.glEnable(GL.GL_DEPTH_TEST); // enables depth testing
gl.glDepthFunc(GL.GL_LEQUAL); // the type of depth test to do
gl.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); // best perspective correction
gl.glShadeModel(GL2.GL_SMOOTH); // blends colors nicely, and smoothes out lighting
//Load logo model
Model logoVBO = MeshLoader.getInstance().loadModel("logo/logo.obj");
logo = new ModelInstance(logoVBO);
loading = 100;
}
示例4: 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();
}
示例5: init
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void init(Graphics3D graphics) {
view = new FlyView(30, 3.6f, 0);
view.getAim().setAngleY(190);
AWTGraphics3D g = (AWTGraphics3D) graphics;
GL2 gl = g.getGL2(); // get the OpenGL graphics context
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // set background (clear) color
gl.glClearDepth(1.0f); // set clear depth value to farthest
gl.glEnable(GL.GL_DEPTH_TEST); // enables depth testing
gl.glDepthFunc(GL.GL_LEQUAL); // the type of depth test to do
gl.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); // best perspective correction
gl.glShadeModel(GL2.GL_SMOOTH); // blends colors nicely, and smoothes out lighting
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST);
gl.glTexEnvi(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_DECAL);
vAxis = new BoundingBox(new Vector3(-axisSize/8, -axisWidth/2, -axisSize/8), new Vector3(axisSize/8, axisWidth/2, axisSize/8));
hAxis = new BoundingBox(new Vector3(-axisSize/8, -axisSize/8, -axisWidth/2), new Vector3(axisSize/8, axisSize/8, axisWidth/2));
}
示例6: init
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void init(Graphics3D graphics) {
AWTGraphics3D g = (AWTGraphics3D) graphics;
view = new FlyView(0, 3.6f, -10);
view.getAim().setAngleY(180);
cone = new Cone(6, 6, 3);
cylinder = new Cylinder(6, 6, 3);
cylinder.transform.translate(8, 0, 0);
GL2 gl = g.getGL2(); // get the OpenGL graphics context
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // set background (clear) color
gl.glClearDepth(1.0f); // set clear depth value to farthest
gl.glEnable(GL.GL_DEPTH_TEST); // enables depth testing
gl.glDepthFunc(GL.GL_LEQUAL); // the type of depth test to do
gl.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); // best perspective correction
gl.glShadeModel(GL2.GL_SMOOTH); // blends colors nicely, and smoothes out lighting
}
示例7: 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;
}
}
示例8: drawMotionVector
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
* Plots a single motion vector which is the number of pixels per second
* times scaling. Color vectors by angle to x-axis.
*
* @param gl the OpenGL context
* @param e the event
*/
protected void drawMotionVector(GL2 gl, MotionOrientationEventInterface e) {
float[] rgb = null;
if (useColorForMotionVectors) {
rgb = motionColor(e);
} else {
rgb = new float[]{0, 0, 1};
}
gl.glColor3fv(rgb, 0);
float scale = ppsScale;
if (ppsScaleDisplayRelativeOFLength && displayGlobalMotion) {
scale = 100 * ppsScale / motionFlowStatistics.getGlobalMotion().meanGlobalSpeed;
}
if (displayVectorsEnabled) {
gl.glPushMatrix();
gl.glLineWidth(motionVectorLineWidthPixels);
// start arrow from event
// DrawGL.drawVector(gl, e.getX() + .5f, e.getY() + .5f, e.getVelocity().x, e.getVelocity().y, motionVectorLineWidthPixels, ppsScale);
// center arrow on location, rather that start from event location
float dx, dy;
dx = e.getVelocity().x * scale;
dy = e.getVelocity().y * scale;
if (displayVectorsAsUnitVectors) {
float s = 100 * scale / (float) Math.sqrt(dx * dx + dy * dy);
dx *= s;
dy *= s;
}
float x0 = e.getX() - (dx / 2) + .5f, y0 = e.getY() - (dy / 2) + .5f;
DrawGL.drawVector(gl, x0, y0, dx, dy, motionVectorLineWidthPixels, 1);
gl.glPopMatrix();
}
if (displayVectorsAsColorDots) {
gl.glPointSize(motionVectorLineWidthPixels * 5);
gl.glEnable(GL2.GL_POINT_SMOOTH);
gl.glBegin(GL.GL_POINTS);
gl.glVertex2f(e.getX(), e.getY());
gl.glEnd();
}
}
示例9: 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;
}
}
示例10: draw
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
public void draw(GL2 gl) {
if (rgba == null) {
return;
}
float maxActivation = 0;
int maxActivatedUnit = -1;
for (int i = 0; i < rgba.length; i++) {
if (rgba[i] > maxActivation) {
maxActivation = rgba[i];
maxActivatedUnit = i;
}
}
if (maxActivation < decisionThreshold) {
return;
}
final int dt = lastTimestampUs - lastDecisionTimestampUs;
if (dt < 0 || (dt) >>> 10 >= getDecisionLifetimeMs()) {
return;
}
try {
gl.glEnable(GL2.GL_BLEND);
gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_CONSTANT_ALPHA);
gl.glBlendEquation(GL2.GL_FUNC_ADD); // use additive color here to just brighten the pixels already there
gl.glBlendColor(1, 1, 1, 1);
} catch (final GLException e) {
e.printStackTrace();
}
gl.glColor4fv(rgba, 0);
gl.glRectf(xLeft, yBot, xRight < chip.getSizeX() ? xRight : chip.getSizeX(), yTop < chip.getSizeY() ? yTop : chip.getSizeY());
if (roiLastUpdated == this) {
// mark it
gl.glColor4f(1, 1, 1, 0.25f);
gl.glPushMatrix();
DrawGL.drawBox(gl, xCenter, yCenter, getWidth() << scale, getHeight() << scale, 0);
gl.glPopMatrix();
}
}
示例11: 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;
}
}
示例12: preDisplay
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void preDisplay(Graphics3D graphics) {
AWTGraphics3D g = (AWTGraphics3D) graphics;
GL2 gl = g.getGL2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
gl.glClearColor(1f, 1f, 1f, 1);
gl.glEnable(GL.GL_DEPTH_TEST);
}
示例13: init
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void init(Graphics3D graphics) {
AWTGraphics3D g = (AWTGraphics3D) graphics;
view = new FlyView(30, 1.6f, 0);
view.getAim().setAngleY(160);
GL2 gl = g.getGL2(); // get the OpenGL graphics context
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // set background (clear) color
gl.glClearDepth(1.0f); // set clear depth value to farthest
gl.glEnable(GL.GL_DEPTH_TEST); // enables depth testing
gl.glDepthFunc(GL.GL_LEQUAL); // the type of depth test to do
gl.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); // best perspective correction
gl.glShadeModel(GL2.GL_SMOOTH); // blends colors nicely, and smoothes out lighting
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST);
gl.glTexEnvi(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_DECAL);
cubes = new ArrayList<OrientedBoundingBox>();
cubes.add(new OrientedBoundingBox(1).translate(20, 1, 7));
cubes.add(new OrientedBoundingBox(1).translate(22, 1, 7));
cubes.add(new OrientedBoundingBox(1).translate(24, 1, 7));
cubes.add(new OrientedBoundingBox(1).translate(26, 1, 7));
cubes.add(new OrientedBoundingBox(1).translate(28, 1, 7));
cubes.add(new OrientedBoundingBox(1).translate(30, 1, 7));
cubes.add(new OrientedBoundingBox(1).translate(32, 1, 7));
}
示例14: init
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void init(Graphics3D graphics) {
AWTGraphics3D g = (AWTGraphics3D) graphics;
GL2 gl = g.getGL2(); // get the OpenGL graphics context
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // set background (clear) color
gl.glClearDepth(1.0f); // set clear depth value to farthest
gl.glEnable(GL.GL_DEPTH_TEST); // enables depth testing
gl.glDepthFunc(GL.GL_LEQUAL); // the type of depth test to do
gl.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); // best perspective correction
gl.glShadeModel(GL2.GL_SMOOTH); // blends colors nicely, and smoothes out lighting
//Load bunny model
bunnyVBO = MeshLoader.getInstance().loadModel("bunny.obj");
bunny = new ModelInstance(bunnyVBO);
bunny.setColor(Color.GHOST_WHITE);
octree = new VolumeOctree<Face>(bunnyVBO.getBoundingBox());
for (Face face : bunnyVBO.getFaces()) {
Point3D centroid = bunnyVBO.centroid(face);
octree.add(centroid, face);
}
clippingBox = new BoundingBox3D(bunnyVBO.getBoundingBox());
clippingBox.getMinPoint().offsetX(-0.1);
clippingBox.getMaxPoint().offsetX(-0.1);
intersectedFaces = octree.getData(clippingBox);
System.out.println("Size: " + bunnyVBO.getFaces().size());
System.out.println("Size: " + intersectedFaces.size());
loading = 100;
}
示例15: 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);
}