本文整理汇总了Java中com.jogamp.opengl.GL2.glEnd方法的典型用法代码示例。如果您正苦于以下问题:Java GL2.glEnd方法的具体用法?Java GL2.glEnd怎么用?Java GL2.glEnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.opengl.GL2
的用法示例。
在下文中一共展示了GL2.glEnd方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void render(Graphics3D graphics) {
AWTGraphics3D g = (AWTGraphics3D) graphics;
// Get the OpenGL graphics context
GL2 gl = g.getGL2();
// Clear the color and the depth buffers
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
// Reset the view (x, y, z axes back to normal)
gl.glLoadIdentity();
gl.glTranslatef(0.0f, 0.0f, -6.0f); // translate into the screen
// Draw a triangle
float sin = (float)Math.sin(angle);
float cos = (float)Math.cos(angle);
gl.glBegin(GL.GL_TRIANGLES);
gl.glColor3f(1.0f, 0.0f, 0.0f); // Red
gl.glVertex2d(-cos, -cos);
gl.glColor3f(0.0f, 1.0f, 0.0f); // Green
gl.glVertex2d(0.0f, cos);
gl.glColor3f(0.0f, 0.0f, 1.0f); // Blue
gl.glVertex2d(sin, -sin);
gl.glEnd();
}
示例2: drawSelection
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void drawSelection(GL2 gl, Rectangle r, float[] c) {
if (r == null) {
return;
}
gl.glPushMatrix();
gl.glColor3fv(c, 0);
gl.glLineWidth(lineWidth);
gl.glTranslatef(-.5f, -.5f, 0);
gl.glBegin(GL.GL_LINE_LOOP);
gl.glVertex2f(selection.x, selection.y);
gl.glVertex2f(selection.x + selection.width, selection.y);
gl.glVertex2f(selection.x + selection.width, selection.y + selection.height);
gl.glVertex2f(selection.x, selection.y + selection.height);
gl.glEnd();
gl.glPopMatrix();
}
示例3: annotate
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
gl.glColor3f(0, 1, 1);
gl.glLineWidth(5f);
gl.glBegin(GL.GL_LINES);
for (int n = 0; n < numberOfLinesInUse; n++) {
gl.glVertex2d((sx2 * (lsx[n] + 1)), (sy2 * (lsy[n] + 1)));
gl.glVertex2d((sx2 * (lex[n] + 1)), (sy2 * (ley[n] + 1)));
// g.drawLine((int) (sx2 * (gsx + 1) * 4), (int) (sy2 * (gsy + 1) * 4), (int) (sx2 * (gex + 1) * 4), (int) (sy2 * (gey + 1) * 4));
}
gl.glEnd();
// show matrix
MultilineAnnotationTextRenderer.resetToYPositionPixels(chip.getSizeY());
StringBuilder sb = new StringBuilder("PigTracker\n");
sb.append(String.format("# lines = %d\nm=\n", numberOfLinesInUse));
sb.append(String.format("%6.3f %6.3f %6.3f\n", cm[0], cm[1], cm[2]));
sb.append(String.format("%6.3f %6.3f %6.3f\n", cm[3], cm[4], cm[5]));
sb.append(String.format("%6.3f %6.3f %6.3f\n", cm[6], cm[7], cm[8]));
MultilineAnnotationTextRenderer.renderMultilineString(sb.toString());
}
示例4: draw
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
synchronized void draw(GL2 gl) {
gl.glPushAttrib(GL2.GL_ENABLE_BIT);
gl.glLineStipple(1, (short) 0x7777);
gl.glLineWidth(9);
gl.glColor4f(0, 1, 1, .9f);
// textRenderer.begin3DRendering();
// textRenderer.draw3D("laser line", 5, 5, 0, textScale);
// textRenderer.end3DRendering();
gl.glEnable(GL2.GL_LINE_STIPPLE);
gl.glBegin(GL.GL_LINE_STRIP);
for (int i = 0; i < mapSizeX; i++) {
if (!ys[i].isNaN()) { // skip over columns without valid score
gl.glVertex2f(i, ys[i]);
} else { // interrupt lines at NaN
gl.glEnd();
gl.glBegin(GL.GL_LINE_STRIP);
}
}
gl.glEnd();
gl.glPopAttrib();
}
示例5: drawPlayerInfo
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
public void drawPlayerInfo(GL2 gl)
{
gl.glBegin(GL2.GL_QUADS);
gl.glColor4d(0.75, 0.25, 0.25, 0.5);
gl.glNormal3d(0, 0, 1);
gl.glVertex3d(-1, 1, 0.5);
gl.glVertex3d(-1, 0.95, 0.5);
gl.glVertex3d((inst.player.life - 5.0)/5.0 , 0.95, 0.5);
gl.glVertex3d((inst.player.life - 5.0)/5.0 , 1, 0.5);
gl.glEnd();
{
java.awt.Point pos = inst.canvas.getMousePosition();
if(pos != null)
{
gl.glBegin(GL2.GL_POINTS);
gl.glColor3d(Math.random(), Math.random(), Math.random());
Vector pos2 = inst.translateToReal(pos.x, pos.y);
gl.glVertex2d(pos.x, pos.y);
gl.glEnd();
}
}
}
示例6: annotate
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
* JOGL annotation
*/
@Override
public void annotate(GLAutoDrawable drawable) {
if (!isFilterEnabled()) {
return;
}
Point2D p = medianPoint;
Point2D s = stdPoint;
GL2 gl = drawable.getGL().getGL2();
// already in chip pixel context with LL corner =0,0
gl.glPushMatrix();
gl.glColor3f(0, 0, 1);
gl.glLineWidth(4);
gl.glBegin(GL2.GL_LINE_LOOP);
gl.glVertex2d(p.getX() - s.getX(), p.getY() - s.getY());
gl.glVertex2d(p.getX() + s.getX(), p.getY() - s.getY());
gl.glVertex2d(p.getX() + s.getX(), p.getY() + s.getY());
gl.glVertex2d(p.getX() - s.getX(), p.getY() + s.getY());
gl.glEnd();
gl.glBegin(GL2.GL_LINES);
gl.glVertex2d(p.getX() - 10, p.getY());
gl.glVertex2d(p.getX() + 10, p.getY());
gl.glVertex2d(p.getX(), p.getY() - 10);
gl.glVertex2d(p.getX(), p.getY() + 10);
gl.glEnd();
gl.glPopMatrix();
}
示例7: drawSelectionRectangle
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
* draws selectionRectangle rectangle on annotation
*
* @param gl GL context
* @param r the rectangle
* @param c the 3 vector RGB color to draw rectangle
*/
private void drawSelectionRectangle(GL2 gl, Rectangle r, float[] c) {
gl.glPushMatrix();
gl.glColor3fv(c, 0);
gl.glLineWidth(lineWidth);
gl.glTranslatef(-.5f, -.5f, 0);
gl.glBegin(GL.GL_LINE_LOOP);
gl.glVertex2f(getSelectionRectangle().x, getSelectionRectangle().y);
gl.glVertex2f(getSelectionRectangle().x + getSelectionRectangle().width, getSelectionRectangle().y);
gl.glVertex2f(getSelectionRectangle().x + getSelectionRectangle().width, getSelectionRectangle().y + getSelectionRectangle().height);
gl.glVertex2f(getSelectionRectangle().x, getSelectionRectangle().y + getSelectionRectangle().height);
gl.glEnd();
gl.glPopMatrix();
}
示例8: draw
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void draw(GL2 gl) {
gl.glColor3f(0, 0, 1);
gl.glLineWidth(2f);
gl.glBegin(GL.GL_LINE_LOOP);
gl.glVertex2i(x, y);
gl.glVertex2i(x + width, y);
gl.glVertex2i(x + width, y + height);
gl.glVertex2i(x, y + height);
gl.glEnd();
}
示例9: draw
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
public void draw(GLAutoDrawable drawable){
GL2 gl=drawable.getGL().getGL2();
gl.glLineWidth(2.0f);
if(type == 1){
gl.glColor3f(0.9f,0.9f,0.9f);
}else{
gl.glColor3f(0.1f,0.1f,0.1f);
}
//gl.glColor3f(clusterColors[idx][0],clusterColors[idx][1],clusterColors[idx][2]);
gl.glBegin(GL2.GL_LINES);
//System.out.println("Frag "+idx+", Distance: "+getDistance(p1, p2)+", Max: "+minDist);
gl.glVertex2f(line.x1,line.y1);
gl.glVertex2f(line.x2,line.y2);
gl.glEnd();
}
示例10: drawBox
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
*
* @param gl
* @param x
* @param y
* @param radius
*/
protected void drawBox (GL2 gl,int x,int y,int radius){
gl.glPushMatrix();
gl.glTranslatef(x,y,0);
gl.glBegin(GL.GL_LINE_LOOP);
{
gl.glVertex2i(-radius,-radius);
gl.glVertex2i(+radius,-radius);
gl.glVertex2i(+radius,+radius);
gl.glVertex2i(-radius,+radius);
}
gl.glEnd();
gl.glPopMatrix();
}
示例11: glAnnotate
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/** Shows the transform on top of the rendered events.
*
* @param gl the OpenGL context.
*/
private void glAnnotate(GL2 gl) {
// this whole annotation is translated by the enclosing filter SceneStabilizer so that
// clusters appear on top of tracked features.
int sx2 = chip.getSizeX() / 2, sy2 = chip.getSizeY() / 2;
// draw translation
gl.glPushMatrix();
gl.glTranslatef(-translation.x + sx2, -translation.y + sy2, 0);
gl.glRotatef((float) ((-rotationAngle * 180) / Math.PI), 0, 0, 1);
// gl.glTranslatef(sx2, sy2, 0);
// draw translation
gl.glLineWidth(2f);
gl.glColor3f(0, 1, 1);
gl.glBegin(GL.GL_LINES);
gl.glVertex2f(-sx2, 0);
gl.glVertex2f(sx2, 0);
gl.glVertex2f(0, -sy2);
gl.glVertex2f(0, sy2);
gl.glEnd();
gl.glPopMatrix();
if (isUseVelocity()) {
gl.glBegin(GL.GL_LINES);
float x = (velocityPPt.x / 10) + sx2, y = (velocityPPt.y / 10) + sy2;
gl.glVertex2f(sx2, sy2);
gl.glVertex2f(x, y);
gl.glEnd();
}
}
示例12: draw
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void draw(GLAutoDrawable drawable, GL2 gl, float linewidth) {
// if (getTargetLocation() != null && getTargetLocation().location == null) {
// textRenderer.beginRendering(drawable.getSurfaceWidth(), drawable.getSurfaceHeight());
// textRenderer.draw("Target not visible", chip.getSizeX() / 2, chip.getSizeY() / 2);
// textRenderer.endRendering();
// return;
// }
gl.glPushMatrix();
gl.glTranslatef(location.x, location.y, 0f);
float[] compArray = new float[4];
gl.glColor3fv(targetTypeColors[targetClassID % targetTypeColors.length].getColorComponents(compArray), 0);
// gl.glColor4f(0, 1, 0, .5f);
gl.glLineWidth(linewidth);
gl.glBegin(GL.GL_LINE_LOOP);
gl.glVertex2f(-width / 2, -height / 2);
gl.glVertex2f(+width / 2, -height / 2);
gl.glVertex2f(+width / 2, +height / 2);
gl.glVertex2f(-width / 2, +height / 2);
gl.glEnd();
// if (mouseQuad == null) {
// mouseQuad = glu.gluNewQuadric();
// }
// glu.gluQuadricDrawStyle(mouseQuad, GLU.GLU_LINE);
// //glu.gluDisk(mouseQuad, getTargetRadius(), getTargetRadius(), 32, 1);
// int maxDim = Math.max(width, height);
// glu.gluDisk(mouseQuad, maxDim / 2, (maxDim / 2) + 0.1, 32, 1);
//getTargetRadius(), getTargetRadius() + 1, 32, 1);
gl.glPopMatrix();
}
示例13: annotate
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
* Annotation or drawing method
* @param drawable OpenGL Rendering Object
*/
@Override
public void annotate (GLAutoDrawable drawable) {
if (!isAnnotationEnabled()) {
return;
}
GL2 gl = drawable.getGL().getGL2();
if (gl == null) {
return;
}
// Draw Box around groups
for (int gx=0; gx<numGroupsX; gx++) {
for (int gy=0; gy<numGroupsY; gy++) {
gl.glPushMatrix();
gl.glLineWidth(1f);
gl.glBegin(GL.GL_LINE_LOOP);
gl.glColor3f(1f,0.1f,0.1f);
gl.glVertex2f(xGroupOffset*gx,yGroupOffset*gy);
gl.glVertex2f(xPixels + (xGroupOffset*gx),yGroupOffset*gy);
gl.glVertex2f(xPixels + (xGroupOffset*gx),yPixels + (yGroupOffset*gy));
gl.glVertex2f(xGroupOffset*gx,yPixels + (yGroupOffset*gy));
gl.glEnd();
gl.glPopMatrix();
} // END IF
} // END IF
}
示例14: drawTile
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void drawTile(GL2 gl, double x, double y, double tileSize, Texture texture) {
texture.enable(gl);
texture.bind(gl);
gl.glBegin(GL2.GL_QUADS);
//(0,0)
gl.glTexCoord2d(0, 0);
gl.glVertex3d(x*tileSize-tileSize/2, 0, y*tileSize-tileSize/2);
//(1,0)
gl.glTexCoord2d(1, 0);
gl.glVertex3d(x*tileSize-tileSize/2+tileSize, 0, y*tileSize-tileSize/2);
//(1,1)
gl.glTexCoord2d(1, 1);
gl.glVertex3d(x*tileSize+tileSize-tileSize/2, 0, y*tileSize+tileSize-tileSize/2);
//(0,1)
gl.glTexCoord2d(0, 1);
gl.glVertex3d(x*tileSize-tileSize/2, 0, y*tileSize+tileSize-tileSize/2);
gl.glEnd();
texture.disable(gl);
}
示例15: glDraw
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
* for efficiency, drawing directly performed in this method; make
* sure an appropriate matrix was defined before (will draw onto
* <code>(0,0)-(SIZE,max(data))</code>
*
* @param GL JOGL drawable
*/
public void glDraw(GL2 gl) {
gl.glColor3f(r,g,b);
gl.glLineWidth(1f);
gl.glBegin(GL.GL_LINE_STRIP);
int j;
for(j=0; j<SIZE; j++) {
gl.glVertex3f(j,data[(i+j)%SIZE],0f);
}
gl.glEnd();
}