本文整理汇总了Java中com.jogamp.opengl.GL2.glVertex3f方法的典型用法代码示例。如果您正苦于以下问题:Java GL2.glVertex3f方法的具体用法?Java GL2.glVertex3f怎么用?Java GL2.glVertex3f使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.opengl.GL2
的用法示例。
在下文中一共展示了GL2.glVertex3f方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawAxis
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
public static void drawAxis(GL2 gl, float axisSize) {
//Draw Axis
gl.glLineWidth(2.5f);
//Draw X Axis
gl.glColor3f(1, 0, 0);
gl.glBegin(GL.GL_LINES);
gl.glVertex3f(0, 0, 0);
gl.glVertex3f(axisSize, 0, 0);
gl.glEnd();
//Draw Y Axis
gl.glColor3f(0, 1, 0);
gl.glBegin(GL.GL_LINES);
gl.glVertex3f(0, 0, 0);
gl.glVertex3f(0, axisSize, 0);
gl.glEnd();
//Draw Z Axis
gl.glColor3f(0, 0, 1);
gl.glBegin(GL.GL_LINES);
gl.glVertex3f(0, 0, 0);
gl.glVertex3f(0, 0, axisSize);
gl.glEnd();
}
示例2: arrow
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void arrow(GL2 gl, float x,float y,float ux, float uy){
gl.glColor3f(1,1,1);
gl.glPointSize(5);
gl.glBegin(GL.GL_POINTS);
gl.glVertex3f(x,y,0);
gl.glEnd();
gl.glBegin(GL2.GL_LINES);
float ex=x+vectorLengthScale*MOTION_VECTOR_FACTOR*ux, ey=y+vectorLengthScale*MOTION_VECTOR_FACTOR*uy;
gl.glVertex2f(x,y);
gl.glVertex2f(ex,ey);
gl.glEnd();
}
示例3: 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();
}
示例4: glDrawPixels
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
* draws the buffered pixels onto GL canvas
*
* pixels still visible in the viewport but not part of the current frame
* are buffered internally and can be drawn onto the viewport (after a
* <code>glTransform</code> was performed) using this method. the value
* is scaled according to
*
* <pre>
* value = (pixel_value - offset) * gain
* </pre>
*
* @param gl drawable
* @param offset
* @param gain
*/
public synchronized void glDrawPixels(GL2 gl,float offset,float gain) {
int dx= -currentX();
int dy= -currentY();
for(OpticalFlowIntegrator.Pixel px : buffer) {
float v= gain*(px.getValue()-offset);
gl.glColor3f(v,v,v);
gl.glRectf(px.getX()+dx ,px.getY()+dy,
px.getX()+dx+1f,px.getY()+dy+1f);
}
gl.glColor3f(0f,1f,1f);
if (clipping) {
gl.glColor3f(1f,.5f,0f);
}
if (error) {
gl.glColor3f(1f,1f,0f);
}
gl.glLineWidth(2f);
gl.glBegin(GL.GL_LINE_LOOP);
gl.glVertex3f(x1+dx,y1+dy,0f);
gl.glVertex3f(x2+dx,y1+dy,0f);
gl.glVertex3f(x2+dx,y2+dy,0f);
gl.glVertex3f(x1+dx,y2+dy,0f);
gl.glEnd();
// draw graph traces
glDrawTraces(gl);
}
示例5: annotate
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
final GL2 gl = drawable.getGL().getGL2();
if(Xfinals.size()!=0){
// System.out.println("annotate");
//gl.glPushMatrix();
gl.glColor3f(0, 0, 1);
gl.glLineWidth(4);
for(int h=0;h<Xfinals.size(); h++){
for(int i=0;i<Xfinals.get(h).size(); i++){
//centerX[i]=Xfinals.get(i).get(0);
//System.out.println(centerX);
//centerY[i]=Xfinals.get(i).get(1);
//centerZ[i]=Xfinals.get(i).get(2);
gl.glBegin(GL.GL_LINE_LOOP);
//System.out.println(centerY);
gl.glVertex3f((Xfinals.get(h).get(i).get(0)-(radius/2))*scale, (Xfinals.get(h).get(i).get(1)-(radius/2))*scale, (Xfinals.get(h).get(i).get(2)-(radius/2))*scale);
gl.glVertex3f((Xfinals.get(h).get(i).get(0)+(radius/2))*scale, (Xfinals.get(h).get(i).get(1)-(radius/2))*scale, (Xfinals.get(h).get(i).get(2)-(radius/2))*scale);
gl.glVertex3f((Xfinals.get(h).get(i).get(0)-(radius/2))*scale, (Xfinals.get(h).get(i).get(1)+(radius/2))*scale, (Xfinals.get(h).get(i).get(2)-(radius/2))*scale);
gl.glVertex3f((Xfinals.get(h).get(i).get(0)+(radius/2))*scale, (Xfinals.get(h).get(i).get(1)+(radius/2))*scale, (Xfinals.get(h).get(i).get(2)+(radius/2))*scale);
gl.glVertex3f((Xfinals.get(h).get(i).get(0)-(radius/2))*scale, (Xfinals.get(h).get(i).get(1)-(radius/2))*scale, (Xfinals.get(h).get(i).get(2)+(radius/2))*scale);
gl.glVertex3f((Xfinals.get(h).get(i).get(0)+(radius/2))*scale, (Xfinals.get(h).get(i).get(1)-(radius/2))*scale, (Xfinals.get(h).get(i).get(2)+(radius/2))*scale);
gl.glEnd();
}
//gl.glPopMatrix();
}
}
}
示例6: 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.glTranslatef(0.0f, 0.0f, -6.0f); // translate into the screen
gl.glColor3f(1, 1, 1); //set the triangle color
gl.glBegin(GL.GL_TRIANGLES); // draw using triangles
gl.glVertex3f(0.0f, 1.0f, 0.0f);
gl.glVertex3f(-1.0f, -1.0f, 0.0f);
gl.glVertex3f(1.0f, -1.0f, 0.0f);
gl.glEnd();
}
示例7: glDrawTraces
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
protected void glDrawTraces(GL2 gl) {
if (!showTraces) {
return;
}
if (!broaderThanHigh) {
// highly unlikely; don't draw traces in this case
return;
}
gl.glPushMatrix();
// first move back to upper left corner
gl.glTranslatef(-(currentX()-x1), -(currentY()-y1), 0f);
// then move to the left to make place for the traces; also move
gl.glTranslatef( (-1.f *(drawableWidth-drawableHeight)*(y2-y1))/drawableHeight,
0f,0f);
int size= traces[0].SIZE;
// assume data range [-1..1]; indexed by sample [0..size]
gl.glScalef((1.7f*(x2-x1))/size, (y2-y1)/2f, 0);
// move to middle
gl.glTranslatef(0f,1f,0f);
// and finally use mathematical convention again
gl.glScalef(1f,-1f,1f);
// draw bounding box
gl.glColor3f(.3f,.3f,.3f);
gl.glLineWidth(2f);
gl.glBegin(GL.GL_LINE_LOOP);
gl.glVertex3f( 0f,-1f,0f);
gl.glVertex3f(size,-1f,0f);
gl.glVertex3f(size, 1f,0f);
gl.glVertex3f( 0f, 1f,0f);
gl.glEnd();
// draw graphs
for(GraphTrace g : traces) {
g.glDraw(gl);
}
gl.glPopMatrix();
}
示例8: drawHistogramBoxes
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
void drawHistogramBoxes(GL2 gl, int x, int y, float[] rgbValues){
float[] rgb=new float[3];
int histScale=chip.getMaxSize();
float g=getRenderer().getGrayValue();
gl.glPushMatrix();
{
gl.glTranslatef(x,y,0f); // centered on pixel
AEChipRenderer.ColorMode colorMode=((AEChipRenderer)getRenderer()).getColorMode();
if(colorMode==AEChipRenderer.ColorMode.RedGreen){
for(int i=0;i<3;i++){ // rgb components of hist
float c=rgbValues[i];
if(c==g) {
continue;
}
c*=histScale;
for(int j=0;j<3;j++){ rgb[j]=0;}
rgb[i]=1;
gl.glBegin(GL2.GL_QUADS);
gl.glColor3fv(rgb,0);
// draw squares for each RGB component offset in y direction
float y0=i/3f, y1=y0+0.3333f;
//top
gl.glVertex3f(0,y0,c);
gl.glVertex3f(1,y0,c);
gl.glVertex3f(1,y1,c);
gl.glVertex3f(0,y1,c);
gl.glEnd();
}
}else{
float h=rgbValues[0]*histScale;
for(int j=0;j<3;j++){ rgb[j]=1;}
gl.glBegin(GL2.GL_QUADS);
// draw squares for each RGB component offset in y direction
//CCW winding for all faces
//top
gl.glColor3fv(rgb,0);
gl.glVertex3f(0,0,h);
gl.glVertex3f(1,0,h);
gl.glVertex3f(1,1,h);
gl.glVertex3f(0,1,h);
// for(int j=0;j<3;j++){ rgb[j]=.5f;}
// gl.glColor3fv(rgb,0);
//
// //front
// gl.glVertex3f(0,0,0);
// gl.glVertex3f(1,0,0);
// gl.glVertex3f(1,0,h);
// gl.glVertex3f(0,0,h);
//
// //right
// gl.glVertex3f(1,0,0);
// gl.glVertex3f(1,1,0);
// gl.glVertex3f(1,1,h);
// gl.glVertex3f(1,0,h);
//
// //left
// gl.glVertex3f(0,0,0);
// gl.glVertex3f(0,0,h);
// gl.glVertex3f(0,1,h);
// gl.glVertex3f(0,1,0);
//
// //back
// gl.glVertex3f(0,1,0);
// gl.glVertex3f(0,1,h);
// gl.glVertex3f(1,1,h);
// gl.glVertex3f(1,1,0);
//
gl.glEnd();
}
}
gl.glPopMatrix();
}