Discussion:
[SDL] I need vertex buffers
brianhj
2017-01-26 19:22:57 UTC
Permalink
I need vertex buffer objects but I HATE opengl. Will SDL ever get this feature? Or is there some way to draw 15,000 lines per frame at 60fps with SDL?
Jonathan Dearborn
2017-01-26 19:27:01 UTC
Permalink
If you don't actually need VBO access, but just want the perf benefit,
SDL_gpu can draw plenty of lines (because it does use VBOs to do batching).

https://github.com/grimfang4/sdl-gpu

Jonny D
I need vertex buffer objects but I HATE opengl. Will SDL ever get this
feature? Or is there some way to draw 15,000 lines per frame at 60fps with
SDL?
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
brianhj
2017-01-26 19:31:44 UTC
Permalink
Does this work with SDL2? Does it match the performance of OpenGL VBO? If so then yes this is exactly what i need

Thanks!!!
If you don't actually need VBO access, but just want the perf benefit, SDL_gpu can draw plenty of lines (because it does use VBOs to do batching).
https://github.com/grimfang4/sdl-gpu (https://github.com/grimfang4/sdl-gpu)
Jonny D
I need vertex buffer objects but I HATE opengl. Will SDL ever get this feature? Or is there some way to draw 15,000 lines per frame at 60fps with SDL?
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org (http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)
brianhj
2017-01-27 02:43:10 UTC
Permalink
Unfortunately I can't even get a simple program to work:


Code:
#include "SDL.h"
#include "SDL_gpu.h"

void main_loop(GPU_Target* screen) {
while (true) {
GPU_Clear(screen);
GPU_Line(screen, 0.f, 0.f, 123.f, 123.f, SDL_Color({ 123,255,255 }));
GPU_Flip(screen);
}
}

int main(int argc, char* argv[])
{
GPU_Target* screen;

screen = GPU_Init(800, 600, GPU_DEFAULT_INIT_FLAGS);
if (screen == NULL)
return -1;

main_loop(screen);

GPU_Quit();

return 0;
}





Any ideas??? It's just a black screen. I used strange coords and colors to make sure I was sane.
Daniel Gibson
2017-01-27 02:56:25 UTC
Permalink
Your color only has 3 components, the 4th (alpha) might be set to 0
because of this, making the line totally translucent (invisible)?
try something like SDL_Color c = {123, 255, 255, 255}; and use that in
the GPU_Line() call.

Cheers,
Daniel
Any ideas??? It's just a black screen. I used strange coords and colors
to make sure I was sane.
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
brianhj
2017-01-27 03:08:25 UTC
Permalink
If i could buy you a beer i would, i added 255 in there and it worked fine. Thanks buddy :D
Post by Daniel Gibson
Your color only has 3 components, the 4th (alpha) might be set to 0
because of this, making the line totally translucent (invisible)?
try something like SDL_Color c = {123, 255, 255, 255}; and use that in
the GPU_Line() call.
Cheers,
Daniel
Any ideas??? It's just a black screen. I used strange coords and colors
to make sure I was sane.
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Daniel Gibson
2017-01-27 03:16:12 UTC
Permalink
Cool, glad I could help (despite never having used SDL_GPU) :-)
Post by brianhj
If i could buy you a beer i would, i added 255 in there and it worked
fine. Thanks buddy Very Happy
brianhj
2017-01-27 03:17:12 UTC
Permalink
If i could buy you a beer i would, i added 255 in there and it worked fine. Thanks buddy :D

Unfortunately performance with line drawing isn't any better than play ol' SDL :( :( :( Very disappointed
Post by Daniel Gibson
Your color only has 3 components, the 4th (alpha) might be set to 0
because of this, making the line totally translucent (invisible)?
try something like SDL_Color c = {123, 255, 255, 255}; and use that in
the GPU_Line() call.
Cheers,
Daniel
Any ideas??? It's just a black screen. I used strange coords and colors
to make sure I was sane.
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Jonathan Dearborn
2017-01-27 03:23:28 UTC
Permalink
What numbers are you getting?

Jonny D
Post by brianhj
If i could buy you a beer i would, i added 255 in there and it worked
fine. Thanks buddy [image: Very Happy]
Unfortunately performance with line drawing isn't any better than play ol'
SDL [image: Sad] [image: Sad] [image: Sad] Very disappointed
Your color only has 3 components, the 4th (alpha) might be set to 0
because of this, making the line totally translucent (invisible)?
try something like SDL_Color c = {123, 255, 255, 255}; and use that in
the GPU_Line() call.
Cheers,
Daniel
Any ideas??? It's just a black screen. I used strange coords and colors
to make sure I was sane.
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
brianhj
2017-01-27 03:40:23 UTC
Permalink
Well I have 25 sets of lines, each with 466 lines. That's 11650 lines per frame or 699000 lines per second at 60fps.

SDL + SDL_gpu using GPU_line i get 17 FPS
SDL + OpenGL + VBO i get 60 FPS, capped by monitor i think

I just fucking hate programming in OpenGL. Every little think you need to do is a fucking science project [Evil or Very Mad]
Post by Jonathan Dearborn
What numbers are you getting?
Jonny D
If i could buy you a beer i would, i added 255 in there and it worked fine. Thanks buddy [Image: Loading Image... ]
Unfortunately performance with line drawing isn't any better than play ol' SDL [Image: Loading Image... ] [Image: http://forums.libsdl.org/images/smiles/icon_sad.gif ] [Image: http://forums.libsdl.org/images/smiles/icon_sad.gif ] Very disappointed
Your color only has 3 components, the 4th (alpha) might be set to 0
because of this, making the line totally translucent (invisible)?
try something like SDL_Color c = {123, 255, 255, 255}; and use that in
the GPU_Line() call.
Cheers,
Daniel
Any ideas??? It's just a black screen. I used strange coords and colors
to make sure I was sane.
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org (http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org (http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org (http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)
Jonathan Dearborn
2017-01-27 04:44:11 UTC
Permalink
If you want to troubleshoot this, we can take it off-list. On a Macbook
Pro, I'm getting 30fps rendering 10x that number of lines (>100,000) each
frame.

Jonny D
Well I have 25 sets of lines, each with 466 lines. That's 11650 lines per
frame or 699000 lines per second at 60fps.
SDL + SDL_gpu using GPU_line i get 17 FPS
SDL + OpenGL + VBO i get 60 FPS, capped by monitor i think
I just fucking hate programming in OpenGL. Every little think you need to
do is a fucking science project [image: Evil or Very Mad]
What numbers are you getting?
Jonny D
If i could buy you a beer i would, i added 255 in there and it worked
fine. Thanks buddy
Unfortunately performance with line drawing isn't any better than play ol'
SDL Very disappointed
Your color only has 3 components, the 4th (alpha) might be set to 0
because of this, making the line totally translucent (invisible)?
try something like SDL_Color c = {123, 255, 255, 255}; and use that in
the GPU_Line() call.
Cheers,
Daniel
Any ideas??? It's just a black screen. I used strange coords and colors
to make sure I was sane.
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
brianhj
2017-01-27 04:56:00 UTC
Permalink
Ok that would be great!!!
If you want to troubleshoot this, we can take it off-list.  On a Macbook Pro, I'm getting 30fps rendering 10x that number of lines (>100,000) each frame.
Jonny D
Well I have 25 sets of lines, each with 466 lines. That's 11650 lines per frame or 699000 lines per second at 60fps.
SDL + SDL_gpu using GPU_line i get 17 FPS
SDL + OpenGL + VBO i get 60 FPS, capped by monitor i think
I just fucking hate programming in OpenGL. Every little think you need to do is a fucking science project [Image: Loading Image... ]
What numbers are you getting?
Jonny D
If i could buy you a beer i would, i added 255 in there and it worked fine. Thanks buddy [Image: http://forums.libsdl.org/images/smiles/icon_biggrin.gif ]
Unfortunately performance with line drawing isn't any better than play ol' SDL [Image: http://forums.libsdl.org/images/smiles/icon_sad.gif ] [Image: http://forums.libsdl.org/images/smiles/icon_sad.gif ] [Image: http://forums.libsdl.org/images/smiles/icon_sad.gif ] Very disappointed
Your color only has 3 components, the 4th (alpha) might be set to 0
because of this, making the line totally translucent (invisible)?
try something like SDL_Color c = {123, 255, 255, 255}; and use that in
the GPU_Line() call.
Cheers,
Daniel
Any ideas??? It's just a black screen. I used strange coords and colors
to make sure I was sane.
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org (http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org (http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org (http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org (http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)
brianhj
2017-01-27 10:47:34 UTC
Permalink
I just set up a simple test program. I looped through 50000 random lines and i'm only getting 33 fps :(
Jonathan Dearborn
2017-01-27 12:01:45 UTC
Permalink
That could be a hardware bottleneck? I'll follow up off-list and we can
report back when settled.

Jonny D
I just set up a simple test program. I looped through 50000 random lines
and i'm only getting 33 fps [image: Sad]
Ed Phillips
2017-01-27 16:13:43 UTC
Permalink
That could be a hardware bottleneck?  I'll follow up off-list and we can report back when settled.
Jonny D
That would be great... these kinds of performance cases are interesting to
me.

Thanks,

Ed

Continue reading on narkive:
Loading...