Results 1 to 6 of 6

Thread: Minimal OGL Framework

  1. #1

    Minimal OGL Framework

    Hi All,

    I couldn`t get my old ogl template to compile anymore with delphi 2009 do to some xml libs I used. Also it had gotten pretty cluttered over the years so I decided to write a new minimal template. It has:

    - OGL 3.2 backwards competible (when supported)render window with input
    - FPS camera
    - Rendering of text
    - Loading of textures

    Source is only 20 kb in size Source like always is LGPL.

    http://www.genesisdevice.net/downloads/framework.zip

    Grz

    Luuk

  2. #2

    Re: Minimal OGL Framework

    Let me make it clear - is this template OpenGL 3.x compatible?

  3. #3

    Re: Minimal OGL Framework

    Cool... thanks for this one.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  4. #4

    Re: Minimal OGL Framework

    Most minimal ;)
    [code=pascal] program min_ogl;

    uses
    Windows, OpenGL;

    var
    pfd : TPixelFormatDescriptor;
    DC : HDC;
    begin
    // Creating window
    DC := GetDC(CreateWindowEx(0, 'EDIT', nil, WS_POPUP or WS_VISIBLE, 0, 0, 640, 480, 0, 0, 0, nil));
    ShowCursor(False); // hide cursor
    // OpenGL initialization
    pfd.dwFlags := PFD_DRAW_TO_WINDOW or PFD_SUPPORT_OPENGL or PFD_DOUBLEBUFFER;
    SetPixelFormat(DC, ChoosePixelFormat(DC, @pfd), @pfd);
    wglMakeCurrent(DC, wglCreateContext(DC));
    // Main Loop
    while GetAsyncKeyState(27) = 0 do
    begin
    glBegin(GL_QUADS);
    glColor3f(1, 0, 0); glVertex2f(-0.4, -0.4);
    glColor3f(0, 1, 0); glVertex2f( 0.4, -0.4);
    glColor3f(0, 0, 1); glVertex2f( 0.4, 0.4);
    glColor3f(1, 0, 1); glVertex2f(-0.4, 0.4);
    glEnd;
    SwapBuffers(DC);
    end;
    end.[/code]

  5. #5

    Re: Minimal OGL Framework

    XProger, AFAIK it's not OpenGL 3.x compatible.

  6. #6

    Re: Minimal OGL Framework

    Indeed. I believe glVertex is deprecated.

    But it is a nice piece of code. Shows how easy it is to setup OGL.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

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
  •