Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Texture map isn't created?

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2013
    Posts
    22

    Texture map isn't created?

    Code :
    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?

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Apr 2010
    Posts
    716
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •