PDA

View Full Version : Texture map isn't created?



Rakehell
10-28-2013, 08:38 PM
glGenTextures(1, &textures[8]);
glActiveTexture(GL_TEXTURE8);
glBindTexture(GL_TEXTURE_2D, textures[8]);
glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textures[8], 0);

[[rendering]]

glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer_2);
glUseProgram(_program);
glActiveTexture(GL_TEXTURE8);
glBindTexture(GL_TEXTURE_2D, textures[8]);
glUniform1i(glGetUniformLocation(_program, "Decal"), 8);

[[rendering]]



The texture doesn't load. The surface it's supposed to be mapped to appears transparent. What am I doing wrong?

carsten neumann
10-29-2013, 05:47 AM
You only reserve a name for a texture object (glGenTextures), but this name would only become a texture object when you specify/reserve storage for it (glTexStorage*() or glTexImage*() calls), which is missing from the code you posted.