13.07.2015 Views

Manual de Apoio 2010

Manual de Apoio 2010

Manual de Apoio 2010

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

import pt.ipb . esact .cg.gl. GLVectorList ;import com . jogamp . opengl . util . FPSAnimator ;@SuppressWarnings (" serial ")public class Bezier3D extends JFrame implements GLEventListener {private GLU glu = new GLU ();private GLCanvas canvas ;FPSAnimator animator ;private GLVectorList ctrlPoints ;private GLVector lookAt = new GLVector (0f, .5f, 0f);private CGEngine e;public static void main ( String [] args ) {new Bezier3D ();}public Bezier3D () {super (" Mo<strong>de</strong>lo OpenGL ");setDefaultCloseOperation ( JFrame . EXIT_ON_CLOSE );setSize (600 , 600);Container p = getContentPane ();Bor<strong>de</strong>rLayout l = new Bor<strong>de</strong>rLayout (5 , 5);p. setLayout (l);canvas = new GLCanvas ();p. add ( canvas , Bor<strong>de</strong>rLayout . CENTER );canvas . addGLEventListener ( this );GLVector location = new GLVector (5f, .5f, 5f);e = new CGEngine ( canvas , location );e. camera (). lookAt ( lookAt );setVisible ( true );canvas . requestFocus ();}animator = new FPSAnimator ( canvas , 25);animator . start ();@Overri<strong>de</strong>public void dispose ( GLAutoDrawable drawable ) {}@Overri<strong>de</strong>public void init ( GLAutoDrawable drawable ) {GL2 gl = drawable . getGL (). getGL2 ();// Grayish backgroundgl. glClearColor (.5f, .5f, .5f, .5f);// Definir Pontos <strong>de</strong> ControloctrlPoints = new GLVectorList ();// v0ctrlPoints . add ( -4f, 0f, 4f); // Start (u0)ctrlPoints . add ( -2f, 4f, 4f); // Control (u0)ctrlPoints . add (4f, 0f, 4f); // End (u0)142

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

Saved successfully!

Ooh no, something went wrong!