Android rendering messed up (all red) on a Samsung S3 / Mali-400MP4 GPU

Hi everyone,

I’ve just started a closed beta for my game based on SDL 2 (2.0.3) and one
of the testers reported a very weird behaviour when running the game on a
Samsung S3 (Android 4.3).

Basically every colour is turned into red as showed in the pics you can
find here:

The most weird thing is that if he takes a screenshot the images come up
with the right colours.

I did some digging on Google and found other games suffer the same bug, for
example:
http://openxcom.org/forum/index.php/topic,1864.msg16802.html#msg16802

That guy was experiencing this problem on a Galaxy Note 10.1 which has a
Mali-400MP4 as GPU, the same used by the S3. My game works fine on a Sony
Xperia U with a Mali-400 instead. So it seems to be very specific to that
particular GPU.

Any idea how to fix this?

Thanks–
Davide Coppola

email: @Davide_Coppola
website: http://www.davidecoppola.com
blog: http://blog.davidecoppola.com

http://plus.google.com/+DavideCoppola
http://www.linkedin.com/in/davidecoppola
http://www.twitter.com/vivaladav

This is a known issue, take a look at Bugzilla for a few workarounds.

2015-09-04 12:42 GMT-03:00 Davide Coppola :> Hi everyone,

I’ve just started a closed beta for my game based on SDL 2 (2.0.3) and one
of the testers reported a very weird behaviour when running the game on a
Samsung S3 (Android 4.3).

Basically every colour is turned into red as showed in the pics you can
find here:
http://imgur.com/a/dvris

The most weird thing is that if he takes a screenshot the images come up
with the right colours.

I did some digging on Google and found other games suffer the same bug,
for example:
http://openxcom.org/forum/index.php/topic,1864.msg16802.html#msg16802

That guy was experiencing this problem on a Galaxy Note 10.1 which has a
Mali-400MP4 as GPU, the same used by the S3. My game works fine on a Sony
Xperia U with a Mali-400 instead. So it seems to be very specific to that
particular GPU.

Any idea how to fix this?

Thanks


Davide Coppola

email: vivaladav at gmail.com
website: http://www.davidecoppola.com
blog: http://blog.davidecoppola.com

http://plus.google.com/+DavideCoppola
http://www.linkedin.com/in/davidecoppola
http://www.twitter.com/vivaladav


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


Gabriel.

Thank you Gabriel.

For future reference the related bug report is:
https://bugzilla.libsdl.org/show_bug.cgi?id=2291

I haven’t tried any workaround yet, but I will post my results here and on
Bugzilla.

Cheers–
Davide Coppola

email: @Davide_Coppola
website: http://www.davidecoppola.com
blog: http://blog.davidecoppola.com

http://plus.google.com/+DavideCoppola
http://www.linkedin.com/in/davidecoppola
http://www.twitter.com/vivaladav

in my app, i notice that calling SDL_RenderPresent() takes at least 4msecs, sometimes up to 15msec !

i wonder why this is so slow ? The actual drawing and bltting is always done in less than a msec, but presenting takes longer ?

this is my init code :

m_main_window = SDL_CreateWindow("Main window",SDL_WINDOWPOS_UNDEFINED,SDL_WINDOWPOS_UNDEFINED,m_main_w,m_main_h,SDL_WINDOW_SHOWN);
m_main_renderer = SDL_CreateRenderer(m_main_window, -1, SDL_RENDERER_ACCELERATED);

m_main_w is 640 and m_main_h is 480

after calling

SDL_RendererInfo info;
SDL_GetRendererInfo(m_main_renderer, &info); 

i see that info.flags is set to 10, which is b00001010 so flags SDL_RENDERER_ACCELERATED and SDL_RENDERER_TARGETTEXTURE are set, SDL_RENDERER_SOFTWARE and SDL_RENDERER_PRESENTVSYNC are off

then when calling

long x = SDL_GetTicks();
SDL_RenderPresent(m_main_renderer); // swap();
long y = SDL_GetTicks();
if (y > x+1)
{
	std::wstring s=L"present time ";
	s += ltow(y-x,NULL);
	ppw_debug_string(s);
}

I get times between 2msec and 15msec…

any suggestions ?

the time is never more than 15msec, which makes me think of a vsync issue? but that flag is off? could it be ?

The resolution of the timer might not be high enough to do the measurement.
Use a high precision timer.Am 05.09.2015 09:40 schrieb “jeroen clarysse” <jeroen.clarysse at telenet.be>:

in my app, i notice that calling SDL_RenderPresent() takes at least
4msecs, sometimes up to 15msec !

i wonder why this is so slow ? The actual drawing and bltting is always
done in less than a msec, but presenting takes longer ?

this is my init code :

m_main_window = SDL_CreateWindow("Main

window",SDL_WINDOWPOS_UNDEFINED,SDL_WINDOWPOS_UNDEFINED,m_main_w,m_main_h,SDL_WINDOW_SHOWN);
m_main_renderer = SDL_CreateRenderer(m_main_window, -1,
SDL_RENDERER_ACCELERATED);

m_main_w is 640 and m_main_h is 480

after calling

    SDL_RendererInfo info;
    SDL_GetRendererInfo(m_main_renderer, &info);

i see that info.flags is set to 10, which is b00001010 so flags
SDL_RENDERER_ACCELERATED and SDL_RENDERER_TARGETTEXTURE are set,
SDL_RENDERER_SOFTWARE and SDL_RENDERER_PRESENTVSYNC are off

then when calling

    long x = SDL_GetTicks();
    SDL_RenderPresent(m_main_renderer); // swap();
    long y = SDL_GetTicks();
    if (y > x+1)
    {
            std::wstring s=L"present time ";
            s += ltow(y-x,NULL);
            ppw_debug_string(s);
    }

I get times between 2msec and 15msec…

any suggestions ?

the time is never more than 15msec, which makes me think of a vsync issue?
but that flag is off? could it be ?


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

Most Likely, the renderer is ignoring SDL_RENDERER_PRESENTVSYNC and
enforcing Vsync anyway.

Pallav Nawani
IronCode Gaming Private Limited
Website: http://www.ironcode.com
Twitter: http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming
Mobile: 9997478768On Sat, Sep 5, 2015 at 1:10 PM, jeroen clarysse <jeroen.clarysse at telenet.be> wrote:

in my app, i notice that calling SDL_RenderPresent() takes at least
4msecs, sometimes up to 15msec !

i wonder why this is so slow ? The actual drawing and bltting is always
done in less than a msec, but presenting takes longer ?

this is my init code :

m_main_window = SDL_CreateWindow("Main

window",SDL_WINDOWPOS_UNDEFINED,SDL_WINDOWPOS_UNDEFINED,m_main_w,m_main_h,SDL_WINDOW_SHOWN);
m_main_renderer = SDL_CreateRenderer(m_main_window, -1,
SDL_RENDERER_ACCELERATED);

m_main_w is 640 and m_main_h is 480

after calling

    SDL_RendererInfo info;
    SDL_GetRendererInfo(m_main_renderer, &info);

i see that info.flags is set to 10, which is b00001010 so flags
SDL_RENDERER_ACCELERATED and SDL_RENDERER_TARGETTEXTURE are set,
SDL_RENDERER_SOFTWARE and SDL_RENDERER_PRESENTVSYNC are off

then when calling

    long x = SDL_GetTicks();
    SDL_RenderPresent(m_main_renderer); // swap();
    long y = SDL_GetTicks();
    if (y > x+1)
    {
            std::wstring s=L"present time ";
            s += ltow(y-x,NULL);
            ppw_debug_string(s);
    }

I get times between 2msec and 15msec…

any suggestions ?

the time is never more than 15msec, which makes me think of a vsync issue?
but that flag is off? could it be ?


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

are you sure ? I?m on OSX and I figured SDL_GetTicks() was accurate enough up to a msec ?

if I look at my mainloop, the value of SDL_GetTicks increments nicely?> On 05 Sep 2015, at 10:19, M. Gerhardy <martin.gerhardy at gmail.com> wrote:

The resolution of the timer might not be high enough to do the measurement. Use a high precision timer.

Am 05.09.2015 09:40 schrieb “jeroen clarysse” <@Jeroen_Clarysse>:
in my app, i notice that calling SDL_RenderPresent() takes at least 4msecs, sometimes up to 15msec !

i wonder why this is so slow ? The actual drawing and bltting is always done in less than a msec, but presenting takes longer ?

this is my init code :

m_main_window = SDL_CreateWindow("Main window",SDL_WINDOWPOS_UNDEFINED,SDL_WINDOWPOS_UNDEFINED,m_main_w,m_main_h,SDL_WINDOW_SHOWN);
m_main_renderer = SDL_CreateRenderer(m_main_window, -1, SDL_RENDERER_ACCELERATED);

m_main_w is 640 and m_main_h is 480

after calling

    SDL_RendererInfo info;
    SDL_GetRendererInfo(m_main_renderer, &info);

i see that info.flags is set to 10, which is b00001010 so flags SDL_RENDERER_ACCELERATED and SDL_RENDERER_TARGETTEXTURE are set, SDL_RENDERER_SOFTWARE and SDL_RENDERER_PRESENTVSYNC are off

then when calling

    long x = SDL_GetTicks();
    SDL_RenderPresent(m_main_renderer); // swap();
    long y = SDL_GetTicks();
    if (y > x+1)
    {
            std::wstring s=L"present time ";
            s += ltow(y-x,NULL);
            ppw_debug_string(s);
    }

I get times between 2msec and 15msec…

any suggestions ?

the time is never more than 15msec, which makes me think of a vsync issue? but that flag is off? could it be ?


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

I?ve been browsing through the SDL code, and the only override would be with SDL_Hint, but that one is set to 0

anyone experience with this ?> On 05 Sep 2015, at 10:24, Pallav Nawani wrote:

Most Likely, the renderer is ignoring SDL_RENDERER_PRESENTVSYNC and enforcing Vsync anyway.

Pallav Nawani
IronCode Gaming Private Limited
Website: http://www.ironcode.com
Twitter: http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming
Mobile: 9997478768

On Sat, Sep 5, 2015 at 1:10 PM, jeroen clarysse <@Jeroen_Clarysse> wrote:
in my app, i notice that calling SDL_RenderPresent() takes at least 4msecs, sometimes up to 15msec !

i wonder why this is so slow ? The actual drawing and bltting is always done in less than a msec, but presenting takes longer ?

this is my init code :

m_main_window = SDL_CreateWindow("Main window",SDL_WINDOWPOS_UNDEFINED,SDL_WINDOWPOS_UNDEFINED,m_main_w,m_main_h,SDL_WINDOW_SHOWN);
m_main_renderer = SDL_CreateRenderer(m_main_window, -1, SDL_RENDERER_ACCELERATED);

m_main_w is 640 and m_main_h is 480

after calling

    SDL_RendererInfo info;
    SDL_GetRendererInfo(m_main_renderer, &info);

i see that info.flags is set to 10, which is b00001010 so flags SDL_RENDERER_ACCELERATED and SDL_RENDERER_TARGETTEXTURE are set, SDL_RENDERER_SOFTWARE and SDL_RENDERER_PRESENTVSYNC are off

then when calling

    long x = SDL_GetTicks();
    SDL_RenderPresent(m_main_renderer); // swap();
    long y = SDL_GetTicks();
    if (y > x+1)
    {
            std::wstring s=L"present time ";
            s += ltow(y-x,NULL);
            ppw_debug_string(s);
    }

I get times between 2msec and 15msec…

any suggestions ?

the time is never more than 15msec, which makes me think of a vsync issue? but that flag is off? could it be ?


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

Most Likely, the renderer is ignoring SDL_RENDERER_PRESENTVSYNC and enforcing Vsync anyway.

hm? you could be right : if I look in SDL_render_gl.c, around line 80, I see this :

SDL_RenderDriver GL_RenderDriver = {
GL_CreateRenderer,
{
“opengl”,
(SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE),
1,
{SDL_PIXELFORMAT_ARGB8888},
0,
0}
};

so SDL_RENDERER_PRESENTVSYNC seems to be hardcoded ???

That seems to be a list of flags supported by the renderer.

Now that you’ve mentioned that, I think it is probably not the renderer,
but the graphics driver that is enforcing vsync.

You could try running other 3D programs and see if they are too bound by
vsync. This issue has come up more than once in this list, and I think that
was the reason.

Pallav Nawani
IronCode Gaming Private Limited
Website: http://www.ironcode.com
Twitter: http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming
Mobile: 9997478768On Sat, Sep 5, 2015 at 2:03 PM, jeroen clarysse <jeroen.clarysse at telenet.be> wrote:

Most Likely, the renderer is ignoring SDL_RENDERER_PRESENTVSYNC and
enforcing Vsync anyway.

hm? you could be right : if I look in SDL_render_gl.c, around line 80, I
see this :

SDL_RenderDriver GL_RenderDriver = {
GL_CreateRenderer,
{
“opengl”,
(SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC |
SDL_RENDERER_TARGETTEXTURE),
1,
{SDL_PIXELFORMAT_ARGB8888},
0,
0}
};

so SDL_RENDERER_PRESENTVSYNC seems to be hardcoded ???


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

Measuring the fps of you app without fps guard is the clear way to
verify you problem.On Sat, Sep 5, 2015 at 4:59 PM, Pallav Nawani wrote:

That seems to be a list of flags supported by the renderer.

Now that you’ve mentioned that, I think it is probably not the renderer, but
the graphics driver that is enforcing vsync.

You could try running other 3D programs and see if they are too bound by
vsync. This issue has come up more than once in this list, and I think that
was the reason.

Pallav Nawani
IronCode Gaming Private Limited
Website: http://www.ironcode.com
Twitter: http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming
Mobile: 9997478768

On Sat, Sep 5, 2015 at 2:03 PM, jeroen clarysse <jeroen.clarysse at telenet.be> wrote:

Most Likely, the renderer is ignoring SDL_RENDERER_PRESENTVSYNC and
enforcing Vsync anyway.

hm? you could be right : if I look in SDL_render_gl.c, around line 80, I
see this :

SDL_RenderDriver GL_RenderDriver = {
GL_CreateRenderer,
{
“opengl”,
(SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC |
SDL_RENDERER_TARGETTEXTURE),
1,
{SDL_PIXELFORMAT_ARGB8888},
0,
0}
};

so SDL_RENDERER_PRESENTVSYNC seems to be hardcoded ???


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


Work hard, but also play hard and have fun.

Measuring the fps of you app without fps guard is the clear way to
verify you problem.

hm, i dont know : simply measuring the time before and after presenting (swap) should detect this too… I could also inspect the time difference between AFTER and BEFORE, and add that to the difference between BEFORE and AFTER. Together, if this becomes a constant, will be the VSYNC time if VSYNC is on. Unless there is some weird thing going on that also adds up wasting the same amount of time EVERY time

2015-09-05 5:24 GMT-03:00, Pallav Nawani :

Most Likely, the renderer is ignoring SDL_RENDERER_PRESENTVSYNC and
enforcing Vsync anyway.

This reminds me, there are two ways to enable vsync (that flag and a
hint), but only one of them actually works… but I can’t remember
which one :O) I had stumbled upon this with Sol before and my solution
was just to set both things to be safe.

The hint is SDL_HINT_RENDER_VSYNC if I recall correctly.

I had this issue on a samsung device. I was able to solve it by adding this
code before my window create call.

SDL_GetDisplayMode(0, 0, &sdpm);
i_width = sdpm.w;
i_height = sdpm.h;

SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);

window = SDL_CreateWindow(title, SDL_WINDOWPOS_CENTERED,

SDL_WINDOWPOS_CENTERED, i_width, i_height, SDL_WINDOW_OPENGL |
SDL_WINDOW_SHOWN);

You can also try 8, 8, 8 if 5,6,5 doesn’t work for you.On Sat, Sep 5, 2015 at 2:59 AM, Davide Coppola wrote:

Thank you Gabriel.

For future reference the related bug report is:
https://bugzilla.libsdl.org/show_bug.cgi?id=2291

I haven’t tried any workaround yet, but I will post my results here and on
Bugzilla.

Cheers


Davide Coppola

email: vivaladav at gmail.com
website: http://www.davidecoppola.com
blog: http://blog.davidecoppola.com

http://plus.google.com/+DavideCoppola
http://www.linkedin.com/in/davidecoppola
http://www.twitter.com/vivaladav


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

I wonder why SDL requests a R3 G3 B2 (8-bit) system GL framebuffer by default in the first place. I?d expect SDL to default to at least 5,6,5 (16-bit) ? sane systems will probably just give back 16 or 24/32 bit when 8 bit is requested, in any case.

Ryan / Sam: would you object to changing the default RGB bit sizes that SDL requests for the system GL framebuffer from 3,3,2 to 5,6,5?> On Sep 5, 2015, at 1:52 PM, Owen Alanzo Hogarth wrote:

I had this issue on a samsung device. I was able to solve it by adding this code before my window create call.

SDL_GetDisplayMode(0, 0, &sdpm);
i_width = sdpm.w;
i_height = sdpm.h;

SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);

window = SDL_CreateWindow(title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, i_width, i_height, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN);

You can also try 8, 8, 8 if 5,6,5 doesn’t work for you.


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

I always thought that the default size of the rgb bitfields depended on
system capabilities.On Sat, Sep 5, 2015 at 12:27 PM, Alex Szpakowski wrote:

I wonder why SDL requests a R3 G3 B2 (8-bit) system GL framebuffer by
default in the first place. I?d expect SDL to default to at least 5,6,5
(16-bit) ? sane systems will probably just give back 16 or 24/32 bit when 8
bit is requested, in any case.

Ryan / Sam: would you object to changing the default RGB bit sizes that
SDL requests for the system GL framebuffer from 3,3,2 to 5,6,5?

On Sep 5, 2015, at 1:52 PM, Owen Alanzo Hogarth wrote:

I had this issue on a samsung device. I was able to solve it by adding
this code before my window create call.

SDL_GetDisplayMode(0, 0, &sdpm);
i_width = sdpm.w;
i_height = sdpm.h;

SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);

window = SDL_CreateWindow(title, SDL_WINDOWPOS_CENTERED,

SDL_WINDOWPOS_CENTERED, i_width, i_height, SDL_WINDOW_OPENGL |
SDL_WINDOW_SHOWN);

You can also try 8, 8, 8 if 5,6,5 doesn’t work for you.


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

SDL requests an R3G3B2-sized color framebuffer by default: https://hg.libsdl.org/SDL/file/6d6a972746b3/src/video/SDL_video.c#l2669 https://hg.libsdl.org/SDL/file/6d6a972746b3/src/video/SDL_video.c#l2669

But systems are allowed to actually use larger sizes than what was requested (and they definitely do in practice.) The 3-3-2 request just seems to screw up colors on some Android devices.> On Sep 5, 2015, at 4:31 PM, Raymond Jennings wrote:

I always thought that the default size of the rgb bitfields depended on system capabilities.

  1. Your video driver probably comes with a way to force VSYNC off no
    matter what the app asks for, so you can try that.

  2. Calling a “Draw” function using Direct3D/OpenGL doesn’t draw
    anything. It just places commands into a queue to be processed
    asynchronously by the GPU. If you Present before rendering has finished,
    Present will block.On 05/09/2015 3:40 AM, jeroen clarysse wrote:

in my app, i notice that calling SDL_RenderPresent() takes at least 4msecs, sometimes up to 15msec !

i wonder why this is so slow ? The actual drawing and bltting is always done in less than a msec, but presenting takes longer ?

this is my init code :

 m_main_window = SDL_CreateWindow("Main window",SDL_WINDOWPOS_UNDEFINED,SDL_WINDOWPOS_UNDEFINED,m_main_w,m_main_h,SDL_WINDOW_SHOWN);
 m_main_renderer = SDL_CreateRenderer(m_main_window, -1, SDL_RENDERER_ACCELERATED);

m_main_w is 640 and m_main_h is 480

after calling

SDL_RendererInfo info;
SDL_GetRendererInfo(m_main_renderer, &info);

i see that info.flags is set to 10, which is b00001010 so flags SDL_RENDERER_ACCELERATED and SDL_RENDERER_TARGETTEXTURE are set, SDL_RENDERER_SOFTWARE and SDL_RENDERER_PRESENTVSYNC are off

then when calling

long x = SDL_GetTicks();
SDL_RenderPresent(m_main_renderer); // swap();
long y = SDL_GetTicks();
if (y > x+1)
{
std::wstring s=L"present time ";
s += ltow(y-x,NULL);
ppw_debug_string(s);
}

I get times between 2msec and 15msec…

any suggestions ?

the time is never more than 15msec, which makes me think of a vsync issue? but that flag is off? could it be ?


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

I?ll have multiple graphs at the same time to be displayed on the 2nd monitor. Data from these graphs is accumulated in a separate thread and stored in arrays of doubles. What is the fastest/best way to draw these graphs (separately, on different sections of the screen) ?

a) directly to the renderer with SDL_RenderDrawPoints()
b) to a surface by getting a pointer to the pixels , setting the proper pixels and then blitting the surface to the renderer
c) idem as b, but to a texture ?

thanks !

SDL_RenderDrawLine
http://wiki.libsdl.org/SDL_RenderDrawLine?highlight=(\bCategoryRender\b)|(CategoryEnum)|(CategoryStruct)()
or SDL_RenderDrawLines
http://wiki.libsdl.org/SDL_RenderDrawLines?highlight=(\bCategoryRender\b)|(CategoryEnum)|(CategoryStruct)
()
And
SDL_RenderFillRect
http://wiki.libsdl.org/SDL_RenderFillRect?highlight=(\bCategoryRender\b)|(CategoryEnum)|(CategoryStruct)()
or SDL_RenderDrawRects()
Will be the fastest way if they can be used in your project. Eg. Drawing
Bar Graphs, lines, circles etc. You can use SDL_RenderDrawLine
http://wiki.libsdl.org/SDL_RenderDrawLine?highlight=(\bCategoryRender\b)|(CategoryEnum)|(CategoryStruct)()
to do scanline rendering of polygons etc. See SDL2_gfx. Once you get
polygons working, you can render pretty much any shape.

If Not, then (b) might be the fastest.

Pallav Nawani
IronCode Gaming Private Limited
Website: http://www.ironcode.com
Twitter: http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming
Mobile: 9997478768On Mon, Sep 7, 2015 at 12:40 PM, jeroen clarysse <jeroen.clarysse at telenet.be wrote:

I?ll have multiple graphs at the same time to be displayed on the 2nd
monitor. Data from these graphs is accumulated in a separate thread and
stored in arrays of doubles. What is the fastest/best way to draw these
graphs (separately, on different sections of the screen) ?

a) directly to the renderer with SDL_RenderDrawPoints()
b) to a surface by getting a pointer to the pixels , setting the proper
pixels and then blitting the surface to the renderer
c) idem as b, but to a texture ?

thanks !


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