Wow, I didn't know this would come out like it did...

I was just trying to get a little cheesy motion blur effect and out came this surreal trippin thingy check it out.

#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>

void TimerFunc(int value);
void RenderScene(void);
void ChangeSize(GLsizei w, GLsizei h);

GLfloat i=0;

int main()
{
	glutInitDisplayMode(GL_DOUBLE | GLUT_RGB);
	glutCreateWindow("hello");
	glutReshapeFunc(ChangeSize);
	glutDisplayFunc(RenderScene);
	glutTimerFunc(40, TimerFunc, 1);
	glutMainLoop();
	return 0;
}

void TimerFunc(int value)
{
	i++;
	if(i==360) i=0;
	glutPostRedisplay();
	glutTimerFunc(40, TimerFunc, 1);
}

void RenderScene(void)
{
	int k;
	GLubyte Alpha=255;
	
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

	glTranslatef(0.0f, 0.0f, -100.0f);
	glRotatef(i, 1.0, 0.0, 0.0);
	glRotatef(360-i, 0.0, 1.0, 0.0);
	glRotatef(i, 0.0, 0.0, 1.0);

	glColor4ub(255,0,0,Alpha);

	for(k=0; k<4; k++)
	{
		glRotatef(i+0.3, 1.0, 0.0, 0.0);
		glRotatef(360-i+0.3, 0.0, 1.0, 0.0);
		glRotatef(i+0.3, 0.0, 0.0, 1.0);
		glBegin(GL_QUADS);
			glVertex3f(20.0f, 20.0f, 0.0f);
			glColor4ub(0,255,0,Alpha);
			glVertex3f(-20.0f, 20.0f, 0.0f);
			glColor4ub(0,0,255,Alpha);
			glVertex3f(-20.0f, -20.0f, 0.0f);
			glColor4ub(255,255,255,Alpha);
			glVertex3f(20.0f, -20.0f, 0.0f);
		glEnd();
		Alpha-=60;
	}
	
	glLoadIdentity();

	glutSwapBuffers();
}

void ChangeSize(GLsizei w, GLsizei h)
{
	if(h==0) h=1;
	glViewport(0,0,w,h);
	
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();

	GLfloat aspect = GLfloat(w)/GLfloat(h);

	gluPerspective(45, aspect, 1.0, 1000.0);

	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
}

[This message has been edited by grady (edited 05-23-2001).]

I just ran it and it looked good! If I can steal some time in the next few days I’ll put it stereo and watch it! Thanks!
Barry

I’m going to make each succesive plane transparent tonight if i can find my blue book.

Ok i edited the original. It blends now. It looks a little more intereseting.