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.
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.