Java 类org.lwjgl.util.glu.Cylinder 实例源码
项目:It-s-About-Time-Minecraft-Mod
文件:ProxyClient.java
public void drawCylinder(ResourceLocation texture) {
Cylinder cylinder = new Cylinder();
cylinder.setDrawStyle(GLU.GLU_FILL);
cylinder.setNormals(GLU.GLU_SMOOTH);
cylinder.setOrientation(GLU.GLU_OUTSIDE);
cylinderId = GL11.glGenLists(1);
GL11.glNewList(cylinderId, GL11.GL_COMPILE);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
cylinder.draw(0.5F, 0.5F, 10, 10, 2);
GL11.glEndList();
cylinder.setDrawStyle(GLU.GLU_FILL);
cylinder.setNormals(GLU.GLU_SMOOTH);
cylinder.setOrientation(GLU.GLU_INSIDE);
secondcylinderId = GL11.glGenLists(2);
GL11.glNewList(secondcylinderId, GL11.GL_COMPILE);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
cylinder.draw(0.49F, 0.49F, 10, 10, 2);
GL11.glEndList();
}
项目:PhET
文件:BondNode.java
@Override public void renderSelf( GLOptions options ) {
super.renderSelf( options );
glColorMaterial( GL_FRONT, GL_DIFFUSE );
LWJGLUtils.color4f( color );
// since this cylinder draws from z=0 to z=length, we have to handle translation here
glTranslatef( 0, 0, -length / 2 );
new Cylinder().draw( bondRadius, bondRadius, length, MoleculeShapesProperties.cylinderSamples.get(), 1 );
glTranslatef( 0, 0, length / 2 );
}
项目:Resilience-Client-Source
文件:ModuleTrajectories.java
private void renderPoint() {
GL11.glPushMatrix();
RenderUtils.setup3DLightlessModel();
GL11.glBegin(1);
GL11.glVertex3d(-0.5D, 0.0D, 0.0D);
GL11.glVertex3d(0.0D, 0.0D, 0.0D);
GL11.glVertex3d(0.0D, 0.0D, -0.5D);
GL11.glVertex3d(0.0D, 0.0D, 0.0D);
GL11.glVertex3d(0.5D, 0.0D, 0.0D);
GL11.glVertex3d(0.0D, 0.0D, 0.0D);
GL11.glVertex3d(0.0D, 0.0D, 0.5D);
GL11.glVertex3d(0.0D, 0.0D, 0.0D);
GL11.glEnd();
Cylinder c = new Cylinder();
GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
GL11.glLineWidth(0.5F);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
c.setDrawStyle(GLU.GLU_SILHOUETTE);
c.setNormals(GLU.GLU_SMOOTH);
c.draw(0.5F, 0.5F, 0.1F, 400, 1);
Cylinder c2 = new Cylinder();
GL11.glLineWidth(0.5F);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
c2.setDrawStyle(GLU.GLU_SILHOUETTE);
c2.setNormals(GLU.GLU_SMOOTH);
c2.draw(0.3F, 0.3F, 0.1F, 200, 1);
Cylinder c3 = new Cylinder();
GL11.glLineWidth(0.5F);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
c3.setDrawStyle(GLU.GLU_SILHOUETTE);
c3.setNormals(GLU.GLU_SMOOTH);
c3.draw(0.1F, 0.1F, 0.1F, 100, 1);
RenderUtils.shutdown3DLightlessModel();
GL11.glPopMatrix();
}
项目:WeaponsMod
文件:RenderUtils.java
public static void renderBeam(double x, double y, double z, double desierdx, double desierdy, double desierdz, double red, double green, double blue, double alpha, float radius){
GL11.glPushMatrix();
FMLClientHandler.instance().getClient().renderEngine.bindTexture("/mods/weapons/textures/models/dynamiclyColor.png");
double lenght = Math.sqrt(Math.pow(x - desierdx, 2) + Math.pow(y - desierdy, 2) + Math.pow(z - desierdz, 2));
double a = x - desierdx;
double b = z - desierdz;
double c = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2));
double secondb = y - desierdy;
double secondc = Math.sqrt(Math.pow(c, 2) + Math.pow(secondb, 2));
double yaw = Math.asin(b/c);
double pitch = Math.asin(secondb/secondc);
RenderUtils.color(red, green, blue, alpha);
GL11.glTranslated(x, y, z);
if((x - desierdx) > 0 && (z - desierdz) > 0){
GL11.glRotatef(-180, 0, 1, 0);
GL11.glRotatef((float)Math.toDegrees(yaw), 0, 1, 0);
}
else if((x - desierdx) < 0 && (z - desierdz) > 0){
GL11.glRotatef((float)Math.toDegrees(yaw) + 90, 0, 1, 0);
}
else if((x - desierdx) > 0 && (z - desierdz) < 0){
GL11.glRotatef(-(float)Math.toDegrees(yaw) - 90, 0, 1, 0);
}
else{
GL11.glRotatef(-(float)Math.toDegrees(yaw), 0, 1, 0);
}
if((y - desierdy) > 0){
GL11.glRotatef(-90, 1, 0, 0);
}
GL11.glRotatef((float)Math.toDegrees(pitch), 1, 0, 0);
Cylinder cyl = new Cylinder();
cyl.draw(radius, radius, (float)lenght, 16, 1);
GL11.glPopMatrix();
}
项目:boltzmann-3d
文件:GLPanel.java
/** Initializes the canvas by setting the viewport, lighting, etc. */
public void init() {
glShadeModel(GL_SMOOTH);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
sphere=new Sphere();
cylinder=new Cylinder();
disk=new Disk();
//GL_LIGHT0 is a very dim backlight; with it I can only see silhouetted spheres against oblique walls.
//GL_LIGHT0 is enabled only in 3D mode.
floatBuffer = toBuffer(new float[] {0.3f, 0.3f, 0.3f, 1.0f});
floatBuffer.flip();
//glLight(GL_LIGHT0, GL_AMBIENT_AND_DIFFUSE, floatBuffer); // RGBA values
glLight(GL_LIGHT0, GL_AMBIENT, floatBuffer); // RGBA values
glLight(GL_LIGHT0, GL_DIFFUSE, floatBuffer); // RGBA values
floatBuffer = toBuffer(new float[] {0.6f, 0.6f, 0.6f, 0.3f});
floatBuffer.flip();
glLight(GL_LIGHT0, GL_SPECULAR, floatBuffer);
floatBuffer = toBuffer(new float[] {0.0f, 0.0f, -1.0f, 0.0f});
floatBuffer.flip();
glLight(GL_LIGHT0, GL_POSITION, floatBuffer); // position (directional if last coord is 0)
//GL_LIGHT1 is enabled only in 3D mode, and its position is set elsewhere
floatBuffer = toBuffer(new float[] {0.3f, 0.3f, 0.3f, 1.0f});
floatBuffer.flip();
glLight(GL_LIGHT1, GL_AMBIENT, floatBuffer); // very dim gray walls; spheres invisible
floatBuffer = toBuffer(new float[] {0.8f, 0.8f, 0.8f, 1.0f});
floatBuffer.flip();
glLight(GL_LIGHT1, GL_DIFFUSE, floatBuffer); // this is most of what we see
floatBuffer = toBuffer(new float[] {1.0f, 1.0f, 1.0f, 1.0f});
floatBuffer.flip();
glLight(GL_LIGHT1, GL_SPECULAR, floatBuffer); // no noticeable contribution - it looks black!
floatBuffer = toBuffer(new float[] {0.0f, 0.0f, -1.0f, 1.0f});
floatBuffer.flip();
glLight(GL_LIGHT1, GL_SPOT_DIRECTION, floatBuffer);
glLightf(GL_LIGHT1, GL_SPOT_CUTOFF, 180);
glLightf(GL_LIGHT1, GL_LINEAR_ATTENUATION, 0.5E-5f);
glLightf(GL_LIGHT1, GL_SPOT_EXPONENT, 64);
//GL_LIGHT2 is only enabled in 1D and 2D modes.
floatBuffer = toBuffer(new float[] {0.1f, 0.1f, 0.1f, 1.0f});
floatBuffer.flip();
glLight(GL_LIGHT2, GL_AMBIENT, floatBuffer);
floatBuffer = toBuffer(new float[] {1.0f, 1.0f, 1.0f, 1.0f});
floatBuffer.flip();
glLight(GL_LIGHT2, GL_DIFFUSE, floatBuffer);
floatBuffer = toBuffer(new float[] {0.0f, 0.0f, 0.0f, 1.0f});
floatBuffer.flip();
glLight(GL_LIGHT2, GL_SPECULAR, floatBuffer);
floatBuffer = toBuffer(new float[] {0.0f, 0.0f, 1.0f, 0.0f});
floatBuffer.flip();
glLight(GL_LIGHT2, GL_POSITION, floatBuffer);
glEnable(GL_LIGHTING);
glColorMaterial(GL_FRONT, GL_DIFFUSE);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
glCullFace(GL_BACK);
glEnable(GL_CULL_FACE);
glEnable(GL_POLYGON_SMOOTH);
glEnable(GL_LINE_SMOOTH);
glEnable(GL_POINT_SMOOTH);
glEnable(GL_BLEND);
glEnable(GL_DITHER);
glPointSize(tracePointSize);
curPointSize=tracePointSize;
//Print valuable OpenGL driver info to the console for debugging.
System.out.println(glGetString(GL_VENDOR));
System.out.println(glGetString(GL_RENDERER));
System.out.println(glGetString(GL_VERSION));
makeCube();
}
项目:brevis
文件:Basic3D.java
static public void drawCylinder(float baseRadius, float topRadius, float height, int slices, int stacks, Cylinder data) {
//Cylinder c = new Cylinder();
data.draw(baseRadius, topRadius, height, slices, stacks);
//System.out.println(baseRadius + " " + topRadius + " " + height + " " + slices + " " + stacks);
}
项目:brevis
文件:BrShape.java
static public void drawCylinder(float baseRadius, float topRadius, float height, int slices, int stacks) {
Cylinder c = new Cylinder();
c.draw(baseRadius, topRadius, height, slices, stacks);
//System.out.println(baseRadius + " " + topRadius + " " + height + " " + slices + " " + stacks);
}