View Full Version : Ortho ?
11-04-2009, 02:26 PM
Hi, I'm using glOrtho to setup my Screen.
So how can I set which objects are drawn in front of others ?
And how can I set which color should be the transparent color ?
That must be magenta...
11-04-2009, 07:57 PM
Not sure what you are actually doing as you don't provide details.. Is this a HUD type Ortho view or are you dealing with lots of sprites?
In any case I would suggest sorting your objects back to front and then drawing them in that order with depth testing off.
Also can you elaborate more on what your transparent colour is doing?
11-05-2009, 03:27 AM
A tutorial for single color masking :
This should explain the basics.
11-05-2009, 04:28 AM
I am working with C++.
I just want to know how I can make, that all magenta pixels of my (3D)sprites are transparent. I'am loading BMPs, but others would also be OK.
11-05-2009, 08:06 AM
That is called chroma-keying and as far as I know OpenGL has no built-in support for it. You should expand your texture by adding an alpha channel, and set alpha to be 1 (255) everywhere and 0 on the pixels that are magenta. I would consider also replacing magenta with black to avoid artifacts when textures are filtered, otherwise you'll get magenta borders.
Finally you have to enable alpha blending before rendering your transparent sprites:
// Draw transparent sprites
11-05-2009, 02:23 PM
Thanks, solved it.
Now using PNGs.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.