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 › accessin gl class from inside a subclass
Page Index Toggle Pages: 1
accessin gl class from inside a subclass (Read 344 times)
accessin gl class from inside a subclass
Jul 11th, 2009, 1:44am
 
Hi ive made a program and im using the opengl comnamd from the openglapi, using import javax.media.opengl.GL; and glgraphics

for accessing to the opengl commands i need to do :  
GLGraphics renderer = (GLGraphics)g;
 GL gl = renderer.beginGL(); in then i can acces to the opengl commands in this way:   gl.glRotatef(144 * - 0.1, 0, 0, 0.5);

this works if when im in the main draw but what about if a wanna access to the gl commands from inside a class?

if i try  gl.glRotatef(233, 1, 0, 1); inside a function of a class i get : "canot find anything named "gl", ive also tried "name_of_my_app".this.gl. gl.glRotatef(144 * - 0.1, 0, 0, 0.5);

any idea of how can i do this?


thanks


pun.
Re: accessin gl class from inside a subclass
Reply #1 - Jul 11th, 2009, 2:10am
 
Just declare gl at the top of your sketch.
Re: accessin gl class from inside a subclass
Reply #2 - Jul 11th, 2009, 2:57am
 
hi, if i declare gl at the top of my sketch the app runs without erros ,  but the "gl.glTranslatef(13,2, 0); "  i have inside the class doesnt affect each object individually  , in other words they do nothing.

Any idea of why is this?


thanks
Re: accessin gl class from inside a subclass
Reply #3 - Jul 11th, 2009, 10:08am
 
Sounds like there may be some other errors in your code. The GL commands wouldn't just do nothing without errors. Can you post some code? Maybe the class function you're talking about?
Page Index Toggle Pages: 1