23.10.2014 Views

3D Objects in OpenGL

3D Objects in OpenGL

3D Objects in OpenGL

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

GLUT <strong>3D</strong> Shapes<br />

import com.sun.opengl.util.gl2.*;<br />

//Enable Light<strong>in</strong>g<br />

glEnable(GL_LIGHTING);<br />

glEnable(GL_LIGHT0);<br />

glEnable(GL_COLOR_MATERIAL);<br />

…<br />

GLUT glut = new GLUT();<br />

…<br />

glut.glutSolidTeapot(0.5);<br />

glut.glutWireCube(1.0f);<br />

glut.glutSolidTorus(0.2, 0.5, 10, 20);<br />

glut.glutWireIcosahedron();<br />

Creat<strong>in</strong>g a GLUT<br />

object usually<br />

<strong>in</strong>side display()<br />

2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!