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 & HelpSyntax Questions › Strange GLGraphics Undefinded Constructor Problem
Page Index Toggle Pages: 1
Strange GLGraphics Undefinded Constructor Problem (Read 705 times)
Strange GLGraphics Undefinded Constructor Problem
Dec 14th, 2009, 2:19pm
 
Hey,
I'm getting the "constructor undefined" message when im trying to intialize some GLGraphics Textures inside a class. (The class itself is part of an ArrayList, but i don´t think that´s the problem).

If i copy/paste the same code into the void setup routine everything works fine. So I think it´s a syntax problem, with the "this" Statement. Unfortunately I can´t figure it out by myself  :-/.
So any help would be great!

Chris

Here is a part of my code, with the "problem class". I get an Error for all three constructors.


Code:
import codeanticode.glgraphics.*;

class Scheibe{
 PVector XYZ;

 Scheibe(PVector x){
   GLGraphicsOffScreen tafel = new GLGraphicsOffScreen(this, width, height);
   GLTexture  tex0 = new GLTexture(this, width, height);
   GLTexture tex1 = new GLTexture(this, width, height);
   XYZ=x;
 }
//....
}
Re: Strange GLGraphics Undefinded Constructor Problem
Reply #1 - Dec 14th, 2009, 11:39pm
 
The this in your code refers to the object of your Scheibe class. You need to pass a PApplet object.

http://users.design.ucla.edu/~acolubri/processing/glgraphics/home/doc/html/codeanticode/glgraphics/GLGraphicsOffScreen.html
Re: Strange GLGraphics Undefinded Constructor Problem
Reply #2 - Dec 15th, 2009, 1:07am
 
Thanks, i thought it must be somethin like this.
But i still have two problems:

1. If i pass a new PApplet, won´t this slowdown my code? (Speed is of the essence) So is there a way to pass the parent PApplett?

2. Somehow i mess up the syntax of initializing a new PApplett. (Never done that before) So I get error messages over and over again. How can i do this the right way.

Thanks!
Chris
Re: Strange GLGraphics Undefinded Constructor Problem
Reply #3 - Dec 15th, 2009, 1:24am
 
No don't create a new applet, use the one from your sketch.

You could try this:

GLTexture  tex0 = new GLTexture(NameOfYourSketch.this, width, height);
Re: Strange GLGraphics Undefinded Constructor Problem
Reply #4 - Dec 15th, 2009, 2:13am
 
Ah, now i got it.
Works perfect. Thanks!
Page Index Toggle Pages: 1