Draw Only Part OpenGL Screen Buffer?

Draw Only Part OpenGL Screen Buffer?

Hi,

Is it possible when using SDL1.2+OpenGL
to flip/swap only part of the screen buffer to the screen?

I only see: SDL_GL_SwapBuffers();
but it flips/swaps the entire screen buffer to the entire screen.

I wish to only draw a smaller part of the screen buffer to the screen.

Trying to make a dirty rectangle system of drawing to the screen
so that the game runs full speed
when OpenGL hardware acceleration is not available.

Thanks!------------------------
JeZ+Lee
JessePalser <AT> Gmail <DOT> com
16BitSoft®
Video Game Design Studio
www.16BitSoft.com

Don’t use a backbuffer?------------------------
EM3 Nathaniel Fries, U.S. Navy

http://natefries.net/

No. And that goes for all the different 3D APIs I have looked at in since 1973.

The way to do what you want to do is to have two versions of your
code. One that uses OpenGL and one that does not. If the system does
have OpenGL then use it, if not, don’t.

Also, you can not make assumptions about the contents of the back
buffer. There is not reason to believe that it is the same memory that
was displayed on the screen before the swap. A lot of systems use
triple buffering to reduce latency. One frame is visible, the second
frame is waiting for vsync so it can be displayed without tearing and
the third one is the one you are rendering into. Or, just for grins
and giggles the driver might give you a completely unrelated chunk of
memory. Just 'cause it works for you on your machine does not mean it
will work the same way on another machine, or on another version of
the driver.

When using multiple buffers you are not allowed to make assumptions
about the contents of a buffer that has just been given to you. The
only times you can make assumptions are well documented in the OpenGL
standard books. If you do not own copies of the current versions of
the Red, Blue books you need to get them and at least read a good
chunk of the Blue book.

Bob PendletonOn Fri, Jun 18, 2010 at 1:15 AM, JeZ-l-Lee wrote:

Draw Only Part OpenGL Screen Buffer?

Hi,

Is it possible when using SDL1.2+OpenGL
to flip/swap only part of the screen buffer to the screen?

I only see: SDL_GL_SwapBuffers();
but it flips/swaps the entire screen buffer to the entire screen.

I wish to only draw a smaller part of the screen buffer to the screen.

Trying to make a dirty rectangle system of drawing to the screen
so that the game runs full speed
when OpenGL hardware acceleration is not available.

Thanks!


JeZ+Lee
JessePalser Gmail com
16BitSoft®
Video Game Design Studio
www.16BitSoft.com


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


±----------------------------------------------------------

JeZ-l-Lee wrote:

Is it possible when using SDL1.2+OpenGL
to flip/swap only part of the screen buffer to the screen?

Bob wrote:

No. And that goes for all the different 3D APIs I have looked at in since 1973.

The way to do what you want to do is to have two versions of your
code. One that uses OpenGL and one that does not. If the system does
have OpenGL then use it, if not, don’t.

Uggg, that ruined my day…
Will take a few days to implement a dual graphic core system.
(have not used SDL 1.2 for graphic blitting recently so have to relearn it)

Bob wrote:

Also, you can not make assumptions about the contents of the back
buffer. There is not reason to believe that it is the same memory that
was displayed on the screen before the swap. A lot of systems use
triple buffering to reduce latency. One frame is visible, the second
frame is waiting for vsync so it can be displayed without tearing and
the third one is the one you are rendering into. Or, just for grins
and giggles the driver might give you a completely unrelated chunk of
memory. Just 'cause it works for you on your machine does not mean it
will work the same way on another machine, or on another version of
the driver.

I got SDL 1.2 + OpenGL dirty rectangle system sort of working, but it is hacked.
Tested on Ubuntu 10.04 Linux 32bit, Windows XP Pro SP3 32bit,
Windows Vista SP2 32bit, and Windows 7 64bit.
(the code is a mess though and am not happy with it at all)

Bob wrote:

When using multiple buffers you are not allowed to make assumptions
about the contents of a buffer that has just been given to you. The
only times you can make assumptions are well documented in the OpenGL
standard books. If you do not own copies of the current versions of
the Red, Blue books you need to get them and at least read a good
chunk of the Blue book.

Bob Pendleton

I think I have the red/blue OpenGL books in PDF format.
Will take a look at them in the future.

Thanks Bob!------------------------
JeZ+Lee
JessePalser <AT> Gmail <DOT> com
16BitSoft®
Video Game Design Studio
www.16BitSoft.com

JeZ-l-Lee wrote:

Is it possible when using SDL1.2+OpenGL
to flip/swap only part of the screen buffer to the screen?

Bob wrote:

No. And that goes for all the different 3D APIs I have looked at in since
1973.

The way to do what you want to do is to have two versions of your
code. One that uses OpenGL and one that does not. If the system does
have OpenGL then use it, if not, don’t.

Uggg, that ruined my day…
Will take a few days to implement a dual graphic core system.
(have not used SDL 1.2 for graphic blitting recently so have to relearn it)

Bob wrote:

Also, you can not make assumptions about the contents of the back
buffer. There is not reason to believe that it is the same memory that
was displayed on the screen before the swap. A lot of systems use
triple buffering to reduce latency. One frame is visible, the second
frame is waiting for vsync so it can be displayed without tearing and
the third one is the one you are rendering into. Or, just for grins
and giggles the driver might give you a completely unrelated chunk of
memory. Just 'cause it works for you on your machine does not mean it
will work the same way on another machine, or on another version of
the driver.

I got SDL 1.2 + OpenGL dirty rectangle system sort of working, but it is
hacked.
Tested on Ubuntu 10.04 Linux 32bit, Windows XP Pro SP3 32bit,
Windows Vista SP2 32bit, and Windows 7 64bit.
(the code is a mess though and am not happy with it at all)

How many different graphics cards did you test and from how many different
manufacturers. The OS has little to do with it and it rarely matters whether
you are using 32 or 64 bit systems. It is the driver that matters and the
drivers are pretty much the same across different OSes and word sizes. The
differences come from the people who wrote the drivers and that only really
varies from video card company to video card company.

Bob PendletonOn Fri, Jun 18, 2010 at 4:49 PM, JeZ-l-Lee wrote:

Bob wrote:

When using multiple buffers you are not allowed to make assumptions
about the contents of a buffer that has just been given to you. The
only times you can make assumptions are well documented in the OpenGL
standard books. If you do not own copies of the current versions of
the Red, Blue books you need to get them and at least read a good
chunk of the Blue book.

Bob Pendleton

I think I have the red/blue OpenGL books in PDF format.
Will take a look at them in the future.

Thanks Bob!


JeZ+Lee
JessePalser Gmail com
16BitSoft®
Video Game Design Studio
www.16BitSoft.com


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


±----------------------------------------------------------

You can also try here (red):
http://glprogramming.com/red/

and here (blue):
http://www.opengl.org/sdk/On 18/06/2010, JeZ-l-Lee wrote:

I think I have the red/blue OpenGL books in PDF format.
Will take a look at them in the future.

Also here:
http://glprogramming.com/blue/On 22/06/2010, Kenneth Bull <@Kenneth_Bull> wrote:

You can also try here (red):
http://glprogramming.com/red/

and here (blue):
http://www.opengl.org/sdk/