Results 1 to 5 of 5

Thread: Blinking/Flashing Colors

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2005
    Location
    Montreal
    Posts
    2

    Blinking/Flashing Colors

    Is there a way to *blink* or *flash* colors using OpenGL. i.e a color blinking from red to green.

    Thanks in advance and my apologies if this is an obvious question. I only started looking into Opengl yesterday

  2. #2
    Member Contributor uruk's Avatar
    Join Date
    Dec 2004
    Location
    acasa :) sau la munca :(
    Posts
    66

    Re: Blinking/Flashing Colors

    assuming you use glColor*() function should be something like this (just a simple example):
    Code :
     void render_my_stuff()
     {
      glColor3ub(red,green,blue);
     
      // draw your stuff here
     
      ModifyColorsFunc();
     }
    in the ModifyColorsFunc() function you just modify the values of red, green and blue variables.
    i.e.
    for red to green transition
    red=255 green=0 blue=0 (pure red)

    red=0 green=255 blue=0 (pure green)

    red variable decreses from 255 to 0
    green variable increses from 0 to 255
    Code :
     void ModifyColorsFunc()
     {
      red--;
      if (red<0) red=0;
      green++;
      if (green>255) green=255;
      // blue is unchanged in this example
     }
    Stat rosa pristina nomine, nomina nuda tenemus.

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2005
    Location
    Montreal
    Posts
    2

    Re: Blinking/Flashing Colors

    Sorry, What I meant to say was that I have a bunch of symbols displayed on screen, but I want some of the symbols to appear as if they are blinking or flashing...

  4. #4
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,450

    Re: Blinking/Flashing Colors

    OpenGL is not VGA text mode.
    Nothing OpenGL can do for you automatically there. Everytime you want to change something in your display you need to draw it the way it should occur. Blinking objects need to be repainted with the colors you want in a timed interval you choose.

  5. #5
    Senior Member Regular Contributor
    Join Date
    Jun 2004
    Location
    mexico
    Posts
    125

    Re: Blinking/Flashing Colors

    you can make something like:
    Code :
    if(x%2==0)
        glColor3f(1,0,0);
    else
        glColor3f(0,1,0);
     
    x++;
    // then goes whatever you are drawing

Similar Threads

  1. Replies: 3
    Last Post: 06-19-2016, 08:11 AM
  2. Flashing colors, clear screen not working, lines not drawing
    By Chdata in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 12-08-2012, 02:55 PM
  3. About blinking in a MDI Interface (VC++)
    By uNsignedINT in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-02-2003, 10:21 AM
  4. blinking object
    By Rong Yao in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 01-15-2003, 05:33 PM
  5. blinking objects?
    By desoto42a in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-26-2001, 11:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean