Using OpenCL kernel to update OpenGL buffer [Solved]

Hello everyone,

My goal is to import data from a DAQ card, process the data with OpenCL, then display with OpenGL. For display I am modifying the PIXEL_UNPACK_BUFFER as suggested in this presentation.

http://www.nvidia.com/content/GTC/docum … _GTC09.pdf

Things seem to be going well other than one issue–I cannot get the display data to match the acquired data. I pass both the acquired buffer and the display buffers to my kernel. I cannot successfully set the value of the one buffer to the value of the other.

Here is my code. The buffer size is 512x512 with is the global work size. The display size is 512x512x3 to hold RGB data. I am working with grayscale so I set R=G=B. Any idea why this kernel would not work? This results in a black image, which means display=0.

Note, if I set the values of display equal to a number, say 65535, it works.

"__kernel void InvertSamples(					
"
"   __global ushort* buffer, __global ushort* display			
"
"   )											
"
"{											
"
"   int id = get_global_id(0);							
"
"	ushort value = buffer[id];						
"
"	display[id*3] = value;							
"
"	display[id*3+1] = value;						
"
"	display[id*3+2] = value;						
"
"}											
"

Solution: The dynamic range of my input data was too small to be noticeable when displayed by OpenGL. The code works.