PDA

View Full Version : Contour Shading



08-12-2003, 12:34 AM
Is there a way of specifying the colour transition from one vertex of a quad to the other. Say with the following code

GL_BEGIN GL_QUADS
GLCOLOR3F 0,0,1
GLVERTEX 0,0,0
GLCOLOR3F 1,0,0
GLVERTEX 10,0,0
etc
GL_END

The default colour transition will be blue to red in a default number of colour bands. I want to be able to specify firstly the number of colour bands and also the colour of the intermediate ones.

Many thanks

errno
08-12-2003, 12:44 AM
you can:
- try indexed mode.
- use a texture which represent the color transition.
- add vertice to you quad with the corresponding color.

08-12-2003, 02:36 AM
How do you apply 1D Texture to a QUAD which is a 2D entity

errno
08-12-2003, 02:50 AM
if you want the color transition only on the quad's edge, you'll have to use a 2D texture.

08-12-2003, 03:03 AM
Each of the vertices might have different colours assigned to it so a 2D texture image will not be suitable.

errno
08-12-2003, 03:18 AM
I don't see what do you mean. a little image should help.

harsman
08-12-2003, 03:26 AM
Put the bands in a 1D texture. Then use glTexCoord1f instead of glColour to specify the "band index" 0.0 for one end of the bands and 1.0 for the other. This should work. Try it before you say it won't work on a quad since it's 2d at least. Then again, you might want something else than what I think you want. If so, you need to explain more.

08-12-2003, 04:19 AM
Say the quad is as follows

4***************1
* *
* *
* *
* *
* *
* *
1***************2

Where the corner points have different colour code to be assigned. In the above diagram, the contour lines would go diagonally across.