Several contextS in TinyGL
  • Caterpillar
    Caterpillar
    Posts: 33 from 2013/6/20
    How can I manage several GL contextS with TinyGL

    It seems that we start MiniGL with something like this

    TinyGLBase = OpenLibrary("tinygl.library", 0);
    tgl_context=GLInit();
    glAInitializeContextBitMap(tgl_context,bm);

    But if I want to have several contexts: context1 context2 in a same binary (*) (contexts that use differents bitmaps ) then How can I choose the current context so a (say)
    glClear(GL_COLOR_BUFFER_BIT);
    will took effect on context2 not context1

    To select a context Windows got this fonction
    wglMakeCurrent (hdc,hglrc);
    And ArosMesa got this one
    AROSMesaMakeCurrent(ctx);

    But what is the "Select a given GL context" function in TinyGL ????

    Many Thanks

    Alain Thellier

    (*) In fact it is for Wazp3D. Wazp3D truly need to manage several GL contexts
  • »07.11.13 - 13:17
    Profile Visit Website
  • MorphOS Developer
    Henes
    Posts: 507 from 2003/6/14
    All tinygl.library functions are macros defined this way:
    #define glFoo(a, b) GLFoo(__tglcontext, a, b)
    See tgl/gl.h

    So just change current context this way:
    __tglcontext = yourcontext;
  • »07.11.13 - 13:27
    Profile Visit Website
  • Caterpillar
    Caterpillar
    Posts: 33 from 2013/6/20
    OK many thanks Henes I will compile that tonight...

    Other question : I have readed here
    http://www.nonsoloamiga.com/index.php?topic=757.0
    that after creating a context this way
    TinyGLBase = OpenLibrary("tinygl.library", 0);
    tgl_context=GLInit();
    glAInitializeContextBitMap(tgl_context,bm);

    that glASwapBuffers(tgl_context); is needed to make a frame update

    Is it true ? I was supposing that there is no double-buffering in this case so that all is already drawn in the bitmap
    so that i only need a
    glFlush();
    glFinish();
    to make a frame update

    Alain
  • »07.11.13 - 14:01
    Profile Visit Website