From: Alban C. <aco...@mi...> - 2002-04-09 08:50:52
|
>It there anywhere at all that I can find out how to use the new listener >model that GL4Java has implemented, I am not able to find any good >documentation or example code on how to set up a simple app using the new >model=2E Also, if anyone could point me to some example code using 1=2E4 >fullscreen mode and gl4java that would be really awesome=2E Hello Byron, For using the listener model, you can have a look at testListener=2Ejava in the miscDemos section of gl4java sample=2E However the code is long, so it's very clear where the listener model code is=2E As a matter of fact, it VERY simple to implement : 1) Write a class that implements the GLEventListener model public class SceneManager implements GLEventListener { final public void init(GLDrawable drawable){ //init code goes here } final public void preDisplay(GLDrawable drawable) { //predisplay code goes here } final public void display(GLDrawable drawable) { //display code goes here } /* * * implement also postDisplay(), cleanup(), and reshape() * */ } 2) Create a canvas, and add your GLEventListener to the canvas public class myWindow{ SceneManager myGLEventListener; public myWindow(){ myGLEventListener =3D new SceneManager(); GLAnimCanvas canvas =3D new GLAnimCanvas(caps,width,height); canvas=2EaddGLEventListener(myGLEventListener); } } For the fullscreen mode, I suggest you have a look here for the theory : http://java=2Esun=2Ecom/docs/books/tutorial/extra/fullscreen/index=2Ehtml And at Kenneth Russel's JCanyon source code for the practice (classes terrain and screenResSelector if I remember well) : http://java=2Esun=2Ecom/products/jfc/tsc/articles/jcanyon/ Regards, Alban Cousini=E9 http://www=2Emind2machine=2Ecom tel : +33 491 246 734 fax : +33 491 246 702 |