Jump to content
  • Advertisement
Sign in to follow this  
Claudio

Gradient Background

This topic is 3275 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

Hi. I use DirectX 9. My problem is: how can I create a background that is the scale of color from color1 (in rgb) to color2 (in rgb) in only one direction on the screen (for example from left to right or from top to bottom) ? My ideas are the follow: idea 1 - loading a texture (image) that is the desired background idea 2 - use the function "clear(...)" in the rendering function, where the scale color is created by my new function using the input parameter "RECT" of the same function "clear" ? What do you think about my ideas ? Are they (almost one) possible ? and not impossible to implement ? Or are there another solutions to my problem ? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Erik Rufelt
See Tutorial 2: Rendering Vertices. You can make the vertices have different colors, and the triangle will automatically draw a gradient between them. Once you have that, you only need to create two triangles and stretch them to cover the screen.


Hi.

Thanks.

In my virtual scene, now there's only one 3D object.

With your solution, there will be a bit problem because both the two big triangular meshes both the my 3D object will be show in wireframe, when the wireframe mode will be activeted.

In you solution:
- two vertices of the three vertices (of the both two triangular meshes) have got the same color and the remanent one vertex have another color
- so, the Gouraud Shading will be applied, trough the Shader Effect ("*.fx") applied only to the two big meshes
- no using the transformations for the two big meshes because my 3D object can rotate with the mouse

Thanks.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!