No color

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

No color

tomd
I am creating a curved surface using a set of triangles. If displays ok except that I can't seem to get colors to appear - the shape is always black, or grey if I rotate it around (fortunately I am using a white background).

I am using glColor3d, but no matter where I call this it has no effect.

If I set a red material it works OK and appears red, but I want to apply vertex colors (and anyway I want to find why it isn't working).

Any ideas? Could it be to do with lighting?

BTW my init() is basically the same as the gears demo, and I am using JOGL 1.1.1a.

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: No color

Wade Walker
Administrator
You might have the vertices defined in the wrong order, or the face culling set wrong -- see the bottom of http://www.opengl.org/resources/faq/technical/clipping.htm.

There are lots of things you can do wrong in an OpenGL program to cause the problem you are seeing  Usually what I do is start from a known good program, then modify it step by step until I get what I want, verifying at every step that it still works. If you write too much OpenGL code at once, it's easy to get into a situation that's hard to debug.

If you want a bare-bones starting point, you might try my super-simple demo at http://jogamp.762907.n3.nabble.com/Couple-of-questions-tp1889246p1913928.html. It draws one single triangle using vertex colors -- nothing can possibly go wrong!
Reply | Threaded
Open this post in threaded view
|

Re: No color

Tomasz
In reply to this post by tomd
If you are using glLights - glCoulr3d will not work at all you have to use glMaterial or start teksturing it.
also if you are using glTringleStrips you can not refer to colour of the single tringle only to whole strip  
Reply | Threaded
Open this post in threaded view
|

Re: No color

tomd
Thanks, I turned off the lighting and just used color3d so now it works OK. I will experiment with lighting and materials later on.