draw Triangle3D with OpenGL

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

draw Triangle3D with OpenGL

JolyJ
Hye,

I've seen some you work with OpenGL too. I'm new and I've done OpenGL-Lessons from the parcel of the same name. I've also seen that OpenGl objects are available and I'm interested because in my project I need to draw few objects (contrary to lessons).
so I tried this code:

     context whileCurrentDo:
               [self initializeSettings.
                             self initializeViewport].
            renderJob := OpenGL.Animation named: 'render' do:
                                      [:job | [isRunning] whileTrue:
                                              [context whileCurrentDo:
                                                    [self render.
                                                     context flush].
                                               job pause].].].
            renderJob resume.

Then in initializeSettings I call a function initTriangle:

        triangle := OpenGLObjects.Triangle3D a: (-2,  2,  0.5, 1) b: (2,  2,  0.5, 1) c: (-2, -2, -0.5, 1).

and here my render function:

        gl Clear: (gl COLOR_BUFFER_BIT bitOr: gl DEPTH_BUFFER_BIT).
        program use.
        triangle glVextex.
        program unuse


It render nothing and  have a message error: not understood: #glNormal. (fromglVextex).
Does someone know how to use Opengl objects to render a triangles or quads3D for exemple ? It's maybe a simple sorry, be indulgent I'm a beginner.

Thank you, cheers,

JolyJ