Results 1 to 7 of 7

Thread: OpenGL and Multisample

  1. #1

    OpenGL and Multisample

    Hi all,

    Yet more problems (as such)...

    Originally i was using SDL, however due to several non-ending problems with SDL, OpenGL and multisampling (using dglOpenGL and GL.pas, GLU.pas, etc) i decided to not use it and use win32 instead, however the appearence is very different, in SDL the view was nice & smooth, how ever now it is big and chunky.. does anyone know how SDL creates the contexts etc?

    Secondly, im having problems setting up multisampling... my card does support it (i have checked via GLView, its a fairly new card and i have used programs that had multisampling), it passes all the checks to see if it is supported, but when i go to create the PixelFormat, i get the result true, but i get the number of formats and the pixelformat back as 0.

    The code is:
    [pascal]
    function InitializeMultiSample: Boolean;
    var
    pFormat: Integer;
    valid: Boolean;
    nFormats: UInt;
    fAttrib: Array Of Single;
    iAttrib: Array Of Integer;
    begin
    Result := False;
    If Not GL_ARB_MULTISAMPLE Then Exit;
    If Not Assigned(wglChoosePixelFormatARB) Then Exit;

    SetLength(fAttrib, 2);
    fAttrib[0] := 0;
    fAttrib[1] := 0;

    SetLength(iAttrib, 22);
    iAttrib[0] := WGL_DRAW_TO_WINDOW_ARB;
    iAttrib[1] := 1;
    iAttrib[2] := WGL_SUUPORT_OPENGL_ARB;
    iAttrib[3] := 1;
    iAttrib[4] := WGL_ACCELERATION_ARB;
    iAttrib[5] := WGL_FULL_ACCELERATION_ARB;
    iAttrib[6] := WGL_COLOR_BITS_ARB;
    iAttrib[7] := 24;
    iAttrib[8] := WGL_ALPHA_BITS_ARB;
    iAttrib[9] := 8;
    iAttrib[10] := WGL_DEPTH_BITS_ARB;
    iAttrib[11] := 16;
    iAttrib[12] := WGL_STENCIL_BITS_ARB;
    iAttrib[13] := 0;
    iAttrib[14] := WGL_DOUBLE_BUFFER_ARB;
    iAttrib[15] := 1;
    iAttrib[16] := WGL_SAMPLE_BUFFERS_ARB;
    iAttrib[17] := 1;
    iAttrib[18] := WGL_SAMPLES_ARB;
    iAttrib[19] := 4;
    iAttrib[20] := 0;
    iAttrib[21] := 0;

    valid := wglChoosePixelFormatARB(_hDC, @iAttrib, @fAttrib, 1, @pFormat, @nFormats);
    If (valid) And (nFormats > 0) Then
    Begin
    Result := True;
    Exit;
    End;

    iAttrib[19] := 2;
    valid := wglChoosePixelFormatARB(_hDC, @iAttrib, @fAttrib, 1, @pFormat, @nFormats);
    If (valid) And (nFormats > 0) Then
    Begin
    Result := True;
    Exit;
    End;
    end;
    [/pascal]

    I cant figure out why is would result in true but not return anything else, im using dglOpenGL.pas.

    Thanks
    M109uk
    <br />--------------------------------------------------------
    <br />www.pulse-soft.oneuk.com

  2. #2

    OpenGL and Multisample

    Check out this article on NeHe about how to do multisampling (without SDL):
    http://nehe.gamedev.net/data/lessons....asp?lesson=46
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

  3. #3

    OpenGL and Multisample

    Yeah thats the original i tried, the C++ worked fine, except when i compiled the delphi version that didnt work either :s..
    M109uk
    <br />--------------------------------------------------------
    <br />www.pulse-soft.oneuk.com

  4. #4

    OpenGL and Multisample

    Quote Originally Posted by M109uk
    Yeah thats the original i tried, the C++ worked fine, except when i compiled the delphi version that didnt work either :s..
    it's possible that the delphi translation is broken somehow. i think that www.sulaco.co.za has another multisampling example, i'll check it out since i'm not sure.

    edit: just checked, it doesn't have any multisampling example.
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

  5. #5

    OpenGL and Multisample

    Sulaco has a multisample example, but if i remember its not fullscreen... dont quote me though..

    I thought it might be the translations, but if i try to use the GL units that come with Jedi-SDLv1 i get nothing at all, it wont load the extensions or anything (with and without SDL),

    I have downloaded dglOpenGL.pas from their site 2 weeks ago, and i dont think they have any updates.

    Are there any other better units around?
    M109uk
    <br />--------------------------------------------------------
    <br />www.pulse-soft.oneuk.com

  6. #6

    OpenGL and Multisample

    if the nehe delphi tutorial doesn't work, but C one does, you could check out why delphi one doesn't and so fix it.
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

  7. #7

    OpenGL and Multisample

    In the end i tried again with SDL and after huge amounts of problems, i have managed to get it working now, i found that the reason it would'nt use multisampling in the end was because i was using a TPanels handle, when i took it out so that SDL created a window it worked.

    Thanks for all your help
    M109uk
    <br />--------------------------------------------------------
    <br />www.pulse-soft.oneuk.com

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
  •