I just got started with opengl so forgive me if I am missing something huge.
I am trying to load a 128x128 png into a simple opengl context. I have a function that takes in a pixel pointer in GLuint* form (shown below)
bool Texture::loadTextureFromPixels32(GLuint* pixels, GLuint width, GLuint height)
{
freeTexture();
mTextureWidth = width;
mTextureHeight = height;
glGenTextures(1, &mTextureID);
glBindTexture(GL_TEXTURE_2D, mTextureID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, NULL);
GLenum error = glGetError();
if(error != GL_NO_ERROR);
{
printf("Error loading texture from %p. %s\n", pixels, gluErrorString(error));
return false;
}
return true;
}
I have to cast image->getPixelsPtr() to GLuint* to get it to pass into that function but then opengl spits out an error saying it can't load that image.
Does anyone have any idea of what is going wrong?
Thanks in advance,
Dartos