How to load and bind a texture?

Hey,
i want my shaders to set a texture on an object. but i don’t know how to load a texture and bind it to my shaders. I read a bit in the internet but i got confused. I hope someone can help me. Thanks for all

glUniform1i() - you specify which texture-unit slot to use (0…15).
glActiveTexture(…)
glBindTexture(GL_TEXTURE_2D,…)

Thanks for your fast answer. This is how I’d do it now.

glUniform1iARB((glGetUniformLocationARB(program,“EarthTexture”),0);
glActiveTextureARB(GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_2D,???);

But I don’t know what I am suppose to write in BindTexture. I read that it has to be an integer. I mean, I have to load it somewhere, or does this happen with the specification of the texture unit. Hope you understand my confusion

You need to pass texture ID there. Read the manual…

The texture handle (for your “earth texture”). You got it from glGenTextures. And you had to bind it to specify texture data for it (e.g. through glTexImage2D, etc.)

Gee, thank you all. I got it know!

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.