Re: Cocoa-dev Digest, Vol 2, Issue 192
Re: Cocoa-dev Digest, Vol 2, Issue 192
- Subject: Re: Cocoa-dev Digest, Vol 2, Issue 192
- From: Shaun Wexler <email@hidden>
- Date: Thu, 10 Feb 2005 10:37:13 -0800
On Feb 10, 2005, at 9:38 AM, Shaun Wexler wrote:
int i, n = numFramesInLinearFade;
glDrawBuffer(GL_FRONT);
glEnable(GL_BLEND);
glColor4f(0.0f, 0.0f, 0.0f, 1.0f/(float)n);
for (i = 0; i < n; i++) {
glRectf(minX, minY, maxX, maxY);
glFlush();
// wait for next VBL
...
}
Oops, above code is wrong. You want an exponential fade to near-zero,
so it's smooooth:
int i, n = numFramesInLinearFade;
float oneOver2n = 0.5f/(float)n;
glDrawBuffer(GL_FRONT);
glEnable(GL_BLEND);
for (i = 1; i <= n; i++) {
glColor4f(0.0f, 0.0f, 0.0f, (float)i * oneOver2n);
glRectf(minX, minY, maxX, maxY);
glFlush();
// wait for next VBL
...
} // faded to < 1.53e-03
glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
glRectf(minX, minY, maxX, maxY);
glFlush();
--
Shaun Wexler
MacFOH
http://www.macfoh.com
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden