PDA

View Full Version : question about StretchDIBits and textures



Alessandro_dup1
04-26-2004, 03:16 PM
I'm rendering a perlin noise directly to screen using the following instruction:

StretchDIBits(hDC, 0, 0, 256, 256, 0, 0, 256, 256,map, (BITMAPINFO*)&bmih, DIB_RGB_COLORS, SRCCOPY);
Instead, i'd like to render to a texture, so i changed the previous code with the following:


glGenTextures(1, &textures[30].texID);
glBindTexture(GL_TEXTURE_2D, textures[30].texID);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 256, 256, 0, GL_RGB, GL_UNSIGNED_BYTE, map);
The resulting texture is completely white. What mistake is in here ? :confused:

map is defined as follows:
static DWORD map[256*256];