LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: sergicion on November 25, 2012, 11:37:25

Title: How to put a gradient background?
Post by: sergicion on November 25, 2012, 11:37:25
I know I can put a color for the background with glClearColor(), but, how can I put a gradient?

Thanks a lot!!
Title: Re: How to put a gradient background?
Post by: Fool Running on November 26, 2012, 14:37:40
The only way to make a gradient is to create a polygon that fills up the whole view and render it (well, you can also use a fullscreen image and blit it on the screen, but that would be slower). Just change the colors of the vertexes of the polygon and you have a nice gradient. ;D
Title: Re: How to put a gradient background?
Post by: sergicion on November 27, 2012, 16:13:10
Quote from: Fool Running on November 26, 2012, 14:37:40
The only way to make a gradient is to create a polygon that fills up the whole view and render it (well, you can also use a fullscreen image and blit it on the screen, but that would be slower). Just change the colors of the vertexes of the polygon and you have a nice gradient. ;D
And a sun gradient? Like minecraft
Title: Re: How to put a gradient background?
Post by: OverBlob on November 27, 2012, 18:15:30
Another way to do it, is to make the gradient image by yourself with a image editor software (easy done with photofiltre or photoshop), and draw a quad textured with this image, that fits your whole screen!  :)
To keep it in background you must draw it before all your other drawings.