本文整理汇总了Java中javax.media.opengl.glu.GLU.gluSphere方法的典型用法代码示例。如果您正苦于以下问题:Java GLU.gluSphere方法的具体用法?Java GLU.gluSphere怎么用?Java GLU.gluSphere使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.media.opengl.glu.GLU
的用法示例。
在下文中一共展示了GLU.gluSphere方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: gegGLCalList
import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
protected void gegGLCalList(){
GLU glu = new GLU();
GLUquadric sQuad= glu.gluNewQuadric();
callist = gl.glGenLists(1);
gl.glNewList(callist, gl.GL_COMPILE);
texture.enable(gl);
texture.bind(gl);
glu.gluQuadricTexture(sQuad, true);
glu.gluQuadricOrientation(sQuad, glu.GLU_INSIDE);
glu.gluSphere(sQuad, radius, 36, 72);
gl.glEndList();
}
示例2: drawBall
import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
public void drawBall(GL2 gl, GLU glu){
gl.glEnable(GL2.GL_CULL_FACE);
gl.glEnable(GL2.GL_TEXTURE_2D);
fire[frame++].bind(gl);
gl.glPushMatrix();
// gl.glRotated(angle, x, y, z);
gl.glTranslated(lx, ly, lz);
glu.gluSphere(quadric, 5, 25, 10);
gl.glPopMatrix();
gl.glDisable(GL2.GL_TEXTURE_2D);
gl.glDisable(GL2.GL_CULL_FACE);
if (frame == 23) {
frame = 0;
}
}
示例3: drawHeadHalf
import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
private void drawHeadHalf(GL2 gl, GLU glu, int direction) {
gl.glPushMatrix();
gl.glRotatef(-direction*30, 0,1,1);
gl.glScaled(3, 2, 7);
gl.glTranslated(.1*direction, 0, 0);
gl.glPushMatrix();
gl.glColor3f(.7f, 0, 0);
gl.glTranslatef(0, .1f, .04f);
gl.glRotated(90, 0, 0, 1);
gl.glEnable(GL2.GL_BLEND);
gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);
gl.glColor4f((float) (Math.sin(t)/5+.25), 0, 0, .9f); // dimmer yellow, translucent
glu.gluSphere(quadric, .02, 10, 10);
gl.glDisable(GL2.GL_BLEND);
gl.glPopMatrix();
gl.glColor3f(.1f, .1f, .07f);
glu.gluSphere(quadric, .1, 10,10);
gl.glPopMatrix();
}
示例4: drawBody
import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
public void drawBody(GL2 gl, GLU glu, float x, float y, float z) {
gl.glEnable(GL2.GL_TEXTURE_2D);
parkGhostColor.bind(gl);
gl.glPushMatrix();
gl.glTranslatef(x, y + 2.25f, z);
glu.gluSphere(quadric, 1, 40, 40);
gl.glPopMatrix();
parkGhost.bind(gl);
gl.glPushMatrix();
gl.glTranslatef(x, y + 1f, z);
gl.glRotatef(directionAngle, 0f, 1f, 0f);
gl.glRotatef(-90f, 1f, 0f, 0f); // stand upright (Y)
glu.gluCylinder(quadric, 1, 1, 1.25, 40, 40);
gl.glPopMatrix();
gl.glDisable(GL2.GL_TEXTURE_2D);
}
示例5: mkGLCallList
import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
protected int mkGLCallList(){
GLU glu = new GLU();
int callList;
GLUquadric quad = glu.gluNewQuadric();
// material properties
float[] no_mat = {0.0f, 0.0f, 0.0f, 1.0f};
float[] mat_ambient = {1f, 1f, 1f, 1.0f};
float[] mat_diffuse = {1, 1, 1, 1.0f};
float[] mat_specular = {1.0f, 1.0f, 1.0f, 1.0f};
float no_shininess = 0.0f;
float low_shininess = 5.0f;
float high_shininess = 100.0f;
float[] mat_emission = {0.3f, 0.2f, 0.2f, 0.0f};
callList = gl.glGenLists(1);
gl.glNewList(callList, gl.GL_COMPILE);
gl.glMaterialfv(gl.GL_FRONT, gl.GL_AMBIENT, Utils.mkFloatBuffer(no_mat));
gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, Utils.mkFloatBuffer(mat_diffuse));
gl.glMaterialfv(gl.GL_FRONT, gl.GL_SPECULAR, Utils.mkFloatBuffer(mat_specular));
gl.glMaterialf(gl.GL_FRONT, gl.GL_SHININESS, high_shininess);
gl.glMaterialfv(gl.GL_FRONT, gl.GL_EMISSION, Utils.mkFloatBuffer(no_mat));
glu.gluQuadricTexture(quad, true);
glu.gluQuadricOrientation(quad, glu.GLU_OUTSIDE);
texture.enable(gl);
texture.bind(gl);
glu.gluSphere(quad, 1, 36, 72);
texture.disable(gl);
gl.glEndList();
return callList;
}
示例6: drawSphere
import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
public static void drawSphere(GL2 gl2, double radius, boolean texture) {
GLU glu = new GLU();
GLUquadric quadric = glu.gluNewQuadric();
glu.gluQuadricTexture(quadric, texture);
if (texture == false) {
glu.gluQuadricDrawStyle(quadric, GLU.GLU_FILL);
}
glu.gluQuadricNormals(quadric, GLU.GLU_FLAT);
glu.gluQuadricOrientation(quadric, GLU.GLU_OUTSIDE);
glu.gluSphere(quadric, radius, 64, 64);
glu.gluDeleteQuadric(quadric);
}
示例7: drawBody
import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
private void drawBody(GL2 gl, GLU glu) {
gl.glPushMatrix();
gl.glTranslatef(0, -.5f, 0);
gl.glScalef(.75f, 1, .5f);
drawFeet(gl, glu);
gl.glColor3f(.25f, .25f, .2f);
glu.gluSphere(quadric, 1, 20, 20);
gl.glPopMatrix();
}
示例8: drawFoot
import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
private void drawFoot(GL2 gl, GLU glu) {
gl.glPushMatrix();
gl.glColor3f(.4f, .35f, .2f);
gl.glRotatef(30, 0, 0, 1);
gl.glTranslated(0, -.5f, 0);
gl.glScaled(.3, .7, .3);
glu.gluSphere(quadric, 1, 10, 10);
gl.glPopMatrix();
}
示例9: drawBody
import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
public void drawBody(GL2 gl, GLU glu){
float scaledEyeDistance = scale*(float) Math.sin(45)/2 ;
//body of the bat
gl.glPushMatrix();
//gl.glTranslatef(x, y, z);
gl.glColor3f(0f, 0f, 0f); //black color
glu.gluSphere(quadric, bodyRadius, 10, 10); //body
gl.glPopMatrix();
// right eye
gl.glPushMatrix();
gl.glTranslatef(scaledEyeDistance, scaledEyeDistance, scaledEyeDistance + bodyRadius/8);
gl.glColor3f(1f, 0, 0); // red color
glu.gluSphere(quadric, bodyRadius/4, 10, 10); //right eye
gl.glPopMatrix();
// left eye
gl.glPushMatrix();
gl.glTranslatef(-scaledEyeDistance, scaledEyeDistance, scaledEyeDistance + bodyRadius/8);
gl.glColor3f(1f, 0f, 0f); // red color
glu.gluSphere(quadric, bodyRadius/4, 10, 10); //left eye
gl.glPopMatrix();
//snout
gl.glPushMatrix();
gl.glTranslated(0, 0, (bodyRadius*3/4));
gl.glColor3f(0f, 0f, 0f);
glu.gluCylinder(quadric, bodyRadius/2, bodyRadius/2 + bodyRadius/10, bodyRadius/2, 10, 10);
gl.glPopMatrix();
}
示例10: drawLight
import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
public void drawLight(GL2 gl, GLU glu){
lightTexture.bind(gl);
gl.glPushMatrix();
gl.glTranslatef(50, 9, 50); // 9 feet off of ground
gl.glColor3f(1,1,0); // yellow
glu.gluSphere(quadric, 1., 10, 10); // bulb
gl.glPopMatrix();
}
示例11: drawLamp
import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
public void drawLamp(GL2 gl, GLU glu, float x, float z) {
gl.glPushMatrix();//hanging lamp
gl.glRotatef(-90f, 1f, 0f, 0f);
gl.glTranslated(x, -z, 9);
gl.glColor3f(.7f, .7f, .7f);
glu.gluCylinder(quadric, .1, .1, 2, 10, 10);
glu.gluSphere(quadric, .8, 10, 10);
gl.glTranslated(0, 0, -1);
gl.glEnable(GL2.GL_BLEND);
gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);
gl.glColor4f(.7f,.1f,.1f, .9f); // dimmer yellow, translucent
glu.gluCylinder(quadric, 1, 1, 2, 10, 10);
gl.glDisable(GL2.GL_BLEND);
gl.glPopMatrix();
}
示例12: drawBullet
import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
public void drawBullet(GL2 gl, GLU glu) {
sphereQuadric = glu.gluNewQuadric();
glu.gluQuadricDrawStyle(sphereQuadric, GLU.GLU_FILL);
glu.gluQuadricNormals (sphereQuadric, GLU.GLU_NONE);
glu.gluQuadricTexture (sphereQuadric, false);
gl.glPushMatrix();
glu.gluSphere(sphereQuadric, getSize(), 10,10);
gl.glPopMatrix();
}
示例13: draw
import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
@Override
public void draw(GL2 gl, GLU glu) {
// For bobbing up and down
double bobFactor = (size/8)*Math.sin(bobChange);
gl.glPushMatrix();
gl.glRotatef(-90f, 1f, 0f, 0f);
gl.glColor3d(1.0f,1.0f,1.0f);
gl.glTranslated(x, -z, y - length + bobFactor);
glu.gluCylinder(quadric, .1, .1, length, 10, 10);
gl.glPopMatrix();
// Change color randomly
if (colorChange % 10 == 0) {
double colorToChange = Math.random();
if (colorToChange < 1/3)
r = (float)Math.random();
else if (colorToChange > 2/3)
g = (float)Math.random();
else
b = (float)Math.random();
}
gl.glPushMatrix();
gl.glRotatef(-90f, 1f, 0f, 0f);
gl.glColor3d(r, g, b);
gl.glTranslated(x, -z, y - length + bobFactor);
glu.gluSphere(quadric, size, 10, 10);
gl.glEnable(GL2.GL_BLEND);
gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);
gl.glColor4d(r, g, b, .25);
glu.gluSphere(quadric, 2*size, 10, 10);
gl.glDisable(GL2.GL_BLEND);
gl.glPopMatrix();
bobChange = bobChange + 0.1f;
colorChange++;
}
示例14: draw
import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
@Override
public void draw(GL2 gl, GLU glu) {
float rOld = r, gOld = g, bOld = b;
// Change color randomly
if (colorChange % 10 == 0) {
double colorToChange = Math.random();
if (colorToChange < 1/3) {
r = (float)Math.random();
}
else if (colorToChange > 2/3) {
g = (float)Math.random();
}
else {
b = (float)Math.random();
}
}
gl.glPushMatrix();
gl.glColor3d(r, g, b);
gl.glTranslated(x + flightRadiusX*Math.cos(posChange), y + flightRadiusY*Math.sin(posChange), z + flightRadiusZ*Math.sin(posChange));
glu.gluSphere(quadric, size, 10, 10);
gl.glEnable(GL2.GL_BLEND);
gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);
gl.glColor4d(rOld, gOld, bOld, .25);
glu.gluSphere(quadric, 2*size, 10, 10);
gl.glDisable(GL2.GL_BLEND);
gl.glPopMatrix();
posChange = posChange + speed*0.01f;
colorChange++;
}
示例15: drawHead
import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
private void drawHead(GL2 gl,GLU glu){
gl.glColor3d(0.33,0.33,0.33);
gl.glPushMatrix();
gl.glTranslated(0,8,0);
glu.gluSphere(quadric,1,20,20);
gl.glPopMatrix();
}