cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

dikobraz
Journeyman III

Write to OpenGL texture problem

I am writing sample with OpenGL/OpenCL. The sample workflow is the following:

  • Create 2 textures via OpenGL. Create 2 OpenCL images for their first mip levels.
  • Render to first texture via OpenGL.
  • Acquire images for OpenCL via glFlush, clEnqueueAcquireGLObjects
  • Run OpenCL kernel to process first image and write result to second
  • Release images via clEnqueueReleaseGLObjects, clFlush.
  • Render screen quad to display second texture.

After this step I get correctly processed OpenCL image, but corresponding OpenGL texture is blank. Here is what I get in gDebugger:

gDebugger screen 1

gDebugger screen 2

Am I missing something?

UPD: I have Radeon 5750HD onboard, but using CPU device doesn't help. Both OpenGL and OpenCL code produce no errors. Demo is single-threaded.

UPD: Works on NVIDIA GeForce GTX 460SE with 285.62 driver. But only first frame is processed correctly.

 

Tags (2)
0 Likes
20 Replies
nou
Exemplar

rite to OpenGL texture problem

replace both GL and CL Flush to Finish

0 Likes
dikobraz
Journeyman III

rite to OpenGL texture problem

Originally posted by: nou replace both GL and CL Flush to Finish

 

Thank you for reply. Tried your suggestion, problem remains.

0 Likes
nou
Exemplar

rite to OpenGL texture problem

then one more thing. create OpenGL texture after creation of OpenCL context.

0 Likes
dikobraz
Journeyman III

rite to OpenGL texture problem

Originally posted by: nou then one more thing. create OpenGL texture after creation of OpenCL context.

 

All the resources are created after both contexts have been initialized.

0 Likes
himanshu_gautam
Grandmaster

rite to OpenGL texture problem

I guess you need to acquire the texture2 also in OpenCL in case you want to write to it and then release it to display via OpenGL.

Is inplace processing an option for you.

0 Likes
dikobraz
Journeyman III

rite to OpenGL texture problem

Originally posted by: himanshu.gautam I guess you need to acquire the texture2 also in OpenCL in case you want to write to it and then release it to display via OpenGL.

 

Is inplace processing an option for you.

 

I acquire both textures and release both of them after processing. Inplace processing is not an option. Nevertheless, I want to find out the problem.

0 Likes
himanshu_gautam
Grandmaster

rite to OpenGL texture problem

Did you compared your method with what the APP SDK Samples follow. There are many GL-interop samples.

BTW, the images you posted are not readable. And it is better to share some code to get better feedback.

0 Likes
nou
Exemplar

rite to OpenGL texture problem

then all i can say is try SimpleGL example from SDK. and modify it to your need.

0 Likes
dikobraz
Journeyman III

rite to OpenGL texture problem

As I understood texture sharing is rather new feature. BoxFilterGL and SimpleGL demos use only buffer sharing. Texture are modified using PBO to copy content from buffer. As I assume this is slower and harder to implement, but seems there aren't many choices.

0 Likes