本文整理汇总了Java中com.jogamp.opengl.GL2.glShadeModel方法的典型用法代码示例。如果您正苦于以下问题:Java GL2.glShadeModel方法的具体用法?Java GL2.glShadeModel怎么用?Java GL2.glShadeModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.opengl.GL2
的用法示例。
在下文中一共展示了GL2.glShadeModel方法的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);
}
示例2: init
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/** Called by the drawable immediately after the OpenGL context is
initialized. Can be used to perform one-time OpenGL
initialization such as setup of lights and display lists. Note
that this method may be called more than once if the underlying
OpenGL context for the GLAutoDrawable is destroyed and
recreated, for example if a GLCanvas is removed from the widget
hierarchy and later added again.
*/
@Override
public void init(GLAutoDrawable drawable){
GL2 gl = drawable.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);
glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18,"Initialized display");
reval();
}
示例3: 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
}
示例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
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;
}
示例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) {
//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;
}
示例7: 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;
}
示例8: 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));
}
示例9: 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
}
示例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;
}
示例11: init
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void init(Graphics3D graphics) {
AWTGraphics3D g = (AWTGraphics3D) graphics;
GL2 gl = g.getGL2();
gl.glClearColor(0, 0, 0, 0);
gl.glShadeModel(GL2.GL_FLAT);
}
示例12: init
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void init( 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");
// Start animator (which should be a field).
animator = new FPSAnimator(glcanvas, 60);
animator.start();
}
示例13: 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");
}
示例14: init
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void init(Graphics3D graphics) {
view = new FlyView(30, 1.6f, 0);
view.getAim().setAngleY(180);
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);
stoneMesh = MeshLoader.getInstance().loadModel("stone/stone.obj");
stone = new ModelInstance(stoneMesh);
stone.setColor(Color.WHITE);
stone.offsetX(35);
stone.offsetY(0.5f);
stone.offsetZ(7);
stone.setScale(0.3f);
tree = new ModelInstance(MeshLoader.getInstance().loadModel("bamboo/bamboo.obj"));
tree.offsetX(30);
tree.offsetY(0.5f);
tree.offsetZ(7);
tree.setColor(Color.WHITE);
tree.setScale(1.5f);
floor = TextureLoader.getInstance().loadTexture("mark.png");
}
示例15: 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));
}