Set transparent color in RGB image
I am new to OpenGL ES, hopefully someone could kindly help me out.
I have a RGB image with pink color set as transparency color. While in Direct3D, we can easily set the modulate color while creating the texture, my question is, how do we set up a transparency modulate color in OpenGL ES?
In another word, how can I tell the graphic unit not to draw pink color when it's processing the texture.
Thanks in advance.
Hi lyen!
I haven't used OpenGL ES, but IMO, it's easier to apply the alpha layer in any graphics program (like Phothoshop), and save the image as png.
I haven't used OpenGL ES, but IMO, it's easier to apply the alpha layer in any graphics program (like Phothoshop), and save the image as png.
Thanks for the reply and your suggestion, Juanxo.
I know what you suggested is a viable solution, but the programmer in me would like to know if there is a solution to programatically handle such issue =).
I know what you suggested is a viable solution, but the programmer in me would like to know if there is a solution to programatically handle such issue =).
I don't think OpenGL has a function for this (possibly some obscure extension that I don't know of though).
To do this you can either use a shader, or loop through the texture on CPU replacing pink with alpha before uploading.
The latter is probably the best idea as its a one time hit, and the branching required to implement this in a shader may not be very efficient.
To do this you can either use a shader, or loop through the texture on CPU replacing pink with alpha before uploading.
The latter is probably the best idea as its a one time hit, and the branching required to implement this in a shader may not be very efficient.
After a day of research, looks like Karwosts' suggestion is the most feasible.
DirectX does this for programmer during texture creation, I think OpenGL just wants us work a bit harder =).
Thanks all for your suggestions and help!
DirectX does this for programmer during texture creation, I think OpenGL just wants us work a bit harder =).
Thanks all for your suggestions and help!
Quote:Original post by lyen
After a day of research, looks like Karwosts' suggestion is the most feasible.
DirectX does this for programmer during texture creation, I think OpenGL just wants us work a bit harder =).
Thanks all for your suggestions and help!
You are thinking of D3DX, the utility library.
The equivalent of the D3DX are some libraries at the Alternative Game Lib forum
here on gamedev.
A lot of stuff for doing math, quaternion, image manipulation.
Perhaps DevIL do what you want (DevIL = Developer Image Library)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement