I’ve been playing around with making simple HUDs in the 3d viewports for a couple of days now, but I am having some trouble with glColor settings. I can make a rectangle on the screen with a simple script as so:
The problem is that the value I set for alpha in glColor (4th argument) seems to have no effect on the display. Am I simply mis-using that command? I did some poking around on the opengl.org site, but I did not find any information that I could use. I am quite new to the BGL module, so if there is a good reference for beginners, that would be welcome as well. Thanks.
ok, i am talking out of my rare since i have little experience with OGL coding, but maybe the colorbuffer only has RGB enabled? Can you somehow check/enable the alpha plane?
in glut, it’s something like this:
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
Sorry if that makes no sense at all, just trying to help ;D
You were both correct, I needed to enable alpha first. Thanks MvGulik for the sample code, it works perfectly. Now for a follow-up question. Is it documented somewhere that I need to enable alpha first, and if so where would I find that information? Basically I am looking for a reference for any future problems that I come up with. Thanks again.
I just noticed that the HUD shows up in all 3d viewports that I have open. Is there any way to restrict in which viewports the HUD displays? I know each panel has an ID associated with it, but is there a command to tell the script to only draw in panel #10, for example?
I had this problem programming shaders. You have to activate the alpha in face mode. If you don´t the fourth parameter will always be overwritten with value 1.0. Enable it and you can adjust it nicely with your gl command.