Hello, I’m trying to edit a texture file with glReadPixels
. I don’t know much about glReadPixels
other than that it woks with a frame buffer so i’m asking one of you experts who know everything about the Implementation of glReadPixels
to show me a quick Example of how you would edit a texture file using it. So Say i have two vectors:
v1(3.0, 5.2,8.4)
& v2(3.0, 5.2)
Could someone please show me an example of how i would edit( write those coordinates ) into a texture file. You don’t have to get into any GlSl stuff either.
I do know however to have my texture loaded so it can then be edited by glreadpixels. So i load it like what you see below i don’t know if it’s to be loaded differently from the norm for this occasion:
unsigned char* image;
image = SOIL_load_image("facen.png", &textureWidth, &textureHeight, 0, SOIL_LOAD_RGB);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, Nmap);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, textureWidth, textureHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, image);
glGenerateMipmap(GL_TEXTURE_2D);
SOIL_free_image_data(image);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glBindTexture(GL_TEXTURE_2D, 0);