Alright, I basically want to read through a bitmap image pixel by pixel, and if the pixel is a certain color, change that pixels alpha value. I’m not quite sure how to do this. I have tried glReadPixels and glDrawPixels, but it isn’t even reading them correctly. Here’s the code:
<div class=“ubbcode-block”><div class=“ubbcode-header”>Click to reveal… <input type=“button” class=“form-button” value=“Show me!” onclick=“toggle_spoiler(this, ‘Yikes, my eyes!’, ‘Show me!’)” />]<div style=“display: none;”> GLbyte glDrawPixel[4] = {0,0,0,1},glReadPixel[3] = {0,0,0};
int a,b;
glGenTextures(1,glTexture);
glPixelStorei(GL_UNPACK_ALIGNMENT,4);
glBindTexture(GL_TEXTURE_2D,*glTexture);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
for(a = 0;a < iWidth;++a)
{
for(b = 0;b < iHeight;++b)
{
glReadPixels(a,b,1,1,GL_RGB,GL_UNSIGNED_BYTE,glReadPixel);
if(glReadPixel[0] == 0 &&glReadPixel[1] == 1 && glReadPixel[2] == 1)
{
glRasterPos2f(a,b);
glDrawPixels(1,1,GL_RGBA,GL_UNSIGNED_BYTE,glDrawPixel);
}
}
}
glTexImage2D(GL_TEXTURE_2D,0,4,iWidth,iHeight,0,GL_RGB,GL_UNSIGNED_BYTE,data);
glBindTexture(GL_TEXTURE_2D,0);[/QUOTE]</div>
Yeah, I really don’t know what I’m doing as I’ve never tried this before. Any help would be appreciated!