As far as I can see, the else statement also contains an opengl function to interpret the buffer data:
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, (GLsizei) m_width, (GLsizei) m_height, 0, GL_RGBA, GL_FLOAT, (void*) 0); // RGBA32F from byte offset 0 in the pixel unpack buffer.
const void* data = m_bufferOutput->map(0, RT_BUFFER_MAP_READ);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, (GLsizei) m_width, (GLsizei) m_height, 0, GL_RGBA, GL_FLOAT, data); // RGBA32F
I am trying to get the ray traced Image from the data in “optixTutorial3” in Matrix representation.
I am aware of the fact that the data type of the output buffer from the “optixTutorial” is “RT_FORMAT_UNSIGNED_BYTE4”. So I tried to cast a char from the void pointer of the buffer as follows:
void* dat = buf->map(0, RT_BUFFER_MAP_READ);
char *char_buf = (char*)dat;
And tried to print it on the screen with cout. The result were some cryptic signs.
Could you give me a small example of how to access that data so that I can print it out on the screen? Maybe the RGB channels in 8 Bit repesentation or something like that?