In an application i am working on, i would like to draw some simple polygons, two triangles and two rectangles to be precise. i would like to colour one of each red, and the others green.
i have one tiny problem with this whole thing: it won’t work.
i do the glBegin for each polygon, call glColor, then glVertex for each corner, then glEnd, and the same for the other polygons.
unfortunately, my colour instructions are being completely ignored, and all four polygons are being drawn a crappy brown colour, which is used previously in the program.
i have no idea why it won’t work, and and suggestions are welcome, especially if they help me fix the program.
try to change the color settings of your monitor,
send the code also
Make sure lighting is off. If you have it on and your material is set to brown then most likely that is your problem. If you want lighting on then you will have to change your material to the color you want or you can enable color material, glEnable( GL_COLOR_MATERIAL ) in order for glColor functions to change the material.
Make sure you did the following:
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
and disable Lighting…
THanks folks for all the suggestions, but the winner is Kaycee and the colour material suggestion.
It now works brilliantly, and might explain other problems i was having earlier.