Members - Reputation: 109
Posted 12 September 2012 - 08:28 PM
I want to be able to load a texture onto an object but when it appears on the screen it doesnt show a certain color that i gace chosen. srry if this is worded wierd. Like how would i go about setting a Color key for a certain color so opengl doesnt show it or loads it with the texture.
I would love for someone to help much thx.
Members - Reputation: 1561
Posted 12 September 2012 - 10:42 PM
When blending is used, the colors of the object you draw are mixed with the colors drawn in the opaque phase. Usually, you use a value called alpha, that controls to what extent the blending shall be done. Alpha 0 means completely transparent, and the opaque object will not be changed. Alpha 1 means completely opaque, and you will overwrite the previous pixels.
When you draw the transparent objects, they need to be sorted form far to near. The near objects will be drawn last, which is good as they matter most.
See more details for how it is done at http://www.opengl.org/wiki/Blending. If you are new to OpenGL, make sure you know about Legacy OpenGL.
Crossbones+ - Reputation: 8694
Posted 13 September 2012 - 03:16 AM
Note that other than for alpha blending, enabling GL_BLEND will generally not be very helpful for what you want. First of all, it's not immediately obvious how to get a non-cardinal color to be used as a key, and then, with lighting, your colors in the frame buffer are not what they are in the texture (pretty obvious). So, in one word, that just won't work.