Answer the question
In order to leave comments, you need to log in
Why does get_global_id in 2d return strange values?
Using, for example, a fragment shader in GLSL results in a gradient from start to finish, but in OpenCL it turns out to be some kind of disgrace. Although offset is zero in all dimensions.
So here is the kernel code
__kernel void simple(__write_only image2d_t tex, int width, int height){
const int x=get_global_id(0); //Узнаем x координату
const int y=get_global_id(1); //y
write_imagef (tex, (int2)(x, y), (float4)(x/(float)width,y/(float)height,0.0f,1.0f)); //Закрашиваем текстуру
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question