Because I was restricted to the hardware support. OpenCL is not supported for my graphic card.
By the way, I search for a long time for the guidelines but still cant find the reference that I want. Can recommend some here?
You want to write values into an OpenGL array?
I guess what you can do is write to the frame buffer or a render target (FBO).
I don’t know any tutorials that show how to use GL to use the GPU as a CPU.
I can suggest that you study GL and then you’ll know how to use it.
Ya…Definitely I need to study. But I just using a bit of openGL to do my tasks. So, I am not going to spend time to study completely. I just want to know which function can I use so that I can study on that. Tasks I am going to do are:
Pass bytes into array
Compare bytes in the array
For part 2, can the array in openGL compare like this for example:
Considering everything what you have said the solution could be something like this:
send your data as a texture to GPU
use shaders to calculate what you want
write results into the texture
read from the texture
But the question is: why would you do that? Do you think it would be faster on GPU than on CPU? If your GPU don’t support CUDA/OpenCL, than it is very unlikely (because it is probably very old).
If you can store a large amount of data into a single buffer, and the calculation can be parallelized into hundreds of threads, than GPU can be more efficient. But if you have a lot of tiny buffers or there are dependencies that prevent efficient parallelization, than CPU can easily outperform even some of the mightiest GPUs.
In any case, the best way to find out what is the best is to try it yourself. I wish you luck!
Em…Can specify which function for each part? How to send data as texture? How to use shader? Just simply give some example so that I can understand. As I am not familiar with openGL functions.
You’re going to have to become familiar with OpenGL as a graphics library before you can use it as an arbitrary computation library. This means you need to learn how to use OpenGL to draw stuff before you learn how to use it to do arbitrary computations.
I know I have to familiar with it. But there are lots of openGL functions. I am afraid I may go to the wrong direction since I will not use all the functions. So, may you specify which functions that I should use so that I can study on those functions?
I already know how to compile and run openGL applications. Only simply graphics applications.
Telling you what functions you should use would not help you too much. You have to understand the design of OpenGL. Besides you should learn GLSL so you can write your shader to do the job. Without that background knowledge the function names won’t help you in any way.