示例#1
0
 public void Draw(float frameTime, Frustum frustum)
 {
     Gl.glPushMatrix();
     Gl.glDisable(Gl.GL_LIGHTING);
     Gl.glColor3f(1.0f, 1.0f, 1.0f);
     Gl.glTranslatef(position.x, position.y, position.z);
     Gl.glRotatef(angle, x_axis, y_axis, z_axis);
     texture.Bind();
     Gl.glScalef(radius, radius, radius);
     Glu.gluSphere(quad, radius, slices, slices);
     texture.UnBind();
     Gl.glPopMatrix();
 }
示例#2
0
        public void Draw(Vector3f pos)
        {
            Gl.glPushMatrix();
            Gl.glDisable(Gl.GL_LIGHTING);
            Gl.glDepthMask(false);
            Gl.glTranslatef(pos.x, pos.y, pos.z);
            texture.Bind();
            Gl.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
            float fExtent = 1.0f;

            Gl.glBegin(Gl.GL_QUADS);
            // Negative X
            Gl.glTexCoord3f(-1.0f, -1.0f, 1.0f);
            Gl.glVertex3f(-fExtent, -fExtent, fExtent);
            Gl.glTexCoord3f(-1.0f, -1.0f, -1.0f);
            Gl.glVertex3f(-fExtent, -fExtent, -fExtent);
            Gl.glTexCoord3f(-1.0f, 1.0f, -1.0f);
            Gl.glVertex3f(-fExtent, fExtent, -fExtent);
            Gl.glTexCoord3f(-1.0f, 1.0f, 1.0f);
            Gl.glVertex3f(-fExtent, fExtent, fExtent);

            // Positive Z
            Gl.glTexCoord3f(1.0f, -1.0f, 1.0f);
            Gl.glVertex3f(fExtent, -fExtent, fExtent);
            Gl.glTexCoord3f(-1.0f, -1.0f, 1.0f);
            Gl.glVertex3f(-fExtent, -fExtent, fExtent);
            Gl.glTexCoord3f(-1.0f, 1.0f, 1.0f);
            Gl.glVertex3f(-fExtent, fExtent, fExtent);
            Gl.glTexCoord3f(1.0f, 1.0f, 1.0f);
            Gl.glVertex3f(fExtent, fExtent, fExtent);

            // Positive X
            Gl.glTexCoord3f(1.0f, 1.0f, -1.0f);
            Gl.glVertex3f(fExtent, fExtent, -fExtent);
            Gl.glTexCoord3f(1.0f, 1.0f, 1.0f);
            Gl.glVertex3f(fExtent, fExtent, fExtent);
            Gl.glTexCoord3f(1.0f, -1.0f, 1.0f);
            Gl.glVertex3f(fExtent, -fExtent, fExtent);
            Gl.glTexCoord3f(1.0f, -1.0f, -1.0f);
            Gl.glVertex3f(fExtent, -fExtent, -fExtent);

            // Negative Z
            Gl.glTexCoord3f(-1.0f, 1.0f, -1.0f);
            Gl.glVertex3f(-fExtent, fExtent, -fExtent);
            Gl.glTexCoord3f(1.0f, 1.0f, -1.0f);
            Gl.glVertex3f(fExtent, fExtent, -fExtent);
            Gl.glTexCoord3f(1.0f, -1.0f, -1.0f);
            Gl.glVertex3f(fExtent, -fExtent, -fExtent);
            Gl.glTexCoord3f(-1.0f, -1.0f, -1.0f);
            Gl.glVertex3f(-fExtent, -fExtent, -fExtent);

            // Positive Y
            Gl.glTexCoord3f(1.0f, 1.0f, 1.0f);
            Gl.glVertex3f(fExtent, fExtent, fExtent);
            Gl.glTexCoord3f(-1.0f, 1.0f, 1.0f);
            Gl.glVertex3f(-fExtent, fExtent, fExtent);
            Gl.glTexCoord3f(-1.0f, 1.0f, -1.0f);
            Gl.glVertex3f(-fExtent, fExtent, -fExtent);
            Gl.glTexCoord3f(1.0f, 1.0f, -1.0f);
            Gl.glVertex3f(fExtent, fExtent, -fExtent);

            // Negative Y
            Gl.glTexCoord3f(1.0f, -1.0f, 1.0f);
            Gl.glVertex3f(fExtent, -fExtent, fExtent);
            Gl.glTexCoord3f(-1.0f, -1.0f, 1.0f);
            Gl.glVertex3f(-fExtent, -fExtent, fExtent);
            Gl.glTexCoord3f(-1.0f, -1.0f, -1.0f);
            Gl.glVertex3f(-fExtent, -fExtent, -fExtent);
            Gl.glTexCoord3f(1.0f, -1.0f, -1.0f);
            Gl.glVertex3f(fExtent, -fExtent, -fExtent);
            Gl.glEnd();
            texture.UnBind();
            Gl.glDepthMask(true);
            Gl.glEnable(Gl.GL_LIGHTING);
            Gl.glPopMatrix();
        }