Screen Brightness

BlitzMax Forums/OpenGL Module/Screen Brightness

ThE_oMiKrOn_CaT(Posted 2005) [#1]
I'm currently making a 2d game and need to be able to change the brightness of the screen during play (for a day/night effect).
i was thinking of creating a quad covering the whole screen by doing this:

glBegin
glColor3b &0,&0,&0
glVertex2i(0,0)
glVertex2i(graphicswidth(),0)
glVertex2i(graphicswidth(),graphicsheight())
glVertex2i(0,graphicsheight())
glEnd

and then a command in there to change the alpha of the quad i created.
i just dont know the gl command to do so (if at all possible) and if there could be a faster way of doing so.

any advice/opinions?

thanx!


LeisureSuitLurie(Posted 2005) [#2]
You an also do it by playing with the ambient light...assuming you're using lighting. If not, just setting glcolor3f will tint any textures you draw.


ThE_oMiKrOn_CaT(Posted 2005) [#3]
well are there any lighting command in blitzmax coz i havent seen any lol, improbably blind though

and as long as i keep that quag black and just alpha it, the tinting should be able to pass a lighting no?


LeisureSuitLurie(Posted 2005) [#4]
Right. But you can add lights using OpenGL commands.


ThE_oMiKrOn_CaT(Posted 2005) [#5]
ah yes good point lol, dont know much opengl so that's y i didnt think of that hehe! looking through the nehe stuff now, should be able to manage something!

thanx!


xlsior(Posted 2005) [#6]
Speaking of lighting: since there apparently is no built-in gamma command in BlitzMax, is there an easy way for an OpenGL light to 'light up' and evenly brighten brighten the entire screen a bit?

(And more importantly, anyone happen to have any code sample? ;-)

I know I can darken a screen by changing the drawing color to a darker tint, but you can't use the same technique to go any brighter than the default.


ImaginaryHuman(Posted 2005) [#7]
If you are redrawing everything on screen every frame, you could `normall` draw your images with a less-than-white color with SetColor, to tint them darker, and then SetColor to white to draw the brighter version.

You can also do the polygon thing you already mentioned over the whole screen, pretty fast usually. Just use glColor4b($FF,$FF,$FF,alpha) where the alpha value is how much you want to brighten it.

Playing around with lighting is likely to be much slower.

You can also try setting the color biases, which are added to the value of every pixel.