Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22229/src/net/sourceforge/bprocessor/gl
Modified Files:
GLView.java
Log Message:
Changed from GlCanvas to GLJPanel to get rid of invalid drawable error.
Added a minimum and maximum size to GLJPanel
Added an animator to get updates.
Index: GLView.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/GLView.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** GLView.java 5 Aug 2005 11:00:45 -0000 1.6
--- GLView.java 11 Aug 2005 13:23:20 -0000 1.7
***************
*** 7,10 ****
--- 7,12 ----
package net.sourceforge.bprocessor.gl;
+ import java.awt.Dimension;
+
import net.sourceforge.bprocessor.gl.tool.Tool;
import net.sourceforge.bprocessor.gl.tool.ToolFactory;
***************
*** 13,19 ****
import net.sourceforge.bprocessor.gui.GUI;
! import net.java.games.jogl.GLCanvas;
import net.java.games.jogl.GLCapabilities;
import net.java.games.jogl.GLDrawableFactory;
import org.apache.log4j.Logger;
--- 15,22 ----
import net.sourceforge.bprocessor.gui.GUI;
! import net.java.games.jogl.Animator;
import net.java.games.jogl.GLCapabilities;
import net.java.games.jogl.GLDrawableFactory;
+ import net.java.games.jogl.GLJPanel;
import org.apache.log4j.Logger;
***************
*** 27,31 ****
/** GL canvas */
! private GLCanvas glc;
/** current event listener */
--- 30,34 ----
/** GL canvas */
! private GLJPanel glc;
/** current event listener */
***************
*** 34,37 ****
--- 37,43 ----
/** current working tool */
private Tool tool;
+
+ /** The animator */
+ private Animator animator;
/**
***************
*** 39,49 ****
*/
public GLView() {
GLCapabilities glCap = new GLCapabilities();
glCap.setDoubleBuffered(true);
glCap.setHardwareAccelerated(true);
! glc = GLDrawableFactory.getFactory().createGLCanvas(glCap);
view = ViewFactory.getFactory(this).getDefault();
glc.addGLEventListener(view);
tool = ToolFactory.getFactory(this).getDefault();
--- 45,58 ----
*/
public GLView() {
+ log.info("Creating GLView");
GLCapabilities glCap = new GLCapabilities();
glCap.setDoubleBuffered(true);
glCap.setHardwareAccelerated(true);
! glc = GLDrawableFactory.getFactory().createGLJPanel(glCap);
view = ViewFactory.getFactory(this).getDefault();
glc.addGLEventListener(view);
+ glc.setMinimumSize(new Dimension(320, 0));
+ glc.setMaximumSize(new Dimension(1024, 768));
tool = ToolFactory.getFactory(this).getDefault();
***************
*** 51,59 ****
--- 60,87 ----
glc.addMouseMotionListener(tool);
glc.addKeyListener(tool);
+ animator = new Animator(glc);
+ start();
GUI.getInstance().registerPanel(glc, GUI.SPLIT_MIDDLE);
+ log.info("Done Creating GlView");
+ }
+
+ /**
+ * Start the animator
+ *
+ */
+ public void start() {
+ animator.start();
}
/**
+ * Stop the animator
+ *
+ */
+ public void stop() {
+ animator.stop();
+ }
+
+ /**
* Change the tool
* @param mode The new tool
|