Skip to main content
gamedev.net
🔒 Locked

CsGL Bitmap

Started by bojkarPL Jan 23, 2005 at 11:01 AM 0 replies 650+ views
Original Post
bojkarPL
bojkarPL
I have bitmap with pink backgroud and I wanna to don't render this background and I wrote this funcion: public void LoadBmp(string path) { Bitmap bitmap = new Bitmap(path); bmp.width = bitmap.Width; bmp.height = bitmap.Height; bmp.texWidth = nextPower2(bmp.width); bmp.texHeight = nextPower2(bmp.height); bmp.data = new CsGL.Pointers.PUInt8(bmp.texWidth*bmp.texHeight*4); for (int y = 0; y < bmp.height; y++) { int line = bmp.texWidth*(bmp.height - 1 - y); for (int x = 0; x < bmp.width; x++) { Color c = bitmap.GetPixel(x, y); bmp.data[(line+x)*4 ] = c.R; bmp.data[(line+x)*4+1] = c.G; bmp.data[(line+x)*4+2] = c.B; if(c.R==1 && c.B==1) { bmp.data[(line+x)*4+3] = 1; } else { bmp.data[(line+x)*4+3] =0; } } } GL.glBindTexture(GL.GL_TEXTURE_2D, textureID); GL.glTexImage2D(GL.GL_TEXTURE_2D, 0, 4, bmp.texWidth, bmp.texHeight, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, bmp.data); GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR); GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR); GL.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_DECAL); GL.glFlush(); } And my picture is don't render :/

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.