We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › Processing, Gestalt, Eclipse
Page Index Toggle Pages: 1
Processing, Gestalt, Eclipse (Read 869 times)
Processing, Gestalt, Eclipse
Aug 11th, 2009, 5:46pm
 
Hi,

I've been trying to play around with the Gestalt Processing plugin in eclipse. When I try to run any of the demo programs I get the following error

Code:
Exception in thread "Animation Thread" java.lang.NoSuchFieldError: canvas
at gestalt.p5.GestaltPlugIn.create(GestaltPlugIn.java:199)
at gestalt.p5.GestaltPlugIn.<init>(GestaltPlugIn.java:131)
at gestalt.p5.GestaltPlugIn.<init>(GestaltPlugIn.java:96)
at gestalt.demo.processing.UsingOpenGL.setup(UsingOpenGL.java:57)
at processing.core.PApplet.handleDraw(PApplet.java:1403)
at processing.core.PApplet.run(PApplet.java:1328)
at java.lang.Thread.run(Unknown Source)


And here's the code for the demo I'm trying to run

Code:



package gestalt.demo.processing;


import javax.media.opengl.GL;
import javax.media.opengl.glu.GLU;

import gestalt.context.GLContext;
import gestalt.p5.GestaltPlugIn;
import gestalt.render.bin.RenderBin;
import gestalt.shape.AbstractDrawable;

import processing.core.PApplet;



public class UsingOpenGL
extends PApplet {

private GestaltPlugIn gestalt;

public void setup() {
/* setup p5 */
size(640, 480, OPENGL);

/* create gestalt plugin */
gestalt = new GestaltPlugIn(this);

/* remove all gestalt presets */
RenderBin myRenderBin = new RenderBin();
gestalt.setBinRef(myRenderBin);
myRenderBin.add(new RawOpenGL());
}


public void draw() {
background(0);
}


private class RawOpenGL
extends AbstractDrawable {

public void draw(final GLContext theContext) {
GL gl = gestalt.getGL();
GLU glu = gestalt.getGLU();

gl.glViewport(0, 0, width, height);
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluPerspective(45.0f,
(float) width / (float) height,
1.0,
20.0);

gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glLoadIdentity();

gl.glTranslatef( -1.5f, 0.0f, -6.0f);
gl.glBegin(GL.GL_TRIANGLES);
gl.glColor3f(1.0f, 0.0f, 0.0f);
gl.glVertex3f(0.0f, 1.0f, 0.0f);
gl.glColor3f(0.0f, 1.0f, 0.0f);
gl.glVertex3f( -1.0f, -1.0f, 0.0f);
gl.glColor3f(0.0f, 0.0f, 1.0f);
gl.glVertex3f(1.0f, -1.0f, 0.0f);
gl.glEnd();

gl.glTranslatef(3.0f, 0.0f, 0.0f);
gl.glBegin(GL.GL_QUADS);
gl.glColor3f(0.5f, 0.5f, 1.0f);
gl.glVertex3f( -1.0f, 1.0f, 0.0f);
gl.glVertex3f(1.0f, 1.0f, 0.0f);
gl.glVertex3f(1.0f, -1.0f, 0.0f);
gl.glVertex3f( -1.0f, -1.0f, 0.0f);
gl.glEnd();
}
}


public static void main(String[] args) {
PApplet.main(new String[] {UsingOpenGL.class.getName()});
}
}


Any ideas?

Thanks for you help
Re: Processing, Gestalt, Eclipse
Reply #1 - Aug 12th, 2009, 2:01pm
 
Ok looking at GestaltPlugIn.java it has
Code:
	     

/* register event listener */
/** @todo JSR-231 -- gl here are you */
( (PGraphicsOpenGL) parent.g).canvas.addMouseMotionListener( (JoglEventHandler) event());
( (PGraphicsOpenGL) parent.g).canvas.addMouseWheelListener( (JoglEventHandler) event());
( (PGraphicsOpenGL) parent.g).canvas.addMouseListener( (JoglEventHandler) event());
( (PGraphicsOpenGL) parent.g).canvas.addKeyListener( (JoglEventHandler) event());


It's casting the parent.g to PGraphicsOpenGL right?

But PGraphicsOpenGL doesn't seem to have canvas object. So am I just using incompatible versions of Processing and Gestalt?

I'm using gestalt-dist-516 and processing 1.0.6 latest versions of both I think. Are these incompatible? If so which versions should i be using together?
Page Index Toggle Pages: 1