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


Java GL2.glClearColor方法代码示例

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


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

示例1: init

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void init(GLAutoDrawable drawable) {

	System.out.println("init");

	GL2 gl = getGL().getGL2();

	gl.setSwapInterval(1);
	gl.glShadeModel(GLLightingFunc.GL_FLAT);

	gl.glClearColor(0, 0, 0, 0f);
	gl.glClear(GL.GL_COLOR_BUFFER_BIT);
	gl.glLoadIdentity();

	gl.glRasterPos3f(0, 0, 0);
	gl.glColor3f(1, 1, 1);
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:18,代码来源:RaceDisplay.java

示例2: init

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void init(Graphics3D 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);
	
	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
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:20,代码来源:ConeDrawing.java

示例3: 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);

    for (Bone bone : motion.getArmature().getBones()) {
        g.drawLine(bone.getOrigin().getPosition(), bone.getDestination().getPosition());
        g.drawSphere(bone.getOrigin().getPosition(), 0.1);
    }
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:21,代码来源:AnimationJustLoadApplication.java

示例4: 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);
    }

    loading = 100;
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:27,代码来源:OctreeRender.java

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

示例6: display

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

	updateControls(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(aim);

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

示例7: 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(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
	Model bunnyVBO = MeshLoader.getInstance().loadModel("bunny.obj");
	bunny = new ModelInstance(bunnyVBO);
	bunny.setColor(Color.GHOST_WHITE);
	
	loading = 100;
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:21,代码来源:SimpleMeshExample.java

示例8: 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

    view = new UEView(-28, 8, 0);
    view.getAim().rotate(Vector3.Y, 90);

    //Load motion
    //String path = "02_01.bvh";
    String path = "anim.bvh";
    motion = AnimationLoader.getInstance().loadMotion(path);

    startAnimation = System.currentTimeMillis();
    loading = 100;
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:24,代码来源:AnimationApplication.java

示例9: 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

    view = new UEView(-10, 0, 0);
    view.getAim().rotate(Vector3.Y, 90);

    //Load motion
    motion = AnimationLoader.getInstance().loadMotion("anim.bvh");

    loading = 100;
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:21,代码来源:AnimationJustLoadApplication.java

示例10: 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
	
	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);
	
	//Load models
	stone = new ModelInstance(MeshLoader.getInstance().loadModel("stone/stone.obj"));
	stone.setColor(Color.WHITE);
	stone.offsetX(-2);
	stone.offsetY(0.5f);
	stone.setScale(0.5f);
	
	tree = new ModelInstance(MeshLoader.getInstance().loadModel("bamboo/bamboo.obj"));
	tree.setColor(Color.WHITE);
	tree.setScale(1.5f);
	
	loading = 100;
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:30,代码来源:MeshExample.java

示例11: init

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void init(final GLAutoDrawable drawable) {
    // drawable.setGL(new DebugGL(drawable.getGL()));
    drawable.setAutoSwapBufferMode(true);
    final GL2 gl = drawable.getGL().getGL2();

    log.info("OpenGL implementation is: " + gl.getClass().getName() + "\nGL_VENDOR: "
            + gl.glGetString(GL.GL_VENDOR) + "\nGL_RENDERER: " + gl.glGetString(GL.GL_RENDERER) + "\nGL_VERSION: "
            + gl.glGetString(GL.GL_VERSION) // + "\nGL_EXTENSIONS: " + gl.glGetString(GL.GL_EXTENSIONS)
    );
    final float glVersion = Float.parseFloat(gl.glGetString(GL.GL_VERSION).substring(0, 3));
    if (glVersion < 1.3f) {
        log.warning("\n\n*******************\nOpenGL version "
                + glVersion
                + " < 1.3, some features may not work and program may crash\nTry switching from 16 to 32 bit color if you have decent graphics card\n\n");
    }
    // System.out.println("GLU_EXTENSIONS: "+glu.gluGetString(GLU.GLU_EXTENSIONS));

    gl.setSwapInterval(1);
    gl.glShadeModel(GLLightingFunc.GL_FLAT);

    gl.glClearColor(0, 0, 0, 0f);
    gl.glClear(GL.GL_COLOR_BUFFER_BIT);
    gl.glLoadIdentity();

    gl.glRasterPos3f(0, 0, 0);
    gl.glColor3f(1, 1, 1);
    glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18, "Initialized display");
    checkGLError(gl, glu, "after init");

}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:32,代码来源:ChipCanvas.java

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

示例13: preDisplay

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

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

    g.setColor(Color.YELLOW);
    g.fillRect(10, 10, w, 60);
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:12,代码来源:CollisionApplication.java

示例14: preDisplay

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

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

	g.setColor(Color.YELLOW);
	g.fillRect(10, 10, w, 60);
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:12,代码来源:BillboardExample.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.glClearColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。