<DKIM> Re: <DKIM> Re: GUI in SDL2 + opengl?

thx for this pointer. However this code is quite specific to
librocket, and I see no reference to SDL_GL_CreateContext, which
puzzles me.

From the name “SDL_GL_BindTexture” it kind of indicates that one
should be able to

  1. create an SDL2 renderer, and a texture with it
  2. create an opengl context (using SDL_GL_CreateContext)
  3. use the SDL2 texture in direct openGL calls thanks to
    "SDL_GL_BindTexture"

but I was not able to come up with a simple piece of code that does
this, and couldn’t find it in google either.

S.

Le 05/04/2015 19:54, Jeffrey Carpenter a ?crit :

Hi,

I’m not really experienced with OpenGL, per se, but you mentioning
SDL_GL_BindTexture reminds me of the "integrating libRocket with SDL2"
blog at http://mdqinc.com/blog/2013/01/integrating-librocket-with-sdl-2/
… if I understand correctly, it is the same author that developed the
functions. I’ve used the same code basis for integrating libRocket into
my own 2D engine, and have had great success mixing SDL2’s rendering
subsystem along side libRocket’s GUI. (I’ve even got SDL’s logical view
port stuff working on top of it).>
Cheers,
Jeffrey Carpenter


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

Ah, yes ? sorry, SDL_GL_CreateContext puzzles me, too. I?ve played around with it some in the past, but haven?t ever had any luck with it ?

Cheers,
Jeffrey Carpenter <@Jeffrey_Carpenter>

-------------- next part --------------
A non-text attachment was scrubbed…
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1572 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20150406/6116447c/attachment.bin

2015-04-06 9:36 GMT+02:00 Sanette :

thx for this pointer. However this code is quite specific to
librocket, and I see no reference to SDL_GL_CreateContext, which
puzzles me.

From the name “SDL_GL_BindTexture” it kind of indicates that one
should be able to

  1. create an SDL2 renderer, and a texture with it
  2. create an opengl context (using SDL_GL_CreateContext)
  3. use the SDL2 texture in direct openGL calls thanks to
    "SDL_GL_BindTexture"

but I was not able to come up with a simple piece of code that does
this, and couldn’t find it in google either.

S.

Not quite. The renderer instance (so long you’ve confirmed that indeed an
OpenGL renderer has been created and not a software fallback or D3D one)
creates the context and manages it itself. So your point 2. is not required.
You would then call SDL_GL_BindTexture instead of
glBindTexture(GL_TEXTURE_2D/GL_TEXTURE_RECTANGLE, …).