Hello everyone, I have a small problem. I rendered a scene where I have a few objects loaded from config file and I need to display a transparent layer over them. I thought that I can create an empty object in the code and set him black color with 50% alpha channel and than it's going to display automatically, but I was wrong.
I tried to find how objects are rendering in engine, but I didn't find anything (the engine code is really complex). So what is my question, I need manually create in code some colored rectangle and render it with transparency. I don't want to load any resources from config file.
Thank all of you for your suggestions.
Well, if you create an empty object, it doesn't have any visuals (aka orxGRAPHIC), so nothing will get rendered. Objects are multi-purpose containers and visuals are totally optional.
So yes, there are many way to do it programmaticaly, even by creating an orxGRAPHIC yourself, or even by listening to render events and issueing rendering calls yourself, but there's a much easier way to do that, via config (no resource loading).
Orx has a special "texture" called pixel which is a simple 1x1 white texture. So, let's say you want to cover the full viewport with that tranparent layer, here's what you'd do:
If that doesn't suit your needs, please let me know.
The texture 'pixel' is mentioned in the CreationTemplate.ini file, but it's very easy to miss.
You can also modify/create textures on the fly. An example of this can be found in the display/orxFont.c file: that's how we create the default font texture from a memory buffer.