Red Letters – DivX Version (Normal Quality), DVD (Good Quality), PDA Version

Red LettersRed Letters (2000)

IMDB rating: 4.90

Plot: After a sexual harassment incident, Dennis Burke (Peter Coyote), a Nathaniel Hawthorne scholar, goes to work at a California college. He begins correspondence with an imprisoned murderer, Lydia Davis (Nastassja Kinski). Burke is finding old habits hard to break, developing relationships with obsessive coeds. Meanwhile, Lydia escapes from prison. Dennis and his colleague Thurston, a computer scientist and hacker, find themselves caught in a web of intrigue.

Download

Available versions:

DivX Version (Normal Quality), DVD (Good Quality), PDA Version

Directors: Battersby Bradley

Actors: Coyote Peter,Piven Jeremy,Hudson Ernie,Gleason Paul,Monroe Steve,Kier Udo,Bush Owen,Ryan Kenneth,Leckner Brian,Crime,Drama,

Download Full Version>>

How do I make colour cycling in C++?
I’ve made a program that rotates, translates and expands 2 letters

Now I need to make either my background colour or the Initials P or O change colours either by a mouse/key press or automatically timed

does anyone know how I can incorporate this into my code?

#include "stdafx.h"
#include "glut.h"

#define KEY_UP 101
#define KEY_DOWN 103
#define KEY_LEFT 100
#define KEY_RIGHT 102

int tx=0, ty=0;// translate distances should make global if to be controlled interactivly.
float sx=1.0, sy=1.0; // scaling factors should be 1 by default.
float theta=0.0;

void letter_P()// drawing object P
{

glColor3f (1.0, 0.0, 0.0); // set line colour red

glLineWidth(5.0);// set line width

glBegin(GL_LINES);// beginning of drawing
glVertex2i(75, 150);
glVertex2i(75, 600);
glVertex2i(75, 600);
glVertex2i(200, 600);
glVertex2i(200, 600);// left side line
glVertex2i(200, 300);
glVertex2i(200,300);
glVertex2i(75, 300);
// right hand side line
glEnd();// finishing drawing.
}

void letter_O()//drawing object O
{

glColor3f (0.0, 1.0, 0.0); // set line colour red

glLineWidth(5.0);// set line width or add more line styles

glBegin(GL_LINE_STRIP);
glVertex2i(400, 150);// link most lines together
glVertex2i(400, 600);
glVertex2i(400, 600);
glVertex2i(500, 600);
glVertex2i(500, 600);
glVertex2i(500, 150);
glVertex2i(500, 150);
glVertex2i(400, 150);
glEnd();

}

void init (void)
{
/* select clearing color */
glClearColor (0.0, 0.0, 1.0, 0.0);

/* initialize viewing values */
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0, 700.0, 0.0, 800.0);

}

void display()// display letters PO.
{
glClear (GL_COLOR_BUFFER_BIT); // clear screen

letter_P();
letter_O();
glFlush();
}
void myKeyboardFunc (unsigned char key, int x, int y)
{
switch (key) {

case ‘t’:
tx= tx + 1.0;
ty= ty + 1.0;
glutPostRedisplay();
break;
case ’s’:
sx=sx * 0.99;
sy=sy * 0.99;
glutPostRedisplay();
break;
case ‘S’:
sx=sx * 1.01;
sy=sy * 1.01;
glutPostRedisplay();
break;

case 27:// Escape key
exit(0);
break;
}
}

GLvoid window_special_key(int key, int x, int y)
{
switch (key) {

case KEY_RIGHT:
theta=theta-1.57; // rotation right-hand (clockwise) side
glutPostRedisplay();
break;

case KEY_LEFT:
theta=theta+1.57;// rotation left-hand (anti-colckwise) side
glutPostRedisplay();
break;

default:
printf ("Pressing %d doesn’t do anything.\n", key);
break;
}
}
void displayscreen(void)
{
/* clear all pixels */
glClear (GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

// Translate

glPushMatrix();
glTranslatef(tx,ty,0.0);// OpenGL translate function.
letter_P();
glPopMatrix();

// Scale

glPushMatrix();
glTranslatef(75*(1-sx),75*(1-sy),0);
glScalef(sx,sy,0.0);// OpenGL scaling function.
letter_O();
glPopMatrix();

glPushMatrix();
glRotatef(theta, 0.0, 0.0, 1.0);// Rotation around origin.
letter_O();
glPopMatrix();

glFlush ();
}

int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize (700, 500);
glutInitWindowPosition (100, 100);
glutCreateWindow ("Drawing Letters PO");
init ();
glutDisplayFunc(displayscreen);
glutKeyboardFunc(myKeyboardFunc);
glutSpecialFunc(&window_special_key);

printf("Press \n’s’ to scale to shrink around (0,0), \n’S’ to scale to expand, \n’t’ to translate.\n’->’ rotate right\n’<-’ rotate left\n\n");

glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}


Make some floats for color components (red, green and blue) and use those values for when you call color3f(). Programatically manipulate the individual components to change color.
Pfo | Nov 19, 2009



No Comment

Leave a Reply