Calling SDL_RenderPresent

Hello,

Is it acceptable/correct/OK to call SDL_RenderPresent() when none of the rendering functions have
been called (e.g. SDL_RenderCopy, SDL_RenderDrawLine, etc)?

I initially render my screen (widgets, icons, images, text, etc.). The last thing my main loop does
is call SDL_RenderPresent. Initially, everything is fine in that the widgets, icons, images, text
etc. are presented on the display.

On the next iteration of my main loop, none of those elements have changed. Therefore, none of the
rendering functions have been called (e.g. SDL_RenderCopy() is not called). For example, I do not
need to change the image for a button since the user is not pressing it.

With the above, all is well when I run the program on the desktop. However, when I run it on my
Android device, the screen flickers. From what I can determine, it seems that calling
SDL_RenderPresent when none of the rendering functions have been called is the culprit.

I used to clear the screen for each iteration of the main loop and re-render all the elements
(widgets, icons, text, etc.). The flickering stops on Android if I do this, however, I thought it
would be more efficient not to re-render things that have not changed.

Should I be seeing screen flicker when calling SDL_RenderPresent when none of the rendering
functions have been called? Or is this expected and I should avoid calling that if I haven’t called
any of the rendering functions?

Any advice would be appreciate.

Cheers,

Alvin

The short answer is No.

Longer explanation:
As a rule of thumb, each time you call SDL_RenderPresent, you are given a new framebuffer, containing total garbage (if you’re lucky it’s blank, but don’t bet on it), this is especially true if you
are using a multi-gpu computer that assigns each Present to a different GPU sequentially (this is known as AFR - Alternate Frame Rendering - and is used on AMD Crossfire and NVIDIA SLI technologies).

You may also have to do more than one Present before any new image is shown to the user, due to the driver telling the GPU to present an image multiple frames after it was issued by the application,
usually as part of “double buffering” or “triple buffering”, or as a result of the render-to-texture behind the scenes in a compositing desktop environment (which many are today, even on Android and iOS).

So in general you want to spin your main loop and constantly refresh, if you want to get clever you may be able to stop calling your refresh function from your main loop after a sufficient number of
frames have been rendered since the last user interaction - for this I think 3 frames is a good number, but it may have to be more in multi-gpu configurations.

One other concern with this sort of clever limited refreshing is that some menu overlays and things (such as on game consoles, but also on PC in the case of Steam Community Overlay) require you to
keep refreshing or they may become unresponsive to the user (and because they are eating nearly all of your events, so you won’t know the user is doing anything).On 02/13/2014 12:03 PM, Alvin Beach wrote:

Hello,

Is it acceptable/correct/OK to call SDL_RenderPresent() when none of the rendering functions have
been called (e.g. SDL_RenderCopy, SDL_RenderDrawLine, etc)?

I initially render my screen (widgets, icons, images, text, etc.). The last thing my main loop does
is call SDL_RenderPresent. Initially, everything is fine in that the widgets, icons, images, text
etc. are presented on the display.

On the next iteration of my main loop, none of those elements have changed. Therefore, none of the
rendering functions have been called (e.g. SDL_RenderCopy() is not called). For example, I do not
need to change the image for a button since the user is not pressing it.

With the above, all is well when I run the program on the desktop. However, when I run it on my
Android device, the screen flickers. From what I can determine, it seems that calling
SDL_RenderPresent when none of the rendering functions have been called is the culprit.

I used to clear the screen for each iteration of the main loop and re-render all the elements
(widgets, icons, text, etc.). The flickering stops on Android if I do this, however, I thought it
would be more efficient not to re-render things that have not changed.

Should I be seeing screen flicker when calling SDL_RenderPresent when none of the rendering
functions have been called? Or is this expected and I should avoid calling that if I haven’t called
any of the rendering functions?

Any advice would be appreciate.

Cheers,

Alvin


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


LordHavoc
Author of DarkPlaces Quake1 engine - http://icculus.org/twilight/darkplaces
Co-designer of Nexuiz - http://alientrap.org/nexuiz
"War does not prove who is right, it proves who is left." - Unknown
"Any sufficiently advanced technology is indistinguishable from a rigged demo." - James Klass
"A game is a series of interesting choices." - Sid Meier

If nothing has changed then simply just do not call SDL_RenderPresent.On Thu, Feb 13, 2014 at 3:03 PM, Alvin Beach wrote:

Hello,

Is it acceptable/correct/OK to call SDL_RenderPresent() when none of the rendering functions have
been called (e.g. SDL_RenderCopy, SDL_RenderDrawLine, etc)?

I initially render my screen (widgets, icons, images, text, etc.). The last thing my main loop does
is call SDL_RenderPresent. Initially, everything is fine in that the widgets, icons, images, text
etc. are presented on the display.

On the next iteration of my main loop, none of those elements have changed. Therefore, none of the
rendering functions have been called (e.g. SDL_RenderCopy() is not called). For example, I do not
need to change the image for a button since the user is not pressing it.

With the above, all is well when I run the program on the desktop. However, when I run it on my
Android device, the screen flickers. From what I can determine, it seems that calling
SDL_RenderPresent when none of the rendering functions have been called is the culprit.

I used to clear the screen for each iteration of the main loop and re-render all the elements
(widgets, icons, text, etc.). The flickering stops on Android if I do this, however, I thought it
would be more efficient not to re-render things that have not changed.

Should I be seeing screen flicker when calling SDL_RenderPresent when none of the rendering
functions have been called? Or is this expected and I should avoid calling that if I haven’t called
any of the rendering functions?

Any advice would be appreciate.

Cheers,

Alvin


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

2014-02-13 21:03 GMT+01:00 Alvin Beach :

Hello,

Is it acceptable/correct/OK to call SDL_RenderPresent() when none of the
rendering functions have
been called (e.g. SDL_RenderCopy, SDL_RenderDrawLine, etc)?

I initially render my screen (widgets, icons, images, text, etc.). The
last thing my main loop does
is call SDL_RenderPresent. Initially, everything is fine in that the
widgets, icons, images, text
etc. are presented on the display.

On the next iteration of my main loop, none of those elements have
changed. Therefore, none of the
rendering functions have been called (e.g. SDL_RenderCopy() is not
called). For example, I do not
need to change the image for a button since the user is not pressing it.

With the above, all is well when I run the program on the desktop.
However, when I run it on my
Android device, the screen flickers. From what I can determine, it seems
that calling
SDL_RenderPresent when none of the rendering functions have been called is
the culprit.

I used to clear the screen for each iteration of the main loop and
re-render all the elements
(widgets, icons, text, etc.). The flickering stops on Android if I do
this, however, I thought it
would be more efficient not to re-render things that have not changed.

Should I be seeing screen flicker when calling SDL_RenderPresent when none
of the rendering
functions have been called? Or is this expected and I should avoid calling
that if I haven’t called
any of the rendering functions?

Any advice would be appreciate.

Cheers,

Alvin

As Forest explained, you should always expect that the next buffer you
receive from the graphics implementation might contain garbage, so just
sending that off to the screen may result in, well, undefined results.
Additionally, on certain non-composing window managers (such as older
X11 ones), your buffers will get damaged just my moving your window
partly offscreen / minimizing it, so unless you want to explicitly handle
the incoming “SDL_WINDOWEVENT_EXPOSED”, you should probably
redraw every frame.

I think its pretty simple to handle SDL_WINDOWEVENT_EXPOSED and mark
the screen state as dirty…if you really are not making the screen
dirty that often.On Thu, Feb 13, 2014 at 6:15 PM, Jonas Kulla wrote:

2014-02-13 21:03 GMT+01:00 Alvin Beach :

Hello,

Is it acceptable/correct/OK to call SDL_RenderPresent() when none of the
rendering functions have
been called (e.g. SDL_RenderCopy, SDL_RenderDrawLine, etc)?

I initially render my screen (widgets, icons, images, text, etc.). The
last thing my main loop does
is call SDL_RenderPresent. Initially, everything is fine in that the
widgets, icons, images, text
etc. are presented on the display.

On the next iteration of my main loop, none of those elements have
changed. Therefore, none of the
rendering functions have been called (e.g. SDL_RenderCopy() is not
called). For example, I do not
need to change the image for a button since the user is not pressing it.

With the above, all is well when I run the program on the desktop.
However, when I run it on my
Android device, the screen flickers. From what I can determine, it seems
that calling
SDL_RenderPresent when none of the rendering functions have been called is
the culprit.

I used to clear the screen for each iteration of the main loop and
re-render all the elements
(widgets, icons, text, etc.). The flickering stops on Android if I do
this, however, I thought it
would be more efficient not to re-render things that have not changed.

Should I be seeing screen flicker when calling SDL_RenderPresent when none
of the rendering
functions have been called? Or is this expected and I should avoid calling
that if I haven’t called
any of the rendering functions?

Any advice would be appreciate.

Cheers,

Alvin

As Forest explained, you should always expect that the next buffer you
receive from the graphics implementation might contain garbage, so just
sending that off to the screen may result in, well, undefined results.
Additionally, on certain non-composing window managers (such as older
X11 ones), your buffers will get damaged just my moving your window
partly offscreen / minimizing it, so unless you want to explicitly handle
the incoming “SDL_WINDOWEVENT_EXPOSED”, you should probably
redraw every frame.


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

Doing that requires singlebuffering, which I do not think SDL_Render currently supports (as I can’t find the corresponding glFlush() in the SDL_RenderPresent code).

When using OpenGL the SDL_Render backend could be modified to set the attribute SDL_GL_DOUBLEBUFFER to 0, but then SDL_RenderPresent would need to issue a glFlush() call as per Windows documentation
which specifies that the Aero compositing desktop may not execute GL commands at all until a glFlush() or wglSwapBuffers() call is made, and wglSwapBuffers() does nothing on a singlebuffered window.

Similar changes could be made to implement this on the other OpenGL backends, and of course Direct3D.On 02/13/2014 03:28 PM, Andre D wrote:

I think its pretty simple to handle SDL_WINDOWEVENT_EXPOSED and mark
the screen state as dirty…if you really are not making the screen
dirty that often.

On Thu, Feb 13, 2014 at 6:15 PM, Jonas Kulla wrote:

2014-02-13 21:03 GMT+01:00 Alvin Beach :

Hello,

Is it acceptable/correct/OK to call SDL_RenderPresent() when none of the
rendering functions have
been called (e.g. SDL_RenderCopy, SDL_RenderDrawLine, etc)?

I initially render my screen (widgets, icons, images, text, etc.). The
last thing my main loop does
is call SDL_RenderPresent. Initially, everything is fine in that the
widgets, icons, images, text
etc. are presented on the display.

On the next iteration of my main loop, none of those elements have
changed. Therefore, none of the
rendering functions have been called (e.g. SDL_RenderCopy() is not
called). For example, I do not
need to change the image for a button since the user is not pressing it.

With the above, all is well when I run the program on the desktop.
However, when I run it on my
Android device, the screen flickers. From what I can determine, it seems
that calling
SDL_RenderPresent when none of the rendering functions have been called is
the culprit.

I used to clear the screen for each iteration of the main loop and
re-render all the elements
(widgets, icons, text, etc.). The flickering stops on Android if I do
this, however, I thought it
would be more efficient not to re-render things that have not changed.

Should I be seeing screen flicker when calling SDL_RenderPresent when none
of the rendering
functions have been called? Or is this expected and I should avoid calling
that if I haven’t called
any of the rendering functions?

Any advice would be appreciate.

Cheers,

Alvin

As Forest explained, you should always expect that the next buffer you
receive from the graphics implementation might contain garbage, so just
sending that off to the screen may result in, well, undefined results.
Additionally, on certain non-composing window managers (such as older
X11 ones), your buffers will get damaged just my moving your window
partly offscreen / minimizing it, so unless you want to explicitly handle
the incoming “SDL_WINDOWEVENT_EXPOSED”, you should probably
redraw every frame.


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


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


LordHavoc
Author of DarkPlaces Quake1 engine - http://icculus.org/twilight/darkplaces
Co-designer of Nexuiz - http://alientrap.org/nexuiz
"War does not prove who is right, it proves who is left." - Unknown
"Any sufficiently advanced technology is indistinguishable from a rigged demo." - James Klass
"A game is a series of interesting choices." - Sid Meier

That won’t work on multitasking systems (other windows and such will
draw over whatever you just rendered and it won’t be restored, you’re
expected to either redraw the window when that happens or redraw
constantly so it’s a non-problem).

2014-02-13 17:33 GMT-03:00, Andre D :> If nothing has changed then simply just do not call SDL_RenderPresent.

On Thu, Feb 13, 2014 at 3:03 PM, Alvin Beach wrote:

Hello,

Is it acceptable/correct/OK to call SDL_RenderPresent() when none of the
rendering functions have
been called (e.g. SDL_RenderCopy, SDL_RenderDrawLine, etc)?

I initially render my screen (widgets, icons, images, text, etc.). The
last thing my main loop does
is call SDL_RenderPresent. Initially, everything is fine in that the
widgets, icons, images, text
etc. are presented on the display.

On the next iteration of my main loop, none of those elements have
changed. Therefore, none of the
rendering functions have been called (e.g. SDL_RenderCopy() is not
called). For example, I do not
need to change the image for a button since the user is not pressing it.

With the above, all is well when I run the program on the desktop.
However, when I run it on my
Android device, the screen flickers. From what I can determine, it seems
that calling
SDL_RenderPresent when none of the rendering functions have been called is
the culprit.

I used to clear the screen for each iteration of the main loop and
re-render all the elements
(widgets, icons, text, etc.). The flickering stops on Android if I do
this, however, I thought it
would be more efficient not to re-render things that have not changed.

Should I be seeing screen flicker when calling SDL_RenderPresent when none
of the rendering
functions have been called? Or is this expected and I should avoid calling
that if I haven’t called
any of the rendering functions?

Any advice would be appreciate.

Cheers,

Alvin


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


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

The short answer is No.

Longer explanation:
As a rule of thumb, each time you call SDL_RenderPresent, you are given a new framebuffer, containing total garbage (if you’re lucky it’s blank, but don’t bet on it), this is especially true if you
are using a multi-gpu computer that assigns each Present to a different GPU sequentially (this is known as AFR - Alternate Frame Rendering - and is used on AMD Crossfire and NVIDIA SLI technologies).

You may also have to do more than one Present before any new image is shown to the user, due to the driver telling the GPU to present an image multiple frames after it was issued by the application,
usually as part of “double buffering” or “triple buffering”, or as a result of the render-to-texture behind the scenes in a compositing desktop environment (which many are today, even on Android and iOS).

So in general you want to spin your main loop and constantly refresh, if you want to get clever you may be able to stop calling your refresh function from your main loop after a sufficient number of
frames have been rendered since the last user interaction - for this I think 3 frames is a good number, but it may have to be more in multi-gpu configurations.

One other concern with this sort of clever limited refreshing is that some menu overlays and things (such as on game consoles, but also on PC in the case of Steam Community Overlay) require you to
keep refreshing or they may become unresponsive to the user (and because they are eating nearly all of your events, so you won’t know the user is doing anything).

Hello,

Is it acceptable/correct/OK to call SDL_RenderPresent() when none of the rendering functions have
been called (e.g. SDL_RenderCopy, SDL_RenderDrawLine, etc)?

[snip]

Alvin

Thank you Forest and everyone for the clarification. It is greatly appreciated!

Back when I use SDL 1.2, I redraw (mainly software-based rendering (err blitting)) the whole main
SDL_Surface. It makes sense to me now that I would need to do the same with hardware accelerated
rendering in SDL2.

My follow up question is what is the best practise or typical approach when it comes to rendering?
Should I: (1) render all the elements (fill background colour, widgets, text, etc.) to a single
target texture and then SDL_RenderCopy that to the renderer’s default texture, or (2) continue to
render the individual elements directly to the renderer’s default target? I am currently doing the
former. Basically, batch rendering (in a way) to a single texture vs iterative rendering to the
default target.

Cheers,

AlvinOn 13/02/14 16:33, Forest Hale wrote:

On 02/13/2014 12:03 PM, Alvin Beach wrote:

I would do as the examples do until you think you need to do better due to
performance issues in a beta project . The examples are all alpha projects
that don’t have all of your intended functionality.

Sounds advice. Do you mean the examples found in the top-level test/ (not src/tests)? Which example
would do you recommend? In my situation, I am mainly dealing with (flat, 2D) textures and putting
them on the screen. I am not directly calling OpenGL or drawing any 3D elements, directly at least.

Cheers,

AlvinOn 14/02/14 10:40, R Manard wrote:

I would do as the examples do until you think you need to do better due to performance issues in a
beta project . The examples are all alpha projects that don’t have all of your intended functionality.

[snip]

There are many examples on the internet. I would advise that you look over
at least 10 of them. That will give you the general idea of how people are
making use of the library and the prevalent level of complexity. I would
ask that you please include my example. The reason I do this is because
even know its alpha, it does make use several conventions that are unique
to any particular example I have seen. I need to improve this example and
create the web pages needed to explain it in detail. I’m not embarrassed by
it, and that will have to suffice for now.
Whisper8.com/data/TWINDRAGON_SDL2_GAME_EXAMPLE.zip

R A Manard whisper8.comOn Feb 14, 2014 8:52 AM, “Alvin Beach” wrote:

On 14/02/14 10:40, R Manard wrote:

I would do as the examples do until you think you need to do better due
to performance issues in a
beta project . The examples are all alpha projects that don’t have all
of your intended functionality.

[snip]

Sounds advice. Do you mean the examples found in the top-level test/ (not
src/tests)? Which example
would do you recommend? In my situation, I am mainly dealing with (flat,
2D) textures and putting
them on the screen. I am not directly calling OpenGL or drawing any 3D
elements, directly at least.

Cheers,

Alvin


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

Message-ID: <52FE1CDF.6090702 at gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

The short answer is No.

Longer explanation:
As a rule of thumb, each time you call SDL_RenderPresent, you are given a
new framebuffer, containing total garbage (if you’re lucky it’s blank, but
don’t bet on it),

Hello,

Is it acceptable/correct/OK to call SDL_RenderPresent() when none of the
rendering functions have
been called (e.g. SDL_RenderCopy, SDL_RenderDrawLine, etc)?

[snip]

Alvin

Thank you Forest and everyone for the clarification. It is greatly
appreciated!

Back when I use SDL 1.2, I redraw (mainly software-based rendering (err
blitting)) the whole main
SDL_Surface. It makes sense to me now that I would need to do the same with
hardware accelerated
rendering in SDL2.

My follow up question is what is the best practise or typical approach when
it comes to rendering?
Should I: (1) render all the elements (fill background colour, widgets,
text, etc.) to a single
target texture and then SDL_RenderCopy that to the renderer’s default
texture, or (2) continue to
render the individual elements directly to the renderer’s default target? I
am currently doing the
former. Basically, batch rendering (in a way) to a single texture vs
iterative rendering to the
default target.

If the scene doesn’t normally change, then technique 1 is presumably
the best choice. There may be a few cases where it’s sub-optimal, but
I suspect them to be rare. The bigger question is always whether
there’s any credible reason to add them.> Date: Fri, 14 Feb 2014 09:40:47 -0400

From: Alvin Beach
To: SDL Development List
Subject: Re: [SDL] Calling SDL_RenderPresent
On 13/02/14 16:33, Forest Hale wrote:

On 02/13/2014 12:03 PM, Alvin Beach wrote:

Date: Fri, 14 Feb 2014 08:40:53 -0600
From: R Manard
To: SDL Development List
Subject: Re: [SDL] Calling SDL_RenderPresent
Message-ID:
<CAKCUQMZs+TFvrxFk=bKp375EkrSDv+u-kJQsx4EVnrKPsD406A at mail.gmail.com>
Content-Type: text/plain; charset=“iso-8859-1”

I would do as the examples do until you think you need to do better due to
performance issues in a beta project . The examples are all alpha projects
that don’t have all of your intended functionality.

I believe that Manard is telling you to not ADD Render Targets unless
your program has poor performance. Are you using Render Targets
already? If so (and it looked to me as if you said above that you were
already using them), then you might as well keep them in place.

[snip]

My follow up question is what is the best practise or typical approach when
it comes to rendering?
Should I: (1) render all the elements (fill background colour, widgets,
text, etc.) to a single
target texture and then SDL_RenderCopy that to the renderer’s default
texture, or (2) continue to
render the individual elements directly to the renderer’s default target? I
am currently doing the
former. Basically, batch rendering (in a way) to a single texture vs
iterative rendering to the
default target.

If the scene doesn’t normally change, then technique 1 is presumably
the best choice. There may be a few cases where it’s sub-optimal, but
I suspect them to be rare. The bigger question is always whether
there’s any credible reason to add them.

I would do as the examples do until you think you need to do better due to
performance issues in a beta project . The examples are all alpha projects
that don’t have all of your intended functionality.

I believe that Manard is telling you to not ADD Render Targets unless
your program has poor performance. Are you using Render Targets
already? If so (and it looked to me as if you said above that you were
already using them), then you might as well keep them in place.

Currently, I am just using the default texture. My widgets either call
SDL_RenderCopy, SDL_RenderDrawLines, SDL2_gfx, etc. The only time I
use SDL_SetRenderTarget is when I am combining textures (of text
strings) to create a shadow effect. Otherwise, I am acting only on the
default texture.

The reason for my my original post is that I saw different behaviours
when calling SDL_RenderPresent. I have a single code base that I used
to build a desktop (Linux) program or an Android app (all controlled
via my Makefile). On the desktop, when SDL_RenderPresent is called,
not having called any of the SDL_RenderXXX functions before that,
everything is fine. No issues with the window, etc. However, the same
source compiled using the SDL2’s android-project, the display
flickers. I understand why that is now, so I am investigating the
issue and experimenting. Basically, I was curious as to whether the
"best practice" is to render everything (60 FPS), selectively calling
SDL_RenderPresent only when something has been “rendered” or render
everything (selectively - if dirty) to a texture and always rendering
that texture.

Cheers,

AlvinOn Sun, Feb 16, 2014 at 2:58 AM, Jared Maddox wrote:

Date: Fri, 14 Feb 2014 08:40:53 -0600
From: R Manard
To: SDL Development List
Subject: Re: [SDL] Calling SDL_RenderPresent

My opinion is that if you want to support all platforms then having a
finished texture you can render at 60 frames is best with work being done
when needed to produce it . How’s that work is done is kind of a use case
thing I thinkOn Feb 16, 2014 9:13 AM, “Alvin Beach” wrote:

On Sun, Feb 16, 2014 at 2:58 AM, Jared Maddox wrote:

[snip]

My follow up question is what is the best practise or typical approach
when

it comes to rendering?
Should I: (1) render all the elements (fill background colour, widgets,
text, etc.) to a single
target texture and then SDL_RenderCopy that to the renderer’s default
texture, or (2) continue to
render the individual elements directly to the renderer’s default
target? I

am currently doing the
former. Basically, batch rendering (in a way) to a single texture vs
iterative rendering to the
default target.

If the scene doesn’t normally change, then technique 1 is presumably
the best choice. There may be a few cases where it’s sub-optimal, but
I suspect them to be rare. The bigger question is always whether
there’s any credible reason to add them.

Date: Fri, 14 Feb 2014 08:40:53 -0600
From: R Manard <@R_Manard>
To: SDL Development List
Subject: Re: [SDL] Calling SDL_RenderPresent

I would do as the examples do until you think you need to do better due
to

performance issues in a beta project . The examples are all alpha
projects

that don’t have all of your intended functionality.

I believe that Manard is telling you to not ADD Render Targets unless
your program has poor performance. Are you using Render Targets
already? If so (and it looked to me as if you said above that you were
already using them), then you might as well keep them in place.

Currently, I am just using the default texture. My widgets either call
SDL_RenderCopy, SDL_RenderDrawLines, SDL2_gfx, etc. The only time I
use SDL_SetRenderTarget is when I am combining textures (of text
strings) to create a shadow effect. Otherwise, I am acting only on the
default texture.

The reason for my my original post is that I saw different behaviours
when calling SDL_RenderPresent. I have a single code base that I used
to build a desktop (Linux) program or an Android app (all controlled
via my Makefile). On the desktop, when SDL_RenderPresent is called,
not having called any of the SDL_RenderXXX functions before that,
everything is fine. No issues with the window, etc. However, the same
source compiled using the SDL2’s android-project, the display
flickers. I understand why that is now, so I am investigating the
issue and experimenting. Basically, I was curious as to whether the
"best practice" is to render everything (60 FPS), selectively calling
SDL_RenderPresent only when something has been “rendered” or render
everything (selectively - if dirty) to a texture and always rendering
that texture.

Cheers,

Alvin


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

R Manard wrote:

My opinion is that if you want to support all platforms then having a finished texture you can render at 60 frames is best with work being done when needed to produce it . How’s that work is done is kind of a use case thing I think

Central problem with that is dealing with platforms where the max texture size is lower than the screen size.

2014-02-20 2:23 GMT+01:00 mattbentley :

R Manard wrote:

My opinion is that if you want to support all platforms then having a
finished texture you can render at 60 frames is best with work being done
when needed to produce it . How’s that work is done is kind of a use case
thing I think

Central problem with that is dealing with platforms where the max texture
size is lower than the screen size.

:open_mouth: That sounds really curious. Can you give some examples of such
platforms?

Taking a quick guess: probably some low-end phones or tablets do that.

2014-02-21 2:40 GMT-03:00, Jonas Kulla :> 2014-02-20 2:23 GMT+01:00 mattbentley :

R Manard wrote:

My opinion is that if you want to support all platforms then having a
finished texture you can render at 60 frames is best with work being done
when needed to produce it . How’s that work is done is kind of a use case
thing I think

Central problem with that is dealing with platforms where the max texture
size is lower than the screen size.

:open_mouth: That sounds really curious. Can you give some examples of such
platforms?

I hope not. That would be dumb. Such a device can’t do offscreen
rendering…

A StackOverflow user claims that an Android API requires this
functionality, so that might mean that you can expect Android devices to
comply.

With a quick search, I came up with the Nokia N93 from 2006 as the first
OpenGL ES phone (running Symbian 9.1). It has a 240x320 display. The max
texture size was 1024. I’m hoping that’s a representative data point here.

Jonny DOn Fri, Feb 21, 2014 at 9:10 AM, Sik the hedgehog < sik.the.hedgehog at gmail.com> wrote:

Taking a quick guess: probably some low-end phones or tablets do that.

2014-02-21 2:40 GMT-03:00, Jonas Kulla :

2014-02-20 2:23 GMT+01:00 mattbentley :

R Manard wrote:

My opinion is that if you want to support all platforms then having a
finished texture you can render at 60 frames is best with work being
done

when needed to produce it . How’s that work is done is kind of a use
case

thing I think

Central problem with that is dealing with platforms where the max
texture

size is lower than the screen size.

:open_mouth: That sounds really curious. Can you give some examples of such
platforms?


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

Jonas Kulla wrote:

?:open_mouth: That sounds really curious. Can you give some examples of such platforms?

Most Intel graphics chipsets prior to 2010? Around 1024x1024 limitation.

Pretty bloody common scenario.