robert_s
01-18-2002, 05:15 AM
Hi ALL!!
I am confused with how to use glColorPointer!!
this is the effect I get currently! http://homepage.ntlworld.com/robert.stuliglowa/projects/GL-Flightor/temp/red.jpg
I have eg.
float colorArray [256 * 256][3]; // color array
// loop over all vertices
for (int z = 0; z < 256; z++)
{
for (int x = 0; x < 256; x++)
{
// VERTEX - vertices are numbered left to right, top to bottom
Vertex = (z * 256) + x;
// COLOUR - set the values in the color array
// RGB] = set same colour value to all 3 colours
colorArray[Vertex][0] = terrain[x + 256 * z][1]/255.0f;
colorArray[Vertex][1] = terrain[x + 256 * z][1]/255.0f;
colorArray[Vertex][2] = terrain[x + 256 * z][1]/255.0f;
}
}
Here I am assigning RGB colour to one value which should be going from balck through grey to black depending on the heighmaps height!! Why do I have red colour only??
Strange!!!
if I for example set red to 0 and others Green and Blue to same positive value eg. 0.3 then I get colour interpolation from dark green (almost black) to bright green!!! why??
The way I understand is for example if I set Red=0.3, Green=0.3, Blue=0.3 then I get dark grey colour!
But here it looks as it only considers one colour instead of blending 3 colours!! am I right?
Any ideas how to solve the problem?
[This message has been edited by robert_s (edited 01-18-2002).]
I am confused with how to use glColorPointer!!
this is the effect I get currently! http://homepage.ntlworld.com/robert.stuliglowa/projects/GL-Flightor/temp/red.jpg
I have eg.
float colorArray [256 * 256][3]; // color array
// loop over all vertices
for (int z = 0; z < 256; z++)
{
for (int x = 0; x < 256; x++)
{
// VERTEX - vertices are numbered left to right, top to bottom
Vertex = (z * 256) + x;
// COLOUR - set the values in the color array
// RGB] = set same colour value to all 3 colours
colorArray[Vertex][0] = terrain[x + 256 * z][1]/255.0f;
colorArray[Vertex][1] = terrain[x + 256 * z][1]/255.0f;
colorArray[Vertex][2] = terrain[x + 256 * z][1]/255.0f;
}
}
Here I am assigning RGB colour to one value which should be going from balck through grey to black depending on the heighmaps height!! Why do I have red colour only??
Strange!!!
if I for example set red to 0 and others Green and Blue to same positive value eg. 0.3 then I get colour interpolation from dark green (almost black) to bright green!!! why??
The way I understand is for example if I set Red=0.3, Green=0.3, Blue=0.3 then I get dark grey colour!
But here it looks as it only considers one colour instead of blending 3 colours!! am I right?
Any ideas how to solve the problem?
[This message has been edited by robert_s (edited 01-18-2002).]