OpenGL colors won't show up?

I'm trying to make a shape in OpenGL and when I try to change the colors to anything like (3,5,6) or (2,6,4), the color will not show up. The colors only seem to be showing up when there is a zero in there somewhere. Why is that?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
  
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>


#include <iostream>
using namespace std;

#define HEIGHT 500
#define WIDTH 500

void triangle()
{
	glBegin(GL_TRIANGLES);
		glVertex2f(400, -300);
		glVertex2f(0, 400);
		glVertex2f(-400, -300);
	glEnd();
}

void drawshit()
{
	glClear(GL_COLOR_BUFFER_BIT);

	glPushMatrix();
		glTranslatef(0, 50, 0);
		glColor3f(2, 5, 5);
		triangle();
	glPopMatrix();

	glPushMatrix();
		glTranslatef(0, -50, 0);
		glColor3f(0, 0, 0);
		glRotatef(180.0, 0, 0, 0);
		triangle();
	glPopMatrix();
	glFlush();
}

int main(int argc, char* argv[ ])
{
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA);
	glutInitWindowSize(WIDTH, HEIGHT);
	glutCreateWindow("The Star of David");
	glutDisplayFunc(drawshit);
	gluOrtho2D(-WIDTH, WIDTH, -HEIGHT, HEIGHT);
	glClearColor(1, 1, 1, 0);
	glutMainLoop();
	return 0;
}
glColor3f takes 3 values between 0.0f and 1.0f, anything past that would be white I think. Try it with values such as: 1.0f, 0.0f, 1.0f (this should be magenta)
Ooh, I see. That worked, thank you very much!
Topic archived. No new replies allowed.