Fading in/out of a scene
Im currently making a demo, but Im having a lot of trouble getting it to fade in/out of black. Ive tried giving the whole scene an alpha value and slowly increasing that ... but it just appears like normal. Ive tried blending a black quad over the entire scene and changing its alpha value and still no luck.
Anyone care to enlighten me as to what im doing wrong... I am probably not blending the quad properly or somthing like that.
Thanks in advance... i can post some of the code if need be
One option (not the best) is to use the imaging extention. It has a brightness control. But stay away from extentions whenever possible. I have always used the black quad like you said, it should by all means work. Show some code and I may be able to spot your problem.
Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
if (morphin == true) { glLoadIdentity(); glTranslatef(0,0,-10); glBlendFunc(GL_SRC_ALPHA,GL_ONE); glEnable(GL_BLEND); // Enable Blending glColor4f(0,0,0,morphval); glDisable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); glBegin(GL_QUADS); glVertex3f(-500,500,0); glVertex3f(500,500,0); glVertex3f(500,-500,0); glVertex3f(-500,-500,0); glEnd(); morphval -= 0.01f; if(morphval <= 0) { morphin = false; } glDisable(GL_BLEND); glEnable(GL_DEPTH_TEST); glEnable(GL_LIGHTING); }
Thats what I have now... I tried a bunch of other ways... like without disabling lighting and depth testing ... but that did nothing...
Thanks again
First off, I assume this is being called at the end of the draw code, as it disables depth testing. Second, try using
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Um, I think that''s right. Lemme know.
Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Um, I think that''s right. Lemme know.
Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
For a black quad, you can use GL_ZERO, GL_ONE_MINUS_SRC_ALPHA or even GL_ONE, GL_SRC_ALPHA (and then think of the source alpha as a brightness for your background--ie. 0 = totaly black, 1 = totally white). The GL_ZERO means that no source color info is used. I would hope GL_ZERO would skip some math in the blend routine, but I dunno.
Just some additional info to confuse you.
Just some additional info to confuse you.
I''m also puzzling with a fade to black effect. I basically have the same code as above with
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
my problem is that as soon as i start drawing the fade , so alpha would be 0. The screen looks darker.but with a alpha of 0 i should see the normal screen?
This annoys me since there is a jump in my fade. It looks ok but it''s not what i want ;-)
i didn''t disable lighting, hope that''s going to help
-Airo
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
my problem is that as soon as i start drawing the fade , so alpha would be 0. The screen looks darker.but with a alpha of 0 i should see the normal screen?
This annoys me since there is a jump in my fade. It looks ok but it''s not what i want ;-)
i didn''t disable lighting, hope that''s going to help
-Airo
Have a look at my demo''s source (CrystalTears).. I have some routines to fade in/out screen with quads...
Thanks i''ll do that.
By the way do you have crystal tears working for w98 se?
Cause i''m still curious how it looks
By the way do you have crystal tears working for w98 se?
Cause i''m still curious how it looks
Not yet.. someone mailed me that the only thing he needed to change was timer functions to make it work... bu he didn''t sent me the modyfied code yet.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement