Results 1 to 10 of 16

Thread: Jengine - OpenGL 3.3/4.x engine & JUI progress

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    PGD Staff / News Reporter phibermon's Avatar
    Join Date
    Sep 2009
    Location
    England
    Posts
    524
    Yes, quite a lot of the engine can be used stand-alone with minimum dependencies, here's some various snippets so you can see the coding style :

    Window Initialization

    WindowMan := TJWindowMan.Create(JDefaultWindowMan);
    WindowStartupProperties := JDefaultWindow;
    WindowStartupProperties.FullScreen := false;
    WindowStartupProperties.GLMajorVersion := 4;
    WindowStartupProperties.GLMinorVersion := 1;
    WindowStartupProperties.GLCoreProfile := true;
    WindowStartupProperties.GLForwardCompatible := false;

    WindowStartupProperties.OnCreate := @OnWindowCreate;
    WindowStartupProperties.OnDestroy := @OnWindowDestroy;
    WindowStartupProperties.OnExecute := @OnWindowExecute;
    WindowStartupProperties.Threaded := false;
    JWindow := Windowman.Createwindow(WindowStartupProperties);

    Scene & JUI Initialization

    Scene := TJScene.create(JWindow.ImageMan,JWindow.ShaderMan, JWindow.ModelMan);
    SceneView := TJSceneView.create(JWindow, Scene);

    JUIWindowMan := TJUIWindowMan.Create(JWindow);

    JUIWindowMan.Theme := TJUITheme.create;
    JUIGlobal.WindowMan := JUIWindowMan;

    JUIWindowMan.AttachJViewPort(SceneView);
    JAPTaskbar := TJAPTaskbar.Create(JUIWindowMan);
    JAPSceneTree := TJAPSceneTree.Create(JUIWindowMan, Scene);

    Example Render Loop

    FCamera.Look;
    {Set Shader Uniform buffers}
    FJWindow.ShaderMan.ModelViewMatrix := FCamera.ModelViewMatrix;
    FJWindow.ShaderMan.ProjectionMatrix := FCamera.ProjectionMatrix;
    FJWindow.PrimativeRenderer.Grid(vec3(-128,0,-12);
    FScene.DoRender;


    -----

    You may of noticed that JWindow contains the image, model and shader managers.

    While this might seem like an odd design decision it's simple enough : JWindowMan supports multiple windows across multiple monitors that the user might want to have their own resources/contexts. So everything that is specific to the context lives in JWindow. Shared contexts across multiple windows are handled by JWindowMan and you simply tell it which window you want to share with.
    Last edited by phibermon; 13-06-2011 at 01:26 PM.
    When the moon hits your eye like a big pizza pie - that's an extinction level impact event.

Bookmarks

Posting Permissions

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