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.
Page Index Toggle Pages: 1
Opengl syntax (Read 1857 times)
Opengl syntax
May 27th, 2010, 7:41am
 
Can someone post the processing syntax for the following opengl ?

glClearColor (0.0, 0.0, 0.0, 0.0);
 glClear (GL_COLOR_BUFFER_BIT);
 glColor3f (1.0, 1.0, 1.0);
 glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
 glBegin(GL_POLYGON);
    glVertex3f (0.25, 0.25, 0.0);
    glVertex3f (0.75, 0.25, 0.0);
    glVertex3f (0.75, 0.75, 0.0);
    glVertex3f (0.25, 0.75, 0.0);
 glEnd();
 glFlush();
Re: Opengl syntax
Reply #1 - May 27th, 2010, 9:20am
 
http://processing.org/reference/libraries/opengl/index.html

basically

 PGraphicsOpenGL pgl = (PGraphicsOpenGL) g;  // g may change
 GL gl = pgl.beginGL();  // always use the GL object returned by beginGL
 
then gl.glWhatever(); for methods and GL.GL_WHATEVER for constants.

then
 pgl.endGL();

Page Index Toggle Pages: 1