Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

OpenCL not reading from GL texture

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
1 reply to this topic

#1 ic0de   Members   

974
Like
0Likes
Like

Posted 03 January 2013 - 03:40 PM

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:
__constant sampler_t smp = CLK_NORMALIZED_COORDS_FALSE|CLK_ADDRESS_REPEAT|CLK_FILTER_LINEAR;

__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;
mem_objects.push_back(heightmapimage);
compute->getCommandQueue().enqueueAcquireGLObjects(&mem_objects);
raycaster.setArg(0, heightmapimage);
Is this a bug? If not where did I screw up?

Edited by ic0de, 03 January 2013 - 09:53 PM.

Currently working on new DOS game, Chuck Jones: Space Cop of the Future, Check out my Dev Blog
 

you know you program too much when you start ending sentences with semicolons;


#2 ic0de   Members   

974
Like
0Likes
Like

Posted 04 January 2013 - 10:20 AM

Not sure how but I seemed to fix the problem by fiddling around, although I'm not sure what exactly I did.

Edited by ic0de, 04 January 2013 - 10:20 AM.

Currently working on new DOS game, Chuck Jones: Space Cop of the Future, Check out my Dev Blog
 

you know you program too much when you start ending sentences with semicolons;





Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.