Hi Hernan,

I just added two new examples, UFFIOpenGLOffscreenSamples >> #triangle and
UFFIOpenGLOffscreenSamples >> #quad (using your vertices). I tested it on
Linux and on OS X.

triangle
    "
    self new triangle
    "
    | context gl fb colorProgram vertexBuffer |
    context := UFFIOpenGLContext new.
    colorProgram := self colorProgramFor: context.
    vertexBuffer := self immutableVertexBufferFor: context
withPackedFloats: {
        "   x      y     z     r     g     b     a "
        { -0.5 . 0.5 . 0.0 . 1.0 . 0.0 . 0.0 . 1.0 }.
        {  0.5 . 0.5 . 0.0 . 0.0 . 1.0 . 0.0 . 1.0 }.
        {  0.0 . -0.5 . 0.0 . 0.0 . 0.0 . 1.0 . 1.0 }.
    }.

    gl := context gl.
    fb := context offscreenBufferExtent: 640@480.

    context asCurrentDo: [
        fb activate.
        gl
            viewport_x: 0 y: 0 width: 640 height: 480;

            clearColor_red: 0.0 green: 0.0 blue: 0.0 alpha: 1.0;
            clear: GL_COLOR_BUFFER_BIT;

            useProgram: colorProgram validHandle;

            bindBuffer_target: GL_ARRAY_BUFFER buffer: vertexBuffer
validHandle.
        self activateDefaultVertexLayoutOn: context.

        gl drawArrays_mode: GL_TRIANGLES first: 0 count: 3
    ].

    fb asForm asMorph openInWindow.

Best regards,
Ronie

El mar., 13 nov. 2018 a las 1:23, Ben Coman (<[email protected]>)
escribió:

>
>
> On Tue, 13 Nov 2018 at 03:37, Hernán Morales Durand <
> [email protected]> wrote:
>
>> Hi.
>>
>> I tried to get an OpenGL MWE from
>> https://github.com/ronsaldo/uffi-opengl in both Windows 8.1 and MacOS
>> without luck. What I tried so far is to render a simple figure in a
>> new window, adding this method to UFFIOpenGLOffscreenSamples:
>>
>
> You may also be interested in "Use Metal instead of OpenGL for the main VM
> Window in OS X" ...
> https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/306
>
> cheers -ben
>

Reply via email to