My specific weird use case that requires extending the capabilities
of SDL’s renderer:
I have a couple old DOS games that use Borland’s ancient turtle
graphics library(!) There actually used to be a fairly clever
library that emulated this environment for SDL 1.2, but these have
not been ported to SDL2 and would require SDL_gfx anyway. The
originals were written on an IBM PS/2 286, but would’ve run just fine
on older machines if you had a reasonably modern gaming video card!
Something as obscure as turtle graphics do NOT belong in SDL
obviously, but the games actually both basically used it because it’s
what was there because the author was a n00b. So there’s a lot of
"moveto() then draw" sort of construction. Still, it drew filled
polygons, line arcs, and the odd filled circle, and SDL2’s renderer
neither has the ability to do this, nor the facility to let me sanely
accomplish the same outside of SDL with an arbitrary renderer.
Yet I could implement that in all but the DX9/DX11 renderers today,
and for those I’d just have to look up some API functions and port
the GLSL version to HLSL with an automated tool. Gimme another day
or so to look up how it’s done and test the result.
But I can’t do that because nobody’s allowed to add anything to the
SDL renderer, nor can the SDL renderer be extended by a library. The
standard claptrap is that if your code needs something not in the
renderer, then don’t use the renderer. Which makes it the single
most useless waste of code in SDL.
What I’d do with SDL’s renderer does not break ABI compatibility, but
it may require a little refactoring of internal code. First, I’d
add SDL_CreateGLRenderer and equivalents. At least on OpenGL 1.x
(and perhaps OpenGL ES v1, I’d have to check) this can fail due to
the context not supporting render to texture.
This covers every usage case of mixing 2D and 3D I can think of from
extension libraries like a SDL_console port to wanting to add 3D
effects to a 2D game, etc. It would even allow me to bind OpenGL the
way SDL does and make my old DOS games draw their arcs and circles
using OpenGL if possible or twiddle pixels on a surface if not.
And it can be done with or without consideration to support D3D
(though it would seem rude to not add support for that given the
Windows Store?)
Separately from that, I’d like to engage in some diff reduction
amongst the various GL render targets. I don’t think I want to do
any code refactoring, but I might port the crufty desktop GL to use
vertex arrays (for code parity with GLESv1 rather than “performance”)
and basically just make it easy to see how these renderers differ
from one another to help dispel the “maze of twisty little renderers,
all totally different” argument against doing anything to them ever.
Ideally I’d like to do the same to the two D3D renderers, but I’d
need a hand with that or at least some quality time spent with the
MSDN website. They’ll obviously be totally different from the OpenGL
renderers, but they appear to be less different from each other than
a casual diff suggests.
PSP is on its own. I’m pretty sure the PSP target doesn’t even
compile at the moment. Is someone actually maintaining it still?
From there I’d consider the problem carefully to determine how
feasible it is to allow something outside SDL to query some renderer
state details in a way that’d allow something like SDL_gfx to plug
into it and play nice. It’s possible certainly, but it might break
too many rules.
That solves all of my use cases, and all of the cases I can actually
imagine. Moreover, it can be done within the current ABI. It can
probably be improved upon when the ABI is unfrozen, but I’ll take
something that works over something theoretical in the future any day
of the week.
And for the C++ weenie l33t g4m3 c0d0rz who insist that you can’t do
curves in OpenGL without a shader to do it, there is math and a
visual explanation at http://en.wikipedia.org/wiki/B?zier_curve (not
that I think it’ll do much good?)
JosephOn Tue, Jan 20, 2015 at 05:01:56PM -0600, Bob Pendleton wrote:
LOL, I rarely post any more, too much to do on other subjects. (I just
reached the level of being a webcomic after all but I just have to jump
in here for just a minute…
This subject comes up every couple of years. It comes up in a really big
way, like now, about every five years. This subject almost always involves
the renderer and the idea of adding hooks to make it easier to write add on
libraries.
Based on experience I am going to go out on a limb and say that there will
never be a case where everyone likes the renderer as it currently is. It
would really help if people made a list of use cases for the renderer and
listed where the existing one works for them and where it fails. You need
real data to make decisions. Maybe this time we can get an all-singing
all-dancing renderer that a larger percentage of people will like. You can
not make all the people happy all the time.
The idea of hooks to support add ons is, in my arrogant opinion is not a
good idea. The new hooks become part of the SDL API and get used for
whatever, not just for add on libraries. That always happens. I have come
to live by the rule that if it can be written entirely in terms of the
existing SDL API then it is best implemented as a separate library. If
implementing it requires changing internal data structures or internal code
in SDL then it must be implemented as a new feature.
Add on libraries are you own personal projects and can be done at you own
pace and implement anything you want. Adding new features to SDL takes
dedication. You have to convince people that it is actually needed. It
helps to write a version of it your self. Even if you do that do not expect
the final version to look anything like your initial version. Expect to be
the person who has to explain it and maintain it FOREVER. When I say
dedication I mean dedication. Plus, of course, you do have to convince Sam
and Ryan that it actually should be a feature of SDL.
Back to lurking,
Bob Pendleton
TheGrumpyProgrammer.com
On Mon, Jan 19, 2015 at 7:23 PM, Sik the hedgehog < sik.the.hedgehog at gmail.com> wrote:
2015-01-19 20:26 GMT-03:00, Jared Maddox :
It might be wise to also include a way to get the surface that the
software renderer uses, though the ability to simply pass your own for
the renderer to be built around does make this unimportant for
anything except scripting languages.
The software renderer uses the window’s own surface if you create it
the usual way (yeah, I just checked). I guess that such a function
would still be useful so you don’t have to keep track of which surface
it’s using, though.
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