But only the quad without texture is being drawn.
sTextures is a matrix of SDL_Texture* loaded successfully with IMG_Load.
I saw in opengl renderer that SDL_Texture does the glGenTexture calling and all. So I just need to bind it, right?
I’ve never used SDL_Texture*'s while rendering with OpenGL, however I can
tell you that you need a GLuint to be used when binding an active texture.
This GLuint needs to be obtained when calling glGenTextures. So even if
SDL_Texture’s initialization (which you don’t show, so we can’t assume
you’re doing it right) is correct, the struct itself, or a pointer to it,
is not the correct thing to bind. If you want, you can try to call
glGenTextures yourself, and use the result of that for your binding step,
and that might help you find out where things are breaking.
Good luck.
ChristianOn Mon, Feb 25, 2013 at 8:58 PM, Felipe - wrote:
Hello!
I’m using the latest version of SDL2. Also SDL2_image.
In my rendering code I try to use a texture in a GL_QUAD:
But only the quad without texture is being drawn.
sTextures is a matrix of SDL_Texture* loaded successfully with IMG_Load.
I saw in opengl renderer that SDL_Texture does the glGenTexture calling
and all. So I just need to bind it, right?
Not a response to the original poster, but I do have a correction.> Date: Tue, 26 Feb 2013 09:39:44 -0500
From: Christian Leger <chrism.leger at gmail.com>
To: SDL Development List
Subject: Re: [SDL] OpenGL Texture
Message-ID:
<CAHgimD__yBC0U76woaBL+ZvwwD8QN9TxKoGUr1jUYagKT2u6rQ at mail.gmail.com>
Content-Type: text/plain; charset=“iso-8859-1”
Hi,
I’ve never used SDL_Texture*'s while rendering with OpenGL, however I can
tell you that you need a GLuint to be used when binding an active texture.
This GLuint needs to be obtained when calling glGenTextures. So even if
SDL_Texture’s initialization (which you don’t show, so we can’t assume
you’re doing it right) is correct, the struct itself, or a pointer to it,
is not the correct thing to bind.
Behind the scenes it just binds the OpenGL texture (SDL itself has
access to the GLuint), so it basically works just like OpenGL from
that point on. Here’s the implementation file:
I believe that these provide relevant files as well:
The relevant functions are near the very top (for the function loaders
of the last three) and bottom (for the bind functions of all four).
Yes, thank you for answering.
That’s exacly what I was thinking.
I’m not passing GLuint’s, as mentioned, they are matrixes of SDL_Texture*.> Date: Tue, 26 Feb 2013 22:10:35 -0600
Not a response to the original poster, but I do have a correction.
Date: Tue, 26 Feb 2013 09:39:44 -0500
From: Christian Leger <chrism.leger at gmail.com>
To: SDL Development List
Subject: Re: [SDL] OpenGL Texture
Message-ID:
<CAHgimD__yBC0U76woaBL+ZvwwD8QN9TxKoGUr1jUYagKT2u6rQ at mail.gmail.com>
Content-Type: text/plain; charset=“iso-8859-1”
Hi,
I’ve never used SDL_Texture*'s while rendering with OpenGL, however I can
tell you that you need a GLuint to be used when binding an active texture.
This GLuint needs to be obtained when calling glGenTextures. So even if
SDL_Texture’s initialization (which you don’t show, so we can’t assume
you’re doing it right) is correct, the struct itself, or a pointer to it,
is not the correct thing to bind.
Not a response to the original poster, but I do have a correction.
Date: Tue, 26 Feb 2013 09:39:44 -0500
From: Christian Leger <@Christian_Leger>
To: SDL Development List
Subject: Re: [SDL] OpenGL Texture
Message-ID:
<CAHgimD__yBC0U76woaBL+ZvwwD8QN9TxKoGUr1jUYagKT2u6rQ at mail.gmail.com>
Content-Type: text/plain; charset=“iso-8859-1”
Hi,
I’ve never used SDL_Texture*'s while rendering with OpenGL, however I
can
tell you that you need a GLuint to be used when binding an active
texture.
This GLuint needs to be obtained when calling glGenTextures. So even if
SDL_Texture’s initialization (which you don’t show, so we can’t assume
you’re doing it right) is correct, the struct itself, or a pointer to
it,
is not the correct thing to bind.