Page 1 of 3 123 LastLast
Results 1 to 10 of 27

Thread: Pondering a Smoother Scroll (OpenGL)

  1. #1
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Pondering a Smoother Scroll (OpenGL)

    Hey all!

    I'm fairly new to OpenGL and I've been looking at my recent game (Garland's Quest) and I've noticed that even though it doesn't look quite so terrible, I believe that the scrolling can look much nicer, or at the very least much smoother.

    What are some of the things that you do in OpenGL to improve your drawn frames?

    Instantly I'm thinking of either double/triple buffering or V-Sync, etc...
    Jason McMillen
    Pascal Game Development
    Co-Founder





  2. #2

    Pondering a Smoother Scroll (OpenGL)

    Well, with OpenGL it is the role of the OpenGL subsystem to draw frames synchrone (allthough you can request to switch vsync on/off through some extension). Just draw and forget about it

  3. #3
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Pondering a Smoother Scroll (OpenGL)

    My only issue with v-sync is that it limits you to the refresh rate of your monitor does it not?

    It would be safe to say that in most cases that frame rate would be a mere 60 FPS, no?
    Jason McMillen
    Pascal Game Development
    Co-Founder





  4. #4

    Pondering a Smoother Scroll (OpenGL)

    Something like 80 Hz would be a bit more comfortable for your eyes... Yes, you will be limited to your refresh rate, but what is the point generating frames that do not get displayed?

  5. #5
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Pondering a Smoother Scroll (OpenGL)

    Well I cannot argue with that. However I still want to reduce the glitchyness of the drawing.

    I'm not 100% on using vsync as I don't want to waste possible cpu juice just waiting for the next screen refresh.

    A possible solution could be to do some buffering, but I can't help but think that I can improve of this method rather than just adding features to suck up more cpu juice.

    Is there a way to detect a screen refresh without the pause? Or possibly read the setting from your hardware?
    Jason McMillen
    Pascal Game Development
    Co-Founder





  6. #6

    Pondering a Smoother Scroll (OpenGL)

    I found a piece of gold: http://olofson.net/download/smoothscroll-1.1.tar.gz

    It has two modes, OpenGL and SDL. In SDL-mode it doesn't vsync for me, lots of image tearing is visible on the display. The SDL-mode uses about 65% of my cpu. In OpenGL-mode it is vsynced, eveything scrolls smoothly, and only 3,5% cpu is used.

  7. #7

    Pondering a Smoother Scroll (OpenGL)

    WILL

    looking at the headers you can use the

    [pascal]SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL,1);[/pascal]

    To turn on Swap control with SDL, it looks like you can do this even after calling SDL_SetVideoMode

    you should also be able to use

    [pascal]
    var value: Integer;
    begin
    SDL_GL_GetAttribute(SDL_GL_SWAP_CONTROL, value);
    end;
    [/pascal]

    to query the swap control flag. I think this only works with SDL 1.2.10 and up
    <A HREF="http://www.myhpf.co.uk/banner.asp?friend=139328">
    <br /><IMG SRC="http://www.myhpf.co.uk/banners/60x468.gif" BORDER="0">
    <br /></A>

  8. #8
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Pondering a Smoother Scroll (OpenGL)

    Well it seems with the double buffering options in it's still not much of a difference.

    And the damn libsdl.org site is down so forget looking up what the value associated with SDL_GL_SWAP_CONTROL is all about.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  9. #9
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Pondering a Smoother Scroll (OpenGL)

    Ah... and my version of JEDI-SDL doesn't have it as the included version of sdl is only 1.2.8.0. :roll:
    Jason McMillen
    Pascal Game Development
    Co-Founder





  10. #10

    Pondering a Smoother Scroll (OpenGL)

    Yes, but you are using plain SDL, right? I am unable to get vsynced output with the SDL version of the example program I linked, only with OpenGL.

Page 1 of 3 123 LastLast

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
  •