Jump to content
  • Advertisement
Sign in to follow this  

Hello, and whaddya think? lol

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

Hello everyone, Just signed up here so I figured i'd introduce myself and say hi. Also here is a little snippet of code that i've wrote(my first OpenGL), I made it in Lesson7 just playing around, but i think it will work in just about anything its pretty simple(but neat) :) . I'd like to know what anyone thinks about it. Thanks
/*      Color Fade/Cycle Code Added By Garry Jewell
        Use: Rapidly Change Brightness In/Out On Colors And/Or 
        Cycle Objects Through Different Colors. Can be used pretty 
	easily to have some fun in about any program. 
	Is a first draft, feel free to edit/tweak it if ya like.
	Can Contact Me At Fubator@sbcglobal.net If you wanna
	make any suggestions/comments. Be Gentle tho ima noob lol
	This is the first OpenGL i've realy written myself. I added
	it to Lesson7, but seems like it should work in any.
// Globals
GLfloat colorfade;		// Color Brightness
bool    cfDirection;            // Color Fade Direction (FALSE=Decrease/TRUE=Increase)
int     colorSwitch;            // Used to Cycle Through Colors

// In InitGL()
	colorfade=1.0f;		// Start Color Fade At Full Intensity	
    	colorSwitch=0;          // Set Color Switch To the Begining of Its Cycle
    	cfDirection=FALSE;	// Start Color Fade Decreasing

// In DrawGLScene() Place Code Before Drawing The Objects You Want Effected
    switch (colorSwitch)	// Select Color From Premade List With colorSwitch
           case 0:
           case 1:
           case 2:
           case 3:
           case 4:
           case 5:
           case 6:
                {glColor3f(1.0f,1.0f,1.0f);break;}         // Default To Full Intensity White

// In DrawGLScene() After Drawing Is Done And Before Returning
    if (cfDirection==FALSE)				// If Fade Is In Reverse Then
    {  colorfade-=0.01f;}				// Subtract colorFade
    {  colorfade+=0.01f;}				// Increase colorFade, Fade must be going forward if 

not in reverse
    if (colorfade<=0.1f|colorfade>=1.0f) {cfDirection=!cfDirection;}	// Toggle Fade At Either Boundry
    if (colorSwitch<=5) {colorSwitch+=1;}		// Increment If Not At End Of Cycle
	                    {colorSwitch=0;}		// Restart Cycle If It Is

[Edited by - Fubator on May 20, 2006 1:30:55 PM]

Share this post

Link to post
Share on other sites
It is. If I'm correct, you could use something like this to make a fadein/fadeout technique.

It's just that it is probrably something people have already thought of or done.

But don't let that get you down! Find different things to do neat stuff with. You'll learn new tricks and get better!

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!