So I ported my application from a few month old revision of 1.3 to the latest greatest. After doing so I saw the changes around the SDL_Renderer, http://forums.libsdl.org/viewtopic.php?t=6869&start=18
After some housekeeping changes to my project I started it up but it’s assuming I’m using OpenGLES 2.0 and all my 1.0 calls fail such as matrix, texture, and many more.
Here’s what my code does…
a call to this seems to decide I’m using OPENGLES 2.0 with no questions, SDL_SetVideoMode(…, flags =| SDL_OPENGL);
…an SDL_VideoDevice is created and I noticed the gl_config.major_version == 2, couldn’t see where that was set.
…the SDL_CreateRenderer is called and passes in that I want the first renderer even though I have 3…the first is opengles2 so it just gets assumed.
…then lastly the call ends up in SDL_uikitopenglview.m::initWithFrame and the code here is a bit concerning, it renders either kEAGLRenderingAPIOpenGLES2 or kEAGLRenderingAPIOpenGLES1 based on the gl_config.major_version and not the actual renderer created for either 2.0 or 1.0?
maybe I have to look closer and instead of making a straight up SDL_SetVideoMode call I should look into the new way to do it with SDL_CreateRenderer. Hope I can be more specific which renderer I want (es 1.0). But what about the major_version condition in SDL_uikitopenglview.m this seems to not care which renderer I am truly using?
I think I can work it all out, I noticed the demo apps have been updated so maybe I’ll start there.
easy fix is to call SDL_CreateRenderer yourself.------------------------
EM3 Nathaniel Fries, U.S. Navy
http://natefries.net/
Ideally passing in the -1 will take the first renderer that matches the flags that were passed. Since ES 1 & ES 2 will always contain the same flags the -1 hint is not going to work.
Passing a “magic number” is not great either since I am assuming the ordinal.
Could adding to the sdl window flags something more specific be a change request that could be considered???
for example, all there is now is SDL_WINDOW_OPENGL but if there were also SDL_WINDOW_OPENGLES1 & SDL_WINDOW_OPENGLES2 then the -1 hint would actually be more accurate and allow versioning too.
my 2 cents
Could adding to the sdl window flags something more specific be a change
request that could be considered???
Isn’t that what
SDL_SetHint (SDL_HINT_RENDER_DRIVER, "opengles");
should be doing already?
KaiOn Mon, Feb 21, 2011 at 9:22 PM, wiseguy99 wrote:
works great, thanks for pointing this out!>
Isn’t that what
SDL_SetHint (SDL_HINT_RENDER_DRIVER, “opengles”);
should be doing already?
Kai
wiseguy99 wrote:
Ideally passing in the -1 will take the first renderer that matches the flags that were passed. Since ES 1 & ES 2 will always contain the same flags the -1 hint is not going to work.
Passing a “magic number” is not great either since I am assuming the ordinal.
Could adding to the sdl window flags something more specific be a change request that could be considered???
for example, all there is now is SDL_WINDOW_OPENGL but if there were also SDL_WINDOW_OPENGLES1 & SDL_WINDOW_OPENGLES2 then the -1 hint would actually be more accurate and allow versioning too.
my 2 cents
You can iterate through the render driver information until you find the one you want. That said, the other way is better.------------------------
EM3 Nathaniel Fries, U.S. Navy
http://natefries.net/
Nathaniel J Fries wrote:
You can iterate through the render driver information until you find the one you want. That said, the other way is better.
Code:
int renderCount = SDL_GetNumRenderDrivers();
SDL_RendererInfo *info;
for (int i=0; i<renderCount; i++) {
//SDL_GetRenderDriverInfo(i, info);
if (info->name == "opengles") {
renderer = SDL_CreateRenderer(window, i, 0);
break;
}
}
renderer = SDL_CreateRenderer(window, 1, 0);
I tried that way too but renderer will be null when I make a call to SDL_GetRenderDriverInfo?
I had to comment out that line otherwise all calls to SDL_CreateRenderer will return nothing, when commented a renderer will get created.
Not sure why but try it yourself?
The hint behaves fine for me and is preferable IMHO.