Results 1 to 5 of 5

Thread: Drawing two Rendering Context in same time.

  1. #1
    Junior Member
    Join Date
    Oct 2006
    Posts
    28

    Drawing two Rendering Context in same time.

    Hi.
    In order to draw two rendering context at same time in one window app.
    I declared two EGLDisplay, EGLSurface, EGLContext.
    and I did each initialization.
    after that,
    I call eglMakeCurrent(); before I call each draw() function.
    But, it's don't work well.

    how can i do that?

  2. #2
    Member
    Join Date
    Sep 2003
    Location
    Silicon Valley
    Posts
    57

    Re: Drawing two Rendering Context in same time.

    You cannot have more than one OpenGL ES rendering context bound to a single thread simultaneously. It does not matter whether or not the contexts were created on different EGLDisplays or not; this restriction is inherent to the API design choice of using an implicit rendering context.

    So if you want to render to two contexts "simultaneously", you'll need to be rendering from two threads. I put "simultaneously" in quotes because the GPU is probably not itself multithreaded => you may sustain large performance drops due to GPU context switching (though this is very implementation- and platform-specific).
    Jon Leech
    EGL & OpenGL Specification Editor / OpenGL ARB Ecosystem TSG Chair / Khronos API Registrar

  3. #3
    Junior Member
    Join Date
    Oct 2006
    Posts
    28
    Thanks, oddhack.

    I already render two thread.
    In my application, First Context is MFC Main Window View and Second Context is created by modeless dialog box.

    my code flow like that...

    Modeless Dialog Box create()
    {
    Second Context created...
    }

    Main window Initialize()
    {
    First Context created...
    }

    Main window Draw()
    {
    eglMakeCurrent(First Context, Fist Display, Fisrt Surface)
    draw.........
    ..............
    }

    Modeless Dialog Box Draw()
    {
    eglmakeCurrent(Second Context, Second Display, Second Surface)
    draw.........(in picture box control(MFC))...
    .....
    }

    the result is two context is added and displayed only modeless dialog RECT area.

    I have problem??

  4. #4

    Re: Drawing two Rendering Context in same time.

    As Jon said, it's not possible directly. Going multithreaded is the simplest and the most performance hungry way to do it, if your OpenGL / EGL is capable of supporting multiple contexts at all.

    Quote Originally Posted by danielkim
    I call eglMakeCurrent(); before I call each draw() function.
    But, it's don't work well.
    If you prefix your rendering calls with eglMakeCurrent, it should to work without problems. You don't have to do this for every draw call. It's sufficient if you do it every time you change the rendering context.

    However, I have my doubts (and some bad experience on pocketpc) that multiple context rendering from a single thread is supported and tested in all EGL implementations.

    Most EGL implementations I've seen so far only do the bare minimum, or even less.

    What EGL / OpenGL implementation are you using?

    Regards,
    Nils Pipenbrinck

  5. #5
    Junior Member
    Join Date
    Oct 2006
    Posts
    28
    My application is developed on desktop.
    So I use the PowerVR OpenGL ES libraries(PC Version)

    That is support??

    If it's possible..
    I guess the bad result is my mistake...

    Can I get some example code?

Similar Threads

  1. Simple 2D drawing one pixel at a time
    By Progman3K in forum OpenGL ES general technical discussions
    Replies: 1
    Last Post: 01-20-2013, 01:43 PM
  2. Replies: 2
    Last Post: 04-26-2010, 08:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •