PDA

View Full Version : GL_MAP_COLOR not working with GL_PIXEL_UNPACK_BUFF



hanoglu
06-15-2010, 12:19 PM
does GL_MAP_COLOR does not work with GL_PIXEL_UNPACK_BUFFER?
after setting GL_MAP_COLOR to true, if i create texture directly from image source pointer it works well, but if i create texture from GL_PIXEL_UNPACK_BUFFER, i see a blank screen.


// writing data to buffer
glGenBuffers(1, @Buffer);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, Buffer);
glBufferData(GL_PIXEL_UNPACK_BUFFER, PixelDataSize, tmpBuffer, GL_STATIC_COPY);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
// creating texture
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, Buffer);
glGenTextures(1, @Texture);
glBindTexture(GL_TEXTURE_2D, Texture);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2Dt, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

glPixelTransferi(GL_MAP_COLOR, 1);
glPixelMapfv(GL_PIXEL_MAP_R_TO_R, LutSize, @lut[0]);
glPixelMapfv(GL_PIXEL_MAP_G_TO_G, LutSize, @lut[0]);
glPixelMapfv(GL_PIXEL_MAP_B_TO_B, LutSize, @lut[0]);

glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, Width, Height, 0,
GL_LUMINANCE12, GL_UNSIGNED_SHORT, 0);
glBindTexture(pd.glTarget, 0);