jbaker

05-05-2008, 08:43 AM

First I would like to say that i'm an absolute beginner.

I have an a moderate size 2 dimensional array filled with floating point values between 10.00 and 100.00. I would like to represent each array value point as a pixel with a color specified by the numerical value held by the array location.

I create a window size slightly larger than the dimensions of the array and would like to have the points drawn starting in the top left with array value [0][0] with [0][1] being one pixel to the right in the x direction and [1][0] being one pixel down in the y direction.

I'm leaving the coloring algorithm out of the below code because it's complicated and i've verified it working.

glBegin(GL_POINTS);

for (int y = 0; y < array row length; y++)

{

for (int x = 0; x < array column length; x++)

{

glVertex3f(x, y, 0.0f);

}

}

glEnd();

this isn't working and doesn't appear to be drawing anything. I can draw triangles and shapes which appear white on a black background.

I'm expecting this code to produce a white rectangle of the dimensions of the array, but i'm only getting the black background.

Any help would be greatly appreciated. TYIA.

I have an a moderate size 2 dimensional array filled with floating point values between 10.00 and 100.00. I would like to represent each array value point as a pixel with a color specified by the numerical value held by the array location.

I create a window size slightly larger than the dimensions of the array and would like to have the points drawn starting in the top left with array value [0][0] with [0][1] being one pixel to the right in the x direction and [1][0] being one pixel down in the y direction.

I'm leaving the coloring algorithm out of the below code because it's complicated and i've verified it working.

glBegin(GL_POINTS);

for (int y = 0; y < array row length; y++)

{

for (int x = 0; x < array column length; x++)

{

glVertex3f(x, y, 0.0f);

}

}

glEnd();

this isn't working and doesn't appear to be drawing anything. I can draw triangles and shapes which appear white on a black background.

I'm expecting this code to produce a white rectangle of the dimensions of the array, but i'm only getting the black background.

Any help would be greatly appreciated. TYIA.