I have a texture. It is JPEG file, with a red RGB(255,0,0) background. What is the best way, to load this texture(or show) where my RGB(255,0,0) colors be TRANSPARENT?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Well jpegs don’t have a transparency channel (AFAIK) so the first thing to do is edit it in Paint.NET or whatever, use magic wand or similar to make your red pixels transparent, and save as a PNG.
At runtime you need to load the PNG from assets or resources into a
Bitmap.Config.ARGB_8888bitmap before converting to a texture.Finally your
GLSurfaceViewview needs to explicitly request that it’s translucent cos its opaque by default… here’s what I do in myGLSurfaceView-derived constructor, before callingsetRenderer():