Menu

OpenGL 4.5 and new extension

Help
2016-09-14
2016-09-19
  • Massimo Zanoletti

    Hi guys

    I need to change the behavior on how contexts are released.
    I should use the OpenGL 4.5 extension KHR_context_flush_control and try to set a different value t change the behavior (probably I should try the GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH (0x82FC) value).

    Any suggestion on how to to it?

    Thanks in advance
    Massimo

     
  • Jerome.D (BeanzMaster)

    Hi, Massimo for using opengl 4.5 functions you must set forwardContext property to true in the GLScene Buffer if i'm remember. And after you can use DirectOpenGL component, depend of what you want to exactly. Perhaps you will need to use a Shader or what ever ?

    check also this thread : https://sourceforge.net/p/glscene/discussion/93605/thread/423d2ca0/

     
  • Massimo Zanoletti

    I try to show situation

    My application is for broadcasting graphics on tv.
    Customer designs graphics and then play on air filling with runtime contents.
    Usually customer has different kind of graphics (called template), one for each situation: for example one for subtitling during a news, another one for forecast, and for results in a sport match, and so on.
    Each of these different templates are different GlScene scenes, because graphics can be played on air in the same time (I want to play news subtitling together with logo station and time, for example)
    To be "reactive" as much as possible (tv operators are not patient) all scenes are "prepared" during the startup of the project. During the preparing session, the scene is fully loaded in memory (all objects), so system can know how the scene is and can know all contents to be exposed ti user.
    After the preparation, OpenGL contexts are released before to prepare the next scene. This to not exahust OpenGL resources.They will be reallocated only when the scene will be playd on air.
    Unfortunately we found that OpenGL contexts are not released as requested, so after some prepare operations (the number depends on conditions and driver version) ths system hangs.
    We contacted nVidia and they confirmed the bug.
    Also they suggested to try to change the default behavior of contexts release, trying to use the extension I wrote before.

     
  • Jerome.D (BeanzMaster)

    Hi, perhaps stupid, but why do you use many GLScene Scene Component and not just load template in only one (with the help of DummyCube object, one by template) ?. For fixing this like i say 1st you need set ForwardContext for using OpenGL 3.3 and up functions. After we must changed the code inside glscene at low level (probably in glstates.pas, glcontext.pas, glscene.pas and/or in 1 or 2 others files)
    but we need finding where in source do the "change the default behavior of contexts release". When i'll have a little i'll try to find where and how.

     
  • Jerome.D (BeanzMaster)

    check in glscene.pas line 8200 procedure TGLSceneBuffer.DestroyRC;

     
  • Massimo Zanoletti

    Hi Jerome

    The reasons to use many different scenes are:
    - Scenes are builded directly by end user (we provide a designer). To handle just one scene with a lot of elements inside will be too much complex. For end users it's simplier to have different scenes, each of them handling just elements it needs
    - Performances goes down when a scene has a lot of object inside..
    - Elements (scenes) must be played independently. This means that each scene must have its timeline (its time), that for sure will be different from others. User starts a scene when another one is already playing. The same for stopping.

    About your suggestion, I presume you mean to take a look here:

    procedure TGLSceneBuffer.DestroyRC;
    begin
    if Assigned(FRenderingContext) then
    begin
    Melt;
    // for some obscure reason, Mesa3D doesn't like this call... any help welcome
    FreeAndNil(FSelector);
    FreeAndNil(FRenderingContext);
    if Assigned(FCamera) and Assigned(FCamera.FScene) then
    FCamera.FScene.RemoveBuffer(Self);
    end;
    end;

     
  • Jerome.D (BeanzMaster)

    Hi Massimo

    Ok i understand better :)

    I presume you mean to take a look here:

    yes see more deeply also in FScene.RemoveBuffer and i think also take look into GLContext.pas and of the object herited from TGLContext :

    procedure DoCreateContext(ADeviceHandle: HDC); virtual; abstract;
    procedure DoCreateMemoryContext(outputDevice: HWND; width, height: Integer; BufferCount: integer=1); virtual; abstract;
    function DoShareLists(aContext: TGLContext): Boolean; virtual; abstract;
    procedure DoDestroyContext; virtual; abstract;
    procedure DoActivate; virtual; abstract;
    procedure DoDeactivate; virtual; abstract;
    

    I'm forgot one thing, by using ForwardContext property to true for accesing to the OpenGL 3.3 and up extensions. You must use Vertex and Fragment shader for lighting and texturing your objects

     

    Last edit: Jerome.D (BeanzMaster) 2016-09-19

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.