image buffer filled by
libpng now contains raw texture data. The next step is to generate a texture from it:
which is GraphicsManager::loadTexture().
Generate a new texture identifier with
Indicate that we are working on a texture with
Configure texture parameters with
glTexParameteri() to specify the way a texture is filtered and wrapped. Use
GL_NEAREST, as smoothing is not essential for a 2D game without zoom effects. Texture repetition is also not necessary and can be prevented with
... png_destroy_read_struct(&pngPtr, &infoPtr, NULL); delete rowPtrs; GLenum errorResult; glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, ...