本文整理匯總了Java中javax.media.opengl.glu.GLU.gluCylinder方法的典型用法代碼示例。如果您正苦於以下問題:Java GLU.gluCylinder方法的具體用法?Java GLU.gluCylinder怎麽用?Java GLU.gluCylinder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.media.opengl.glu.GLU
的用法示例。
在下文中一共展示了GLU.gluCylinder方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: drawChair
import javax.media.opengl.glu.GLU; //導入方法依賴的package包/類
public void drawChair(GL2 gl, GLU glu, float lx, float lz){
gl.glEnable(GL2.GL_TEXTURE_2D);
chairTex.bind(gl);
gl.glPushMatrix();
gl.glTranslatef(lx, 0, lz);
gl.glRotatef(-90f, 1f, 0f, 0f);
glu.gluCylinder(quadric, 0.5f, 0f, 2f, 10, 10);
gl.glPopMatrix();
gl.glPushMatrix();
gl.glTranslatef(lx, 2f, lz);
gl.glRotatef(-90f, 1f, 0f, 0f);
glu.gluDisk(quadric, 1f, 0f, 10, 10);
gl.glPopMatrix();
gl.glDisable(GL2.GL_TEXTURE_2D);
}
示例2: 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);
}
示例3: 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();
}
示例4: drawOneEar
import javax.media.opengl.glu.GLU; //導入方法依賴的package包/類
protected void drawOneEar(GL2 gl, GLU glu){
gl.glPushMatrix();
gl.glTranslatef(.3f, 0, 0);
gl.glRotatef(90, -1, .59f, 0);
glu.gluCylinder(textureQuadric, .4, 0, .5, 10, 10);
gl.glPopMatrix();
}
示例5: drawTail
import javax.media.opengl.glu.GLU; //導入方法依賴的package包/類
protected void drawTail(GL2 gl, GLU glu){
gl.glPushMatrix();
gl.glRotatef(86,-1,0,0);
glu.gluCylinder(textureQuadric, TAIL_DIAM, TAIL_DIAM, TAIL_LENGTH, 10, 10);
gl.glTranslatef(0, 0, TAIL_LENGTH);
drawSphere(textureQuadric,TAIL_DIAM,glu);
gl.glPopMatrix();
}
示例6: draw
import javax.media.opengl.glu.GLU; //導入方法依賴的package包/類
public void draw(GL2 gl, GLU glu, double xpos, double zpos) {
gl.glColor3d(.5, .2, .2);
gl.glPushMatrix();
gl.glTranslated(xpos,0,zpos);
gl.glRotated(-90,1,0,0);
glu.gluCylinder(q, .25,.25,3,5,5);
gl.glPopMatrix();
gl.glPushMatrix();
gl.glTranslated(xpos+4,0,zpos);
gl.glRotated(-90,1,0,0);
glu.gluCylinder(q, .25,.25,3,5,5);
gl.glPopMatrix();
gl.glPushMatrix();
gl.glTranslated(xpos+4,0,zpos+4);
gl.glRotated(-90,1,0,0);
glu.gluCylinder(q, .25,.25,3,5,6);
gl.glPopMatrix();
gl.glPushMatrix();
gl.glTranslated(xpos,0,zpos+4);
gl.glRotated(-90,1,0,0);
glu.gluCylinder(q, .25,.25,3,5,5);
gl.glPopMatrix();
gl.glColor3d(.7, .4, .4);
gl.glPushMatrix();
gl.glTranslated(xpos+2.5,3,zpos+2.5);
gl.glRotated(-90,1,0,0);
glu.gluDisk(q, .001, 5, 10, 10);
gl.glPopMatrix();
}
示例7: drawTree
import javax.media.opengl.glu.GLU; //導入方法依賴的package包/類
public void drawTree(GL2 gl, GLU glu) {
wood.bind(gl);
glu.gluCylinder(quadric, .75, .75, 4, 10, 10);
gl.glTranslatef(0f, 0f, -15f);
tree.bind(gl);
glu.gluCylinder(quadric, 0, 3, 15, 10, 10);
gl.glTranslatef(0f, 0f, 15f);
}
示例8: drawTable
import javax.media.opengl.glu.GLU; //導入方法依賴的package包/類
public void drawTable(GL2 gl, GLU glu){
woodTexture.bind(gl);
gl.glBegin(GL2.GL_QUADS);
// ccw as viewed from front
gl.glTexCoord2f(0f, 2f); gl.glVertex3f(48, 3, 48);
gl.glTexCoord2f(3f, 2f); gl.glVertex3f(48, 3, 52);
gl.glTexCoord2f(3f, 0f); gl.glVertex3f(52, 3, 52);
gl.glTexCoord2f(0f, 0f); gl.glVertex3f(52, 3, 48);
gl.glEnd();
gl.glPushMatrix();
gl.glTranslatef(50, 0, 50); // 9 feet off of ground
gl.glRotatef(-90f, 1f, 0f, 0f); // stand upright (Y)
gl.glColor3f(1,1,1);
glu.gluCylinder(quadric, 1.5, .3, .5, 10, 10); // table
gl.glPopMatrix();
gl.glPushMatrix();
gl.glTranslatef(50, 0, 50); // 9 feet off of ground
gl.glRotatef(-90f, 1f, 0f, 0f); // stand upright (Y)
gl.glColor3f(1,1,1);
glu.gluCylinder(quadric, .3, .3, 3, 10, 10); // table
gl.glPopMatrix();
}
示例9: 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();
}
示例10: drawFurniture
import javax.media.opengl.glu.GLU; //導入方法依賴的package包/類
public void drawFurniture(GL2 gl, GLU glu) {
gl.glPushMatrix();
gl.glColor3f(.5f, .5f, .5f);
gl.glRotatef(-90f, 1f, 0f, 0f);
gl.glTranslatef(80, -58, 1);
gl.glColor3f(.7f, .1f, .1f); //ottoman sides
glu.gluCylinder(quadric, 7, 7, 2, 10, 10);
glu.gluCylinder(quadric, 4, 4, 4, 10, 10);
gl.glColor3f(.8f, .8f, .8f); //ottoman cushions
gl.glTranslatef(0, 0, 2);
glu.gluDisk(quadric, 0, 7, 10, 10);
gl.glTranslatef(0,0,2);
glu.gluDisk(quadric, 0, 4, 10, 10);
gl.glPopMatrix();
drawLamp(gl, glu, 35, 58);
drawLamp(gl, glu, 35, 72);
drawLamp(gl, glu, 50, 58);
drawLamp(gl, glu, 50, 72);
drawLamp(gl, glu, 65, 58);
drawLamp(gl, glu, 65, 72);
drawLamp(gl, glu, 80, 58);
drawLamp(gl, glu, 80, 72);
gl.glEnable(GL2.GL_TEXTURE_2D);
ventarolaPollock.bind(gl);
gl.glBegin(GL2.GL_QUADS);
gl.glTexCoord2f(0, 0); gl.glVertex3f(30.05f, 5, 70); //picture
gl.glTexCoord2f(0, 1); gl.glVertex3f(30.05f, 9, 70);
gl.glTexCoord2f(1, 1); gl.glVertex3f(30.05f, 9, 60);
gl.glTexCoord2f(1, 0); gl.glVertex3f(30.05f, 5, 60);
gl.glEnd();
gl.glDisable(GL2.GL_TEXTURE_2D);
}
示例11: drawTable
import javax.media.opengl.glu.GLU; //導入方法依賴的package包/類
public void drawTable(GL2 gl, GLU glu){
gl.glEnable(GL2.GL_TEXTURE_2D);
woodTex.bind(gl);
gl.glPushMatrix();
gl.glTranslatef(50f, 0, 50f);
gl.glRotatef(-90f, 1f, 0f, 0f);
glu.gluCylinder(quadric, 0.2f, 0.2f, 3.5f, 10, 10);
gl.glPopMatrix();
gl.glPushMatrix();
gl.glTranslatef(50f, 0, 46f);
gl.glRotatef(-90f, 1f, 0f, 0f);
glu.gluCylinder(quadric, 0.2f, 0.2f, 3.5f, 10, 10);
gl.glPopMatrix();
gl.glPushMatrix();
gl.glTranslatef(46f, 0, 46f);
gl.glRotatef(-90f, 1f, 0f, 0f);
glu.gluCylinder(quadric, 0.2f, 0.2f, 3.5f, 10, 10);
gl.glPopMatrix();
gl.glPushMatrix();
gl.glTranslatef(46f, 0, 50f);
gl.glRotatef(-90f, 1f, 0f, 0f);
glu.gluCylinder(quadric, 0.2f, 0.2f, 3.5f, 10, 10);
gl.glPopMatrix();
gl.glPushMatrix();
gl.glTranslatef(48f, 3.5f, 48f);
gl.glRotatef(-90f, 1f, 0f, 0f);
glu.gluDisk(quadric, 5f, 0f, 10, 10);
gl.glPopMatrix();
gl.glDisable(GL2.GL_TEXTURE_2D);
}
示例12: draw
import javax.media.opengl.glu.GLU; //導入方法依賴的package包/類
public void draw(GL2 gl, GLU glu, double xpos, double zpos) {
gl.glColor3d(.55, .2, .2);
gl.glPushMatrix();
gl.glTranslated(xpos,0,zpos);
gl.glRotated(-90,1,0,0);
glu.gluCylinder(q, .25,.25,2,5,5);
gl.glPopMatrix();
gl.glPushMatrix();
gl.glTranslated(xpos+2,0,zpos);
gl.glRotated(-90,1,0,0);
glu.gluCylinder(q, .25,.25,2,5,5);
gl.glPopMatrix();
gl.glPushMatrix();
gl.glTranslated(xpos+2,0,zpos+2);
gl.glRotated(-90,1,0,0);
glu.gluCylinder(q, .25,.25,6,5,6);
gl.glPopMatrix();
gl.glPushMatrix();
gl.glTranslated(xpos,0,zpos+2);
gl.glRotated(-90,1,0,0);
glu.gluCylinder(q, .25,.25,6,5,5);
gl.glPopMatrix();
gl.glColor3d(0, 0, 1);
gl.glPushMatrix();
gl.glTranslated(xpos+1,2,zpos+2);
gl.glRotated(-90,1,0,0);
glu.gluPartialDisk(q, .01, 2.5, 10, 10, -90, 180);
gl.glPopMatrix();
gl.glColor3d(0, .5, .5);
gl.glPushMatrix();
gl.glTranslated(xpos+1,5,zpos+2);
//gl.glRotated(-90,1,0,0);
glu.gluPartialDisk(q, .01, 1.2, 10, 10, -90, 180);
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: drawTail
import javax.media.opengl.glu.GLU; //導入方法依賴的package包/類
public void drawTail(GL2 gl, GLU glu, float x, float y, float z) {
gl.glPushMatrix();
gl.glTranslatef(x, y, z);
float angle = (float) (10*Math.cos(Math.toRadians(T*360)));
gl.glRotatef(angle, 0, 0, 1);
gl.glRotatef(-90f, 1f, 0f, 0f); // stand upright (Y)
gl.glTranslatef(0, 0, -0.75f);
glu.gluCylinder(quadric, 0, 0.3, 0.75, 20, 20);
gl.glPopMatrix();
}
示例15: drawTail2
import javax.media.opengl.glu.GLU; //導入方法依賴的package包/類
public void drawTail2(GL2 gl, GLU glu, float x, float y, float z) {
gl.glPushMatrix();
gl.glTranslatef(x, y, z);
float angle = (float) (10*Math.sin(Math.toRadians(T*360-90)));
gl.glRotatef(angle, 0, 0, 1);
gl.glRotatef(-90f, 1f, 0f, 0f); // stand upright (Y)
gl.glTranslatef(0, 0, -0.75f);
glu.gluCylinder(quadric, 0, 0.3, 0.75, 20, 20);
gl.glPopMatrix();
}