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 OpenGL resources
Page Index Toggle Pages: 1
Processing OpenGL resources? (Read 1166 times)
Processing OpenGL resources?
Dec 8th, 2009, 1:03am
 
I can find basic processing help fine, and have a good grasp on the language, since it's almost identical to actionscript 3, but with a name like "processing," Google doesn't come up with much when you add terms like "OpenGL," as it is a verb, and you end up with unrelated results. I was surprised to find there were no stickies in this board for learning OpenGL in processing. Does anyone know the best resources for this?
Re: Processing OpenGL resources?
Reply #1 - Dec 8th, 2009, 2:29am
 
there are some here:

http://processing.org/learning/libraries/ and here
http://processing.org/reference/libraries/opengl/index.html

but i think one of the ideas behind processing is to hide all the opengl detail from the developer and that the opengl renderer is just an alternative to the p3d renderer.

if you're determined to learn raw opengl then look for jogl tutorials as that's what processing uses underneath. you have access to the opengl context using

GL gl = ((PGraphicsOpenGL)g).gl;
Re: Processing OpenGL resources?
Reply #2 - Dec 8th, 2009, 8:30pm
 
What's the motive behind hiding the OpenGL library behind P3D if it's faster and better?
Re: Processing OpenGL resources?
Reply #3 - Dec 9th, 2009, 1:56am
 
simplicity

Code:

glBegin(GL_QUADS); // Start Drawing Quads
// Bottom Face
glVertex3f(-1.0f, -1.0f, -1.0f); // Top Right Of The Texture and Quad
glVertex3f( 1.0f, -1.0f, -1.0f); // Top Left Of The Texture and Quad
glVertex3f( 1.0f, -1.0f, 1.0f); // Bottom Left Of The Texture and Quad
glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Right Of The Texture and Quad
// Front Face
glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Left Of The Texture and Quad
glVertex3f( 1.0f, -1.0f, 1.0f); // Bottom Right Of The Texture and Quad
glVertex3f( 1.0f, 1.0f, 1.0f); // Top Right Of The Texture and Quad
glVertex3f(-1.0f, 1.0f, 1.0f); // Top Left Of The Texture and Quad
// Back Face
glVertex3f(-1.0f, -1.0f, -1.0f); // Bottom Right Of The Texture and Quad
glVertex3f(-1.0f, 1.0f, -1.0f); // Top Right Of The Texture and Quad
glVertex3f( 1.0f, 1.0f, -1.0f); // Top Left Of The Texture and Quad
glVertex3f( 1.0f, -1.0f, -1.0f); // Bottom Left Of The Texture and Quad
// Right face
glVertex3f( 1.0f, -1.0f, -1.0f); // Bottom Right Of The Texture and Quad
glVertex3f( 1.0f, 1.0f, -1.0f); // Top Right Of The Texture and Quad
glVertex3f( 1.0f, 1.0f, 1.0f); // Top Left Of The Texture and Quad
glVertex3f( 1.0f, -1.0f, 1.0f); // Bottom Left Of The Texture and Quad
// Left Face
glVertex3f(-1.0f, -1.0f, -1.0f); // Bottom Left Of The Texture and Quad
glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Right Of The Texture and Quad
glVertex3f(-1.0f, 1.0f, 1.0f); // Top Right Of The Texture and Quad
glVertex3f(-1.0f, 1.0f, -1.0f); // Top Left Of The Texture and Quad
glEnd();


vs

Code:

box(1.0);


8)
Re: Processing OpenGL resources?
Reply #4 - Dec 11th, 2009, 2:19pm
 
koogy wrote on Dec 9th, 2009, 1:56am:
simplicity

Code:

glBegin(GL_QUADS); // Start Drawing Quads
// Bottom Face
glVertex3f(-1.0f, -1.0f, -1.0f); // Top Right Of The Texture and Quad
glVertex3f( 1.0f, -1.0f, -1.0f); // Top Left Of The Texture and Quad
glVertex3f( 1.0f, -1.0f,  1.0f); // Bottom Left Of The Texture and Quad
glVertex3f(-1.0f, -1.0f,  1.0f); // Bottom Right Of The Texture and Quad
// Front Face
glVertex3f(-1.0f, -1.0f,  1.0f); // Bottom Left Of The Texture and Quad
glVertex3f( 1.0f, -1.0f,  1.0f); // Bottom Right Of The Texture and Quad
glVertex3f( 1.0f,  1.0f,  1.0f); // Top Right Of The Texture and Quad
glVertex3f(-1.0f,  1.0f,  1.0f); // Top Left Of The Texture and Quad
// Back Face
glVertex3f(-1.0f, -1.0f, -1.0f); // Bottom Right Of The Texture and Quad
glVertex3f(-1.0f,  1.0f, -1.0f); // Top Right Of The Texture and Quad
glVertex3f( 1.0f,  1.0f, -1.0f); // Top Left Of The Texture and Quad
glVertex3f( 1.0f, -1.0f, -1.0f); // Bottom Left Of The Texture and Quad
// Right face
glVertex3f( 1.0f, -1.0f, -1.0f); // Bottom Right Of The Texture and Quad
glVertex3f( 1.0f,  1.0f, -1.0f); // Top Right Of The Texture and Quad
glVertex3f( 1.0f,  1.0f,  1.0f); // Top Left Of The Texture and Quad
glVertex3f( 1.0f, -1.0f,  1.0f); // Bottom Left Of The Texture and Quad
// Left Face
glVertex3f(-1.0f, -1.0f, -1.0f); // Bottom Left Of The Texture and Quad
glVertex3f(-1.0f, -1.0f,  1.0f); // Bottom Right Of The Texture and Quad
glVertex3f(-1.0f,  1.0f,  1.0f); // Top Right Of The Texture and Quad
glVertex3f(-1.0f,  1.0f, -1.0f); // Top Left Of The Texture and Quad
glEnd();


vs

Code:

box(1.0);


8)

It looks like you included texture unwrapping and stuff in the top one though. I suspect intentional lengthening to illustrate a point, and highly doubt there are no primitives in OpenGL.
Page Index Toggle Pages: 1