当前位置: 首页>>代码示例>>Java>>正文


Java GL2.glClear方法代码示例

本文整理汇总了Java中com.jogamp.opengl.GL2.glClear方法的典型用法代码示例。如果您正苦于以下问题:Java GL2.glClear方法的具体用法?Java GL2.glClear怎么用?Java GL2.glClear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jogamp.opengl.GL2的用法示例。


在下文中一共展示了GL2.glClear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: display

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void display(Graphics3D graphics) {
	view.update(0);

	AWTGraphics3D g = (AWTGraphics3D) graphics;
	GL2 gl = g.getGL().getGL2();

	gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
	gl.glClearColor(1f, 1f, 1f, 1);

	//Transform by Aim
	g.aimCamera(view.getAim());
	
	//Draw Scene
	g.setColor(Color.BLACK);
	g.drawGrid(1, 150, 150);
	
	g.setColor(Color.BLUE);
	cone.draw(g);
	g.setColor(Color.GREEN);
	cylinder.draw(g);

	gl.glFlush();
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:25,代码来源:ConeDrawing.java

示例2: 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, -5.0f); // translate into the screen
	gl.glScaled(2, 2, 2);
	gl.glRotated(angleY, 0, 1, 0);
	
	g.drawFrustrum(frustrum);
			
	//Draw Bunny Model
	bunny.draw(g);
	
	//Draw Bounding Box
	gl.glColor3f(0, 1, 1);
	renderOctree(g, octree);
			
	//Rotate Model
	if(rotate) {
		angleY += 1;
	}
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:26,代码来源:FrustrumRender.java

示例3: display

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void display(Graphics3D graphics) {
	AWTGraphics3D g = (AWTGraphics3D) graphics;
	GL2 gl = g.getGL2();
	
	if(wireFrame) {
		gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_LINE);
	} else {
		gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_FILL);
	}
	
	gl.glClear(GL2.GL_COLOR_BUFFER_BIT);
	//gl.glColor3f(1.0f, 1.0f, 0f);
	g.setColor(color);
	gl.glLoadIdentity();             /* clear the matrix */
	/* viewing transformation  */
	g.getGLU().gluLookAt(0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
	gl.glScalef(1.0f, 2.0f, 1.0f);      /* modeling transformation */ 
	g.drawCube(1.0);
	
	gl.glFlush();
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:23,代码来源:CubeExample.java

示例4: display

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void display(Graphics3D graphics) {
	AWTGraphics3D g = (AWTGraphics3D) graphics;
	GL2 gl = g.getGL2();
			
	if(wireFrame) {
		gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_LINE);
	} else {
		gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_FILL);
	}
	
	gl.glClear(GL2.GL_COLOR_BUFFER_BIT);
	//gl.glColor3f(1.0f, 1.0f, 0f);
	g.setColor(color);
	gl.glLoadIdentity();             /* clear the matrix */
	/* viewing transformation  */
	g.getGLU().gluLookAt(0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
	gl.glScalef(1.0f, 2.0f, 1.0f);      /* modeling transformation */
	g.drawCylinder(1, 2);
	
	gl.glFlush();
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:23,代码来源:CylinderExample.java

示例5: display

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void display(Graphics3D graphics) {
	AWTGraphics3D g = (AWTGraphics3D) graphics;
	GL2 gl = g.getGL2();
	
	if(wireFrame) {
		gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_LINE);
	} else {
		gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_FILL);
	}
	
	gl.glClear(GL2.GL_COLOR_BUFFER_BIT);
	//gl.glColor3f(1.0f, 1.0f, 0f);
	g.setColor(color);
	gl.glLoadIdentity();             /* clear the matrix */
	/* viewing transformation  */
	g.getGLU().gluLookAt(0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
	gl.glScalef(1.0f, 2.0f, 1.0f);      /* modeling transformation */ 
	g.drawSphere(1.0);
	
	gl.glFlush();
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:23,代码来源:SphereExample.java

示例6: annotate

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/** Annotates the output to show the probability of transmission as an overlying shading.
 *
 * @param drawable the drawable context.
 */
public void annotate (GLAutoDrawable drawable){
    if ( !isOverlayProbabilty() ){
        return;
    }
    if(isi==null) return; // don't annoate until this map of isi's exists
    GL2 gl = drawable.getGL().getGL2();
    gl.glPushMatrix();
    gl.glClearColor(0,0,0,0);
    gl.glClear(GL2.GL_COLOR_BUFFER_BIT);
    int sx = chip.getSizeX();
    int sy = chip.getSizeY();
    int st = chip.getNumCellTypes();
    float[] rgb = new float[ 3 ];
    for ( int x = 0 ; x < sx ; x++ ){
        for ( int y = 0 ; y < sy ; y++ ){
            for ( int t = 0 ; t < st ; t++ ){
                float v = probOfTransmission(isi[x][y][t],t);
                rgb[t] = v;
            }
            gl.glColor3fv(rgb,0);
            gl.glRectf(x,y,x + 1,y + 1);
        }
    }
    gl.glPopMatrix();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:30,代码来源:ProbFPNCorrectionFilter.java

示例7: display

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void display(Graphics3D graphics) {
	AWTGraphics3D g = (AWTGraphics3D) graphics;
	GL2 gl = g.getGL2();
	
	if(wireFrame) {
		gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_LINE);
	} else {
		gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_FILL);
	}
	
	angleY += 0.4;
	
	gl.glClear(GL2.GL_COLOR_BUFFER_BIT);
	//gl.glColor3f(1.0f, 1.0f, 0f);
	g.setColor(color);
	gl.glLoadIdentity();             /* clear the matrix */
	/* viewing transformation  */
	g.getGLU().gluLookAt(0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
	gl.glRotated(angleY, 0,1,0);
	gl.glScalef(1.0f, 2.0f, 1.0f);      /* modeling transformation */ 
	g.drawPyramid(1.0f);
	
	gl.glFlush();
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:26,代码来源:PyramidExample.java

示例8: display

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void display(Graphics3D graphics) {
    view.update(0);

    AWTGraphics3D g = (AWTGraphics3D) graphics;
    GL2 gl = g.getGL().getGL2();

    gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
    gl.glClearColor(1f, 1f, 1f, 1);

    //Transform by Aim
    g.aimCamera(view.getAim());

    //Draw Scene
    g.setColor(Color.BLACK);
    g.drawGrid(1, 150, 150);

    logo.renderWireframe(gl);

    gl.glFlush();
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:22,代码来源:LogoApplication.java

示例9: display

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
     * Called when the canvas is updated. To update the display, call either
     * <code>repaint()</code> or <code>display()</code>.
     *
     * @param drawable the Open GL context.
     */
    @Override
    public synchronized void display(GLAutoDrawable drawable) {

        GL2 gl = getGL().getGL2();
//        gl.getContext().makeCurrent();
        checkGLError(gl, "before display in ID");
        if (reshapePending) {
            reshapePending = false;
            reshape(drawable, 0, 0, getWidth(), getHeight());
        }
        try {
            gl.glClear(GL.GL_COLOR_BUFFER_BIT);
            displayPixmap(drawable);
            drawText(gl);
            gl.glFlush();
        } catch (GLException e) {
            log.warning(e.toString());
        }
        checkGLError(gl, "after setDefaultProjection in ID");
    }
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:27,代码来源:ImageDisplay.java

示例10: 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, -15.0f); // translate into the screen
    gl.glScaled(15, 15, 15);
    gl.glRotated(angleY, 0, 1, 0);

    //Draw Bunny Model
    bunny.draw(g);

    //Draw Bounding Box
    gl.glColor3f(0, 1, 1);
    //g.drawBoundingBox(bunnyVBO.getBoundingBox());
    renderOctree(g, octree);

    //Rotate Model
    if (rotate) {
        angleY += 1;
    }
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:25,代码来源:OctreeRender.java

示例11: display

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void display(Graphics3D graphics) {
	AWTGraphics3D g = (AWTGraphics3D) graphics;
	GL2 gl = g.getGL2();

	//TODO TEST
	gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
	gl.glClearColor(1f, 1f, 1f, 1);
			
	//Transform by Camera
	lookCamera(graphics);		

	//Draw Scene
	drawAxis(gl);

	drawFloor(gl);
	
	gl.glFlush();
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:20,代码来源:Ortographic.java

示例12: display

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void display(Graphics3D graphics) {
	AWTGraphics3D g = (AWTGraphics3D) graphics;
	GL2 gl = g.getGL().getGL2();

	//TODO TEST
	gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
	gl.glClearColor(1f, 1f, 1f, 1);
			
	//Transform by Aim
	g.aimCamera(view.getAim());

	//Draw Scene
	drawAxis(gl);

	drawFloor(gl);

	gl.glFlush();
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:20,代码来源:GridPerspective.java

示例13: display

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void display(Graphics3D graphics) {
    AWTGraphics3D g = (AWTGraphics3D) graphics;
    view.update(0);

    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.glClearColor(1f, 1f, 1f, 1);
    gl.glLoadIdentity();  // reset the model-view matrix

    //Transform by Aim
    g.aimCamera(view.getAim());

    g.setColor(Color.CYAN);

    updateAnimation();

    Joint root = motion.getArmature().getRoot();

    for (Joint js : root.getChildren()) {
        drawSkeleton(g, js);
    }
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:24,代码来源:AnimationApplication.java

示例14: 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();
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:16,代码来源:Example1.java

示例15: 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);
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:10,代码来源:RotateAroundExample.java


注:本文中的com.jogamp.opengl.GL2.glClear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。