Hi, quick answer: almost, probably tomorrow. long answer: I have the changes on NBOpenGL-X needed to make it work on Linux in my image, but they are quite a few and I have to dedicate some time to upload them. Tomorrow I'll try to commit to the ss repo. Before loading NBOpenGL-X you have to load NBXLib package, which lives in www.squeaksource.com/NBXLib, and contains the wrappers for XLib which is needed by glX. And I also have to commit changes there too. Maybe I can even try to write a configuration to load it, but I have to learn of metacello first. On Thu, Feb 23, 2012 at 8:15 PM, chadwick <mathnoir@gmail.com> wrote:
Hi, is this ready for Linux ? I tried loading NBOpenGL-X after but I got
This package depends on the following classes:
NBXLibConstants You must resolve these dependencies before you will be able to load these definitions: NBGLXContextDriver supportsCurrentPlatform createContext:
Also, I remember in OpenCroquet Squeak could parse positional arguments of the form ogl glThis(x,y,x); glThat(x,y,z); -- doesn't it make sense to bring this back, since most of the OpenGL code examples on the internet are in this form ?
On an unrelated note, I'm confused by this ConfigurationOf/Gofer/Montecello system. How do people new to Pharo find out what these URLs and special configuration loading code are ? Seems like everyone is just copying and pasting code from forums into workspaces. Couldn't these code fragments for loading configurations be loaded automatically via a URL or something ?
Yes, I look at the code needed to load the package I want on the mailing list or the pharo book, paste it in a workspace and doit. It's a bit embarrassing but that's what we've got for now, I hope in the future we'll have an UI that let people browse packages and install them by clicking a button.
On Fri, Feb 24, 2012 at 3:42 AM, Stéphane Ducasse < stephane.ducasse@inria.fr> wrote:
On Feb 22, 2012, at 11:22 PM, Lawson English wrote:
Thanks for that code, Stéphane. I'll work up a video tutorial on it once Igor gets his next configuration* set.
Excellent i was planning to do it but I'm flooded by work What I want is that every single person with zero knowledge can do it by following the videos. So if you can do that this is great.
Then I would like to have a 3 min videos showing live modification of openGL objects on the fly. You write in the browser and boom you see it on the screen.
Here are my notes.
MCHttpRepository location: 'http://www.squeaksource.com/NBOpenGL' user: '' password: ''
ConfigurationOfNBOpenGL project lastVersion load
GLTTRenderingDemo new openInWorld
GLViewportMorph subclass: #GLStef instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'NBOpenGL-Stef'
GLStef new openInWorld
render
| gl | self checkSession. gl := display gl. display clear: Color white.
+ refresh
gluperspective glfrustum
http://nehe.gamedev.net/article/replacement_for_gluperspective/21002/
perspectiveFovY: fovY aspect: aspect zNear: zNear zFar: zFar "Replaces gluPerspective. Sets the frustum to perspective mode. // fovY - Field of vision in degrees in the y direction // aspect - Aspect ratio of the viewport // zNear - The near clipping distance // zFar - The far clipping distance "
perspectiveFovY: fovY aspect: aspect zNear: zNear zFar: zFar "Replaces gluPerspective. Sets the frustum to perspective mode. // fovY - Field of vision in degrees in the y direction // aspect - Aspect ratio of the viewport // zNear - The near clipping distance // zFar - The far clipping distance " | fW fH | fH := (fovY / (360 * Float pi)) tan * zNear. "fH = tan( fovY / 360 * pi ) * zNear;" fW := fH * aspect. display gl frustum_left: fW negated right: fW bottom: fH negated top: fH zNear: zNear zFar: zFar
openGL cube tutorial
http://nehe.gamedev.net/tutorial/3d_shapes/10035/
glMatrixMode(GL_PROJECTION); // Select The Projection Matrix glLoadIdentity(); // Reset The Projection Matrix
// Calculate The Aspect Ratio Of The Window gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glLoadIdentity();
render
| gl | self checkSession. gl := display gl. display clear: Color white.
gl matrixMode: GL_PROJECTION; loadIdentity.
self perspectiveFovY: 45.0 aspect: (self width /self height) asFloat zNear: 0.1 zFar: 100.0.
gl matrixMode: GL_MODELVIEW. gl loadIdentity.
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer glLoadIdentity(); // Reset The Current Modelview Matrix glTranslatef(-1.5f,0.0f,-6.0f); // Move Left 1.5 Units And Into The Screen 6.0 glRotatef(rtri,0.0f,1.0f,0.0f); // Rotate The Triangle On The Y axis ( NEW ) glBegin(GL_TRIANGLES); // Start Drawing A Triangle glColor3f(1.0f,0.0f,0.0f); // Red glVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Front) glColor3f(0.0f,1.0f,0.0f); // Green glVertex3f(-1.0f,-1.0f, 1.0f); // Left Of Triangle (Front) glColor3f(0.0f,0.0f,1.0f); // Blue glVertex3f( 1.0f,-1.0f, 1.0f); // Right Of Triangle (Front) glColor3f(1.0f,0.0f,0.0f); // Red glVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Right) glColor3f(0.0f,0.0f,1.0f); // Blue glVertex3f( 1.0f,-1.0f, 1.0f); // Left Of Triangle (Right) glColor3f(0.0f,1.0f,0.0f); // Green glVertex3f( 1.0f,-1.0f, -1.0f); // Right Of Triangle (Right) glColor3f(1.0f,0.0f,0.0f); // Red glVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Back) glColor3f(0.0f,1.0f,0.0f); // Green glVertex3f( 1.0f,-1.0f, -1.0f); // Left Of Triangle (Back) glColor3f(0.0f,0.0f,1.0f); // Blue glVertex3f(-1.0f,-1.0f, -1.0f); // Right Of Triangle (Back) glColor3f(1.0f,0.0f,0.0f); // Red glVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Left) glColor3f(0.0f,0.0f,1.0f); // Blue glVertex3f(-1.0f,-1.0f,-1.0f); // Left Of Triangle (Left) glColor3f(0.0f,1.0f,0.0f); // Green glVertex3f(-1.0f,-1.0f, 1.0f); // Right Of Triangle (Left) glEnd(); // Done Drawing The Pyramid
glLoadIdentity(); // Reset The Current Modelview Matrix glTranslatef(1.5f,0.0f,-7.0f); // Move Right 1.5 Units And Into The Screen 7.0 glRotatef(rquad,1.0f,1.0f,1.0f); // Rotate The Quad On The X axis ( NEW ) glBegin(GL_QUADS); // Draw A Quad glColor3f(0.0f,1.0f,0.0f); // Set The Color To Green glVertex3f( 1.0f, 1.0f,-1.0f); // Top Right Of The Quad (Top) glVertex3f(-1.0f, 1.0f,-1.0f); // Top Left Of The Quad (Top) glVertex3f(-1.0f, 1.0f, 1.0f); // Bottom Left Of The Quad (Top) glVertex3f( 1.0f, 1.0f, 1.0f); // Bottom Right Of The Quad (Top) glColor3f(1.0f,0.5f,0.0f); // Set The Color To Orange glVertex3f( 1.0f,-1.0f, 1.0f); // Top Right Of The Quad (Bottom) glVertex3f(-1.0f,-1.0f, 1.0f); // Top Left Of The Quad (Bottom) glVertex3f(-1.0f,-1.0f,-1.0f); // Bottom Left Of The Quad (Bottom) glVertex3f( 1.0f,-1.0f,-1.0f); // Bottom Right Of The Quad (Bottom) glColor3f(1.0f,0.0f,0.0f); // Set The Color To Red glVertex3f( 1.0f, 1.0f, 1.0f); // Top Right Of The Quad (Front) glVertex3f(-1.0f, 1.0f, 1.0f); // Top Left Of The Quad (Front) glVertex3f(-1.0f,-1.0f, 1.0f); // Bottom Left Of The Quad (Front) glVertex3f( 1.0f,-1.0f, 1.0f); // Bottom Right Of The Quad (Front) glColor3f(1.0f,1.0f,0.0f); // Set The Color To Yellow glVertex3f( 1.0f,-1.0f,-1.0f); // Top Right Of The Quad (Back) glVertex3f(-1.0f,-1.0f,-1.0f); // Top Left Of The Quad (Back) glVertex3f(-1.0f, 1.0f,-1.0f); // Bottom Left Of The Quad (Back) glVertex3f( 1.0f, 1.0f,-1.0f); // Bottom Right Of The Quad (Back) glColor3f(0.0f,0.0f,1.0f); // Set The Color To Blue glVertex3f(-1.0f, 1.0f, 1.0f); // Top Right Of The Quad (Left) glVertex3f(-1.0f, 1.0f,-1.0f); // Top Left Of The Quad (Left) glVertex3f(-1.0f,-1.0f,-1.0f); // Bottom Left Of The Quad (Left) glVertex3f(-1.0f,-1.0f, 1.0f); // Bottom Right Of The Quad (Left) glColor3f(1.0f,0.0f,1.0f); // Set The Color To Violet glVertex3f( 1.0f, 1.0f,-1.0f); // Top Right Of The Quad (Right) glVertex3f( 1.0f, 1.0f, 1.0f); // Top Left Of The Quad (Right) glVertex3f( 1.0f,-1.0f, 1.0f); // Bottom Left Of The Quad (Right) glVertex3f( 1.0f,-1.0f,-1.0f); // Bottom Right Of The Quad (Right) glEnd(); // Done Drawing The Quad
rtri+=0.2f; // Increase The Rotation Variable For The Triangle ( NEW ) rquad-=0.15f; // Decrease The Rotation Variable For The Quad ( NEW ) return TRUE; // Keep Going
L.
On 2/22/12 2:11 PM, Stéphane Ducasse wrote:
Igor coded with me one hour to show me step by step how to produce a
rotating pyramid in Pharo :)
Have fun (igor will update the configurationOfNBOpenGL to load the
latest file).
-- Lic. Javier Pimás Ciudad de Buenos Aires