Copy Part Of OpenGL Screen Buffer To OpenGL Texture?

Copy Part Of OpenGL Screen Buffer To OpenGL Texture?

Hi,

I am looking for the OpenGL equivalent to:
int SDL_BlitSurface(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect);

I want to copy a small part of the OpenGL screen buffer to another OpenGL texture.
What would be the best method to do this?

Purpose of doing the above is to implement a “Dirty Rectangle” system to update game’s SDL+OpenGL screen.
(for game LettersFall 2.0 - wish to make game run on a computer without OpenGL hardware acceleration)

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

Look into glCopyTexImage2D and glCopyTexSubImage2D, depending on what
you need.

JeZ-l-Lee wrote:> Copy Part Of OpenGL Screen Buffer To OpenGL Texture?

Hi,

I am looking for the OpenGL equivalent to:
int SDL_BlitSurface(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface
*dst, SDL_Rect *dstrect);

I want to copy a small part of the OpenGL screen buffer to another
OpenGL texture.
What would be the best method to do this?

Purpose of doing the above is to implement a “Dirty Rectangle” system
to update game’s SDL+OpenGL screen.
(for game LettersFall 2.0 - wish to make game run on a computer
without OpenGL hardware acceleration)

Thanks!


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


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

“JeZ-l-Lee” writes:

Purpose of doing the above is to implement a “Dirty Rectangle” system to update game’s SDL+OpenGL screen.
(for game LettersFall 2.0 - wish to make game run on a computer without OpenGL hardware acceleration)

I think that an OpenGL dirty rectangle system will perform worse that
just drawing everything directly in OpenGL, because of the performance
of the glCopyTex* commands.–
Alberto

Alberto Luaces wrote:

“JeZ-l-Lee” writes:

Purpose of doing the above is to implement a “Dirty Rectangle” system to update game’s SDL+OpenGL screen.
(for game LettersFall 2.0 - wish to make game run on a computer without OpenGL hardware acceleration)

I think that an OpenGL dirty rectangle system will perform worse that
just drawing everything directly in OpenGL, because of the performance
of the glCopyTex* commands.

I don’t have much experience on the performance of glCopyTex, but I
figured it could still be quite fast since everything stays on GPU memory.

Another option could be to render everything to a texture, then blit
this texture to the screen (which is quite fast). Then the dirty
rectangle drawing would simply be to blit the corresponding part of the
texture to the dirty rect…

Alberto Luaces wrote:

“JeZ-l-Lee” writes:

Purpose of doing the above is to implement a “Dirty Rectangle” system to
update game’s SDL+OpenGL screen.
(for game LettersFall 2.0 - wish to make game run on a computer without
OpenGL hardware acceleration)

I think that an OpenGL dirty rectangle system will perform worse that
just drawing everything directly in OpenGL, because of the performance
of the glCopyTex* commands.

I don’t have much experience on the performance of glCopyTex, but I
figured it could still be quite fast since everything stays on GPU memory.

Another option could be to render everything to a texture, then blit this
texture to the screen (which is quite fast).? Then the dirty rectangle
drawing would simply be to blit the corresponding part of the texture to the
dirty rect…

Are you doing this because you have tested the application doing it
the easy way and it is not fast enough? Or are you doing this just
because you think it is a good idea?

I ask because it is very unlikely that an application that is simple
enough to benefit from a dirty rectangles scheme when done using a
software renderer is going to be slow enough to need to use dirty
rectangles when you are using OpenGL.

If you haven’t benchmarked the simplest implementation you owe it to
yourself to do so. If you have benchmarked it, then just ignore this
interruption.

Bob PendletonOn Thu, Jun 17, 2010 at 2:30 AM, Martin Bisson <martin.bisson at gmail.com> wrote:


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


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