Reputation: 51
I have a matrix (for example 100x100 dimantion):
I need to do calculation with each element (matrix[i,j]*tt/8+5
for example)
I have huge matrix and I want to implement the algorithm using OpenGL shaders. I want to use shader like:
uniform float val;
uniform float tt;
void main()
{
gl_Position.x = val*tt/8+5
}
How I can implement the program? How I can get matrix after calculation(I do not want to show any windows\pictures?
Upvotes: 3
Views: 3619
Reputation: 1258
It is possible if you create a fake window frame buffer.
See my sample program where I abused the fragment Shader as a compute Shader because compute shaders are quite new. This program does some Gaussian Filtering calculations of the matrix and returns it to the CPU. (It actually does not matter what it does).
Here are few things to note:
Upvotes: 6