SDL_Renderer does not allow shaders, you'd have to write your own stuff, not sure if there's any way to mix your code with SDL (would surprise me since the renderer is abstracted). Also last time I checked the OpenGL version of SDL_Renderer was using the fixed function pipeline (probably for compatibility reasons) so the 2.1 version makes sense.
You should maybe check SFML which has everything you're asking for: shader support, custom shapes and ability to mix with your own rendering code.
Way too late into the project for that now. I'm not only using SDL for rendering, either, but other stuff too. I've worked with SFML before but actually moved on to SDL when SDL 2 came out, because it seemed so much better in every aspect. Not being able to use an SDL_Renderer is fine, but surely doing it manually must be a common enough thing that I should be able to download someone's work and use it instead of having to reïnvent that wheel for the five thousandth time in the history of SDL 2 applications? That was what I was hoping for.
If you want above OpenGL 2.1 on OS X you have to explicitly ask for a Core profile. Apple doesn't support the new "Compatibility" profile which is the default in SDL2. Basically you need to modify your startup code with this before you create the GL context:
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
I'm pretty sure that's it and you'll start seeing OpenGL 4.1 reported for you.
Nah, already doing that (tho with 3.1, not 4.1, but maybe 4.1
would work, since that's the version that should be available? – I'll check after breakfast).
Though note that if you're using the SDL_Renderer stuff, as mentioned above, this won't matter too much. If you want to use SDL_Renderer, you should probably stick to just that. If you go OpenGL, you'll probably want to handle all rendering yourself.
I guess, but again, surely there must be finished code available for that?
If you're just doing basic 2D/3D, you probably can just stick with OpenGL 2.1, also. 4.1 has some nice features, but (from my I'm-not-a-professional-graphics-programmer standpoint) it's mostly performance stuff for high end work. For most indie games you'll be just as fine using 2.1 as 4.1.
Yeah, it's supposed to be a 2D game primarily, but it's running at a pretty high resolution, and it seems much faster to render some really low-poly models with pretty, unlit textures, more or less like sprites, that I can animate (I want a big crane to turn 180 degrees, for example, and putting that in as an animated texture would be enormous and really unnecessary). I don't need anything advanced 3D-wise. But I do need advanced shaders for the actual 2D game. It relies heavily on lighting and obscuring, for example. Could 2.1 still do that? But if I ditch the SDL_Renderer, I should be able to use any GL version I want, right?
SDL2's built in rendering still sucks. You can hardly draw a decently large tiled scene without it slowing to a crawl on older hardware. I'd advocate using OpenGL even for 2D games.
Runs fine in my 1920x1080 window on my old 2011 ~ 2012 MacBook so far, tho it does get slow when I turn on my temporary CPU lighting system using polygons and clipping, which is one of the things I wish to turn into a shader-based solution eventually, and it did run terribly slow on any smartphone weaker than the iPhone 5 when I made an iOS/Android game with it, so that's probably true. Another reason to upgrade. Everything's nicely abstracted into my own library, tho, so hopefully updates shouldn't take too long, BUT hopefully not as long as it should have to, because:
But again, even if I need to use pure GL and not SDL_Renderer after all, surely there must be ready-made code for the basics available so that I don't have to reïnvent that wheel?And I don't really mean stitching various tutorial code together or something, but some sort of lightweight add-on module or set of classes or functions or whatever for SDL 2 made and released by some nice fellow.
I'll do it myself if I have to, but it does feel weird that I should have to for something as common and fundamental as this.