Texture mapping using folat buffer

I want to render a 2d array of float point using texture mapping. The code is as follow.

float pixelBuf[512][512];

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 512, 512, 0, GL_LUMINENCE, GL_FLOAT, pixelBuf);

But the result looks as if the value of pixel buffer is clamped to [0.0, 1.0], so the result is a binary image. I want to know if the float buffer must be scaled properly([0.0, 1.0]) before it can be passed to OpenGL? Because the pixelBuf is reused by later operation, does it mean that i must allocate another buffer and scale the value of original buffer to this new buffer? Is OpenGL support this scale in hardware?

Thank for any help.

Since you can get a max of only 256 values per color (in RGBA 24-bit model), I strongly suggest that you convert your float texture space to integer. Not only does it improve on speed, but you have better control.

Using float or double numbers will not give you higher color precision.