Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.



This topic is 6795 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

If your graphics card supports it then you can use IDirectDrawColorControl, otherwise you will have to lock your surface and manually change the pixels. Another alternative would be to use Direct3D.

Hope this helps.


Share this post

Link to post
Share on other sites
lets say i want to fade the picture to black and i do it manually, and lets say i got some pixel so what i need to do is that - (R-1,G-1,B-1)? until the pixel turns to black?

Share this post

Link to post
Share on other sites
You can do it that way, but say you had the colour RGB=(200,50,0) if you -1 off each component your green component would run out more quickly.
A better method would be to fade a percentage of each component colour at each iteration through the fade step.
This would allow a smoother fade. Say take off 10% each iteration, that way each RGB value decreases in a uniform amount relative to its value.

I've haven't done this in a long time, so someone scream at me if I'm crazy.

Edited by - Darrell on 3/11/00 8:53:14 AM

Share this post

Link to post
Share on other sites
I also agree that subtracting 1 off each RGB component is not the best
way to do it, since sometimes your picture turns into ugly blotches
(it is not an uniform fade).

The D3D IM way (DirectX 7.0):

Let''s say you want to fade out the entire screen to black. Create a
rectangle polygon (two triangles). You will use this to cover your
entire screen.

Then create a solid black colored material for this polygon and set
its diffuse alpha component to zero:

D3DMATERIAL7 material;
D3DUtil_InitMaterial(material, 0.0f, 0.0f, 0.0f); // black
material.diffuse.a = 0.0f; // (0% alpha)

An alpha value of 0.0 means everthing will show through your polygon,
and an alpha value of 1.0 means nothing will show through, so it
will be solid black (e.g. the color of the material that you created
it with).

When you begin to render your scene, enable alpha blending and setup
your render states for translucency:

// enable alpha blending

// source, dest

Set the material to the device, draw your polygon, then gradually increase
your material''s diffuse alpha component from 0.0f to 1.0f after each time
you render your scene.

I know I''ve left a lot of basic stuff out, but if you are already
familiar with D3D IM, then it should be a piece of cake to get it
working in a couple of minutes.


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!