Results 1 to 2 of 2

Thread: Using OpenCL kernel to update OpenGL buffer [Solved]

  1. #1
    Junior Member
    Join Date
    May 2012

    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. ... _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.

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

  2. #2
    Junior Member
    Join Date
    May 2012

    Re: Using OpenCL kernel to update OpenGL buffer

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

Similar Threads

  1. opencl buffer from premade opengl buffer
    By MohamedSakr in forum OpenCL
    Replies: 0
    Last Post: 11-21-2012, 02:42 PM
  2. OSX Lion 10.7.4 update broke my kernel
    By Photovore in forum OpenCL
    Replies: 7
    Last Post: 05-21-2012, 03:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean