Java 类org.lwjgl.util.glu.Sphere 实例源码

项目:Defier    文件:ClientProxy.java   
@Override
public void init(FMLInitializationEvent e) {
    super.init(e);
    {
        Sphere sphere = new Sphere();
        sphere.setDrawStyle(GLU.GLU_FILL);
        sphere.setNormals(GLU.GLU_SMOOTH);
        sphere.setOrientation(GLU.GLU_OUTSIDE);

        defierSphereIdOutside = GL11.glGenLists(1);
        GL11.glNewList(defierSphereIdOutside, GL11.GL_COMPILE);
        sphere.draw(0.5F, 30, 30);
        GL11.glEndList();

        sphere.setOrientation(GLU.GLU_INSIDE);
        defierSphereIdInside = GL11.glGenLists(1);
        GL11.glNewList(defierSphereIdInside, GL11.GL_COMPILE);
        sphere.draw(0.5F, 30, 30);
        GL11.glEndList();
    }
    ClientRegistry.bindTileEntitySpecialRenderer(DefierTileEntity.class, new DefierTESR());
    ClientRegistry.bindTileEntitySpecialRenderer(EnergyProviderTileEntity.class, new EnergyProviderTESR());
}
项目:Solar    文件:RenderHelper.java   
public static void bake() {
    //--------------------Sphere--------------------//
    sphere = addDraw(new Sphere(), GLU.GLU_FILL, GLU.GLU_FLAT, form -> form.draw(1F, 16, 16));

    //---------------------Cube---------------------//
    cube = addDraw(new Cube(), GLU.GLU_FILL, GLU.GLU_FLAT, Cube::draw);

    //-----------------Json Models-----------------//
    for(BlockBaker model : BlockBaker.values()) {
        try {
            model.bake();
        } catch(Exception e) {
            Solar.LOG.fatal("[Model Bakery] Failed to bake json model: " + model.getLocation().toString());
            e.printStackTrace();
        }
    }
    Solar.LOG.info("[PIE HAS BEEN SUCCESSFULLY BAKED!]");
}
项目:Backmemed    文件:RenderUtils.java   
public static void drawSphere(double x, double y, double z, float size, int slices, int stacks) {
    final Sphere s = new Sphere();
    GL11.glPushMatrix();
    GL11.glBlendFunc(770, 771);
    GL11.glEnable(GL_BLEND);
    GL11.glLineWidth(1.2F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    s.setDrawStyle(GLU.GLU_SILHOUETTE);
    GL11.glTranslated(x - RenderManager.renderPosX, y - RenderManager.renderPosY, z - RenderManager.renderPosZ);
    s.draw(size, slices, stacks);
    GL11.glLineWidth(2.0F);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
    GL11.glPopMatrix();
}
项目:It-s-About-Time-Minecraft-Mod    文件:ProxyClient.java   
public  void drawCircle(ResourceLocation texture) {
    Sphere sphere = new Sphere();
    sphere.setDrawStyle(GLU.GLU_FILL);
    sphere.setNormals(GLU.GLU_SMOOTH);
    sphere.setOrientation(GLU.GLU_OUTSIDE);
    sphereId = GL11.glGenLists(1);
    GL11.glNewList(sphereId, GL11.GL_COMPILE);
    Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
    sphere.draw(0.5F, 32, 32);
    GL11.glEndList();
    sphere.setDrawStyle(GLU.GLU_FILL);      
    sphere.setNormals(GLU.GLU_SMOOTH);
    sphere.setOrientation(GLU.GLU_INSIDE);
    secondSphereId = GL11.glGenLists(2);
    GL11.glNewList(secondSphereId, GL11.GL_COMPILE);
    Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
    sphere.draw(0.49F, 32, 32);
    GL11.glEndList();   
}
项目:PhET    文件:LonePairNode.java   
@Override public void renderSelf( GLOptions options ) {
    super.renderSelf( options );

    glColorMaterial( GL_FRONT, GL_DIFFUSE );
    color4f( MoleculeShapesColor.LONE_PAIR_ELECTRON.get() );
    new Sphere().draw( 0.1f, 10, 10 );
}
项目:PhET    文件:AtomNode.java   
@Override public void renderSelf( GLOptions options ) {
    super.renderSelf( options );

    // TODO: add a specular component. noted 1f [0,128]
    glColorMaterial( GL_FRONT, GL_DIFFUSE );
    LWJGLUtils.color4f( color.get() );
    new Sphere().draw( radius, MoleculeShapesProperties.sphereSamples.get(), MoleculeShapesProperties.sphereSamples.get() );
}
项目:PhET    文件:HandleNode.java   
@Override public void renderSelf( GLOptions options ) {
    super.renderSelf( options );

    // red sphere TODO cleanup
    GL11.glPushMatrix();
    Vector3F center = getBallCenter();
    GL11.glTranslatef( center.x, center.y, center.z );
    glEnable( GL_COLOR_MATERIAL );
    glColorMaterial( GL_FRONT, GL_DIFFUSE );
    glEnable( GL_CULL_FACE );
    glEnable( GL_LIGHTING );
    GL11.glColor4f( 0.6f, 0, 0, 1 );
    new Sphere().draw( BALL_RADIUS, 25, 25 );
    glDisable( GL_LIGHTING );
    glDisable( GL_DEPTH_TEST );
    GL11.glColor4f( 1, 0, 0, 0.4f );
    new Sphere().draw( BALL_RADIUS, 25, 25 );
    glEnable( GL_DEPTH_TEST );
    glDisable( GL_COLOR_MATERIAL );
    glDisable( GL_CULL_FACE );
    GL11.glPopMatrix();

    // render the back-facing parts
    handleMesh.setMaterial( new ColorMaterial( 1, 1, 1, 0.2f ) );
    glFrontFace( GL_CW );
    handleMesh.render( options );

    // then switch back to normal
    glFrontFace( GL_CCW );
    handleMesh.setMaterial( new ColorMaterial( 1, 1, 1, 0.4f ) );
}
项目:Gaalop    文件:SimpleLwJglRenderingEngine.java   
private void paintPointCloud(PointCloud pointCloud) {
    Sphere s = new Sphere();
    //Use the color
    GL11.glColor4d(pointCloud.color.getRed()/255.0d, pointCloud.color.getGreen()/255.0d, pointCloud.color.getBlue()/255.0d, pointCloud.color.getAlpha()/255.0d);

    for (Point3d p: pointCloud.points) {
        GL11.glPushMatrix();
        GL11.glTranslated(p.x,p.y,p.z);
        s.draw(0.04f, 3, 3);
        GL11.glPopMatrix();
    }
}
项目:redrun    文件:Ball.java   
/**
 * Creates a new ball.
 * 
 * @param x the x position of the ball
 * @param y the y position of the ball
 * @param z the z position of the ball
 * @param textureName the texture to apply to the ball
 * @param radius the radius of the ball
 */
public Ball(float x, float y, float z, String textureName, float radius)
{
  super(x, y, z, textureName);

  this.sphere = new Sphere();

  this.body = new SpherePhysicsBody(new Vector3f(x, y, z), radius, 1.0f);

  displayListId = glGenLists(1);

  glNewList(displayListId, GL_COMPILE);
  {
    glBegin(GL_SPHERE_MAP);
    {
      FloatBuffer materialColor = BufferConverter.asFloatBuffer(new float[] {0.7f, 0.7f, 0.7f, 1.0f});
      FloatBuffer materialSpecular = BufferConverter.asFloatBuffer(new float[] {1.0f, 0.75f, 0.75f, 1.0f});
      FloatBuffer materialShininess = BufferConverter.asFloatBuffer(new float[] {30.0f, 0.0f, 0.0f, 0.0f});

      glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, materialColor);
      glMaterial(GL_FRONT, GL_SPECULAR, materialSpecular);
      glMaterial(GL_FRONT, GL_SHININESS, materialShininess);

      sphere.draw(radius, 40, 40);
    }
    glEnd();
  }
  glEndList();
}
项目:FutureCraft    文件:Planet.java   
/**
 * Renders the planet by itself without calculating orbits or anything.
 * Used for rendering planets on gui buttons.
 */
public void renderStatic(Minecraft mc) {
    ResourceLocation img = new ResourceLocation("futurecraft", surfacePath);
    mc.getTextureManager().bindTexture(img);

    glColor3f(1, 1, 1);
       Sphere sphere = new Sphere();
       sphere.setTextureFlag(true);
       sphere.draw(10, 25, 25);
}
项目:CubeShaft    文件:Sun.java   
public void render(float x, float y, float z) {
    glPushMatrix();
    glTranslatef(x, y, z);
    Sphere s = new Sphere();
    s.draw(radius, 16, 16);
    glPopMatrix();
}
项目:cuina    文件:GraphicUtil.java   
public static void drawSphere(int facets)
    {
        Sphere s = new Sphere();            // an LWJGL class
        s.setOrientation(GLU.GLU_OUTSIDE);  // normals point outwards
        s.setTextureFlag(true);             // generate texture coords
//        GL11.glPushMatrix();
//        {
//          GL11.glRotatef(-90f, 1,0,0);    // rotate the sphere to align the axis vertically
            s.draw(1, facets, facets);              // run GL commands to draw sphere
//        }
//        GL11.glPopMatrix();
    }
项目:WeaponsMod    文件:RenderUtils.java   
public static void renderSphere(double x, double y, double z, double r, double g, double b, double alpha, float radius) {
    GL11.glPushMatrix();
    FMLClientHandler.instance().getClient().renderEngine.bindTexture("/mods/weapons/textures/models/dynamiclyColor.png");
    RenderUtils.color(r, g, b, alpha);
    GL11.glTranslated(x, y, z);
    Sphere s = new Sphere();
    s.draw(radius, 32, 16);
    GL11.glPopMatrix();
}
项目:FutureCraft    文件:Star.java   
/**
 * Render's an awesome star.
 */
public void render(Camera cam, float time) {
    Tessellator tessellator = Tessellator.getInstance();
       WorldRenderer renderer = tessellator.getWorldRenderer();

       //draw the star itself
    glPushMatrix();
    GlStateManager.disableLighting();
    GlStateManager.disableTexture2D();
    glTranslatef(0, 0, 0);
    glColor3f(2.0f, 2.0f, 2.0f);
       Sphere sphere = new Sphere();
       sphere.setTextureFlag(false);
       sphere.setNormals(GLU.GLU_SMOOTH);
       sphere.draw((this.physical.diameter / 1000000) * 2, 100, 100);
       glPopMatrix();

       //draw the star glow
       glPushMatrix();
       GlStateManager.enableTexture2D();
       glBlendFunc(GL_ONE, GL_ONE);
       Textures.loadTexture("textures/environment/star_glow.png");
       glRotatef((float)-cam.rot.x, 0, 1, 0);
       glRotatef((float)-cam.rot.y, 1, 0, 0);
       float glowSize = ((this.physical.diameter / 1000000) * 2) * 20;

       renderer.startDrawingQuads();
       renderer.setColorRGBA(255, 255, 255, 255);
       renderer.addVertexWithUV(-glowSize, -glowSize, 0, 0, 1);
       renderer.addVertexWithUV(glowSize, -glowSize, 0, 1, 1);
       renderer.addVertexWithUV(glowSize, glowSize, 0, 1, 0);
       renderer.addVertexWithUV(-glowSize, glowSize, 0, 0, 0);
       tessellator.draw();

       glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
       glPopMatrix();

       GlStateManager.enableLighting();
       GlStateManager.enableTexture2D();
       this.renderChildren(cam, time);
}
项目:rpginventory    文件:ClientProxy.java   
@Override
public void registerRenderInformation() {

    Sphere sphere = new Sphere();
    // GLU_POINT will render it as dots.
    // GLU_LINE will render as wireframe
    // GLU_SILHOUETTE will render as ?shadowed? wireframe
    // GLU_FILL as a solid.
    sphere.setDrawStyle(GLU.GLU_FILL);
    // GLU_SMOOTH will try to smoothly apply lighting
    // GLU_FLAT will have a solid brightness per face, and will not shade.
    // GLU_NONE will be completely solid, and probably will have no depth to
    // it's appearance.
    sphere.setNormals(GLU.GLU_SMOOTH);
    // GLU_INSIDE will render as if you are inside the sphere, making it
    // appear inside out.(Similar to how ender portals are rendered)
    sphere.setOrientation(GLU.GLU_OUTSIDE);

    sphere.setTextureFlag(true);
    // Simple 1x1 red texture to serve as the spheres skin, the only pixel
    // in this image is red.
    // sphereID is returned from our sphereID() method
    sphereID = GL11.glGenLists(1);
    // Create a new list to hold our sphere data.
    GL11.glNewList(sphereID, GL11.GL_COMPILE);
    // Offset the sphere by it's radius so it will be centered
    GL11.glTranslatef(0.50F, 0.50F, 0.50F);

    sphere.draw(0.5F, 12, 24);
    // Drawing done, unbind our texture
    // Tell LWJGL that we are done creating our list.
    GL11.glEndList();



    Sphere sphereInside = new Sphere();
    sphereInside.setDrawStyle(GLU.GLU_FILL);
    sphereInside.setNormals(GLU.GLU_NONE);
    sphereInside.setOrientation(GLU.GLU_INSIDE);

    sphereInside.setTextureFlag(true);
    sphereID2 = GL11.glGenLists(1);
    GL11.glNewList(sphereID2, GL11.GL_COMPILE);
    GL11.glTranslatef(0.50F, 0.50F, 0.50F);

    sphereInside.draw(0.5F, 12, 24);
    GL11.glEndList();

}
项目:cnctools    文件:BeadActor.java   
@Override
public void initialize() {
    ambient = allocFloats(colorDefaultDiffuse);
    diffuse = allocFloats(colorDefaultDiffuse);
    specular = allocFloats(colorDefaultSpecular);
    shininess = allocFloats(new float[]{32.0f, 0.0f, 0.0f, 0.0f});

    light = allocFloats(colorDefaultLight);
    lightPos0 = allocFloats(lightDefaultPos0);
    lightPos1 = allocFloats(lightDefaultPos1);

    display_list = GL11.glGenLists(1);

    GL11.glNewList(display_list, GL11.GL_COMPILE);

    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_LIGHT0);
    GL11.glEnable(GL11.GL_LIGHT1);
    GL11.glShadeModel(GL11.GL_SMOOTH);

    GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT, ambient);
    GL11.glMaterial(GL11.GL_FRONT, GL11.GL_DIFFUSE, diffuse);
    GL11.glMaterial(GL11.GL_FRONT, GL11.GL_SPECULAR, specular);
    GL11.glMaterial(GL11.GL_FRONT, GL11.GL_SHININESS, shininess);

    GL11.glLight(GL11.GL_LIGHT0, GL11.GL_AMBIENT, light);
    GL11.glLight(GL11.GL_LIGHT0, GL11.GL_DIFFUSE, light);
    GL11.glLight(GL11.GL_LIGHT1, GL11.GL_DIFFUSE, light);

    GL11.glLight(GL11.GL_LIGHT1, GL11.GL_POSITION, lightPos0);
    GL11.glLight(GL11.GL_LIGHT1, GL11.GL_POSITION, lightPos1);

    GL11.glColor3f(1.0f, 0.0f, 0.0f);

    Sphere s = new Sphere();
    s.setDrawStyle(GLU.GLU_FILL);
    s.setNormals(GLU.GLU_SMOOTH);
    s.draw(3.8f, 100, 100);

    GL11.glDisable(GL11.GL_LIGHT1);
    GL11.glDisable(GL11.GL_LIGHT0);
    GL11.glDisable(GL11.GL_LIGHTING);

    GL11.glEndList();

}
项目:Mineworld    文件:Skysphere.java   
private void drawSphere() {
    if (displayListSphere == -1) {
        displayListSphere = glGenLists(1);

        Sphere sphere = new Sphere();
        sphere.setTextureFlag(true);

        glNewList(displayListSphere, GL11.GL_COMPILE);

        sphere.draw(16, 16, 128);

        glEndList();
    }

    glCallList(displayListSphere);
}
项目: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();
}
项目:akarnokd-opengl-experiment    文件:SimpleSphere.java   
public static void main(String[] args) {
        G3D.init(800, 600);

        Texture.enable();

//        Texture tex = Texture.fromFile("res/16079.jpg", false);
        Texture tex = Texture.fromFile("res/earthmap1k.jpg", false);

        Sphere sphere = new Sphere();
        sphere.setDrawStyle(GLU.GLU_FILL);
        sphere.setTextureFlag(true);
        sphere.setNormals(GLU.GLU_SMOOTH);

        int sphereId = glGenLists(1);

        glNewList(sphereId, GL_COMPILE);
        tex.use();
        sphere.draw(2.3f, 50, 50);
        tex.stop();
        glEndList();

        glClearColor(0.5f, 0.5f, 0.5f, 0.5f);
        G3D.loop(30, () -> {
            glTranslatef(0, 0, z);
            glRotatef(angle++, 0, 1, 0);

            glCallList(sphereId);

            if (dir) {
                z--;
                if (z < -80) {
                    dir = false;
                }
            } else {
                z++;
                if (z > -10) {
                    dir = true;
                }
            }
        });
    }
项目:brevis    文件:Basic3D.java   
static public void drawSphere(float r, int stack, int string) {

        Sphere s = new Sphere();

        s.draw(r, stack, string);


    }
项目:brevis    文件:BrShape.java   
static public void drawSphere(float r, int stack, int string) {

        Sphere s = new Sphere();

        s.draw(r, stack, string);


    }