Sign in to follow this  

OpenCL not reading from GL texture

Recommended Posts

ic0de    1012
I'm trying to write an OpenCL raycaster but I have run into a problem where I try to read from an image that was generated from an opengl texture but I get an undefined result that is far larger than it is supposed to be. I'm fairly sure the GL image is loaded correctly because I can see it in Gdebugger. The simplest case is here:
The texture is in RGBA8 format using GL_UNSIGNED_BYTE

my kernel:

__kernel void draw( __read_only image2d_t screen)
float4 sample = read_imagef(heightmap, smp, samplepos); // returns a number far larger than 1.0
Here I set up the image and arguments:
heightmapimage = cl::Image2DGL(compute->getContext(), CL_MEM_READ_ONLY, GL_TEXTURE_2D, 0, tex1.texPointer, &err);

VECTOR_CLASS<cl::Memory> mem_objects;
raycaster.setArg(0, heightmapimage);
Is this a bug? If not where did I screw up? Edited by ic0de

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this