is there any metho to save a texture into an image

I used glTexImage2D to construct a texture from a matrix:


float myMatrix[Height][Width][4];
... ...
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, 
GL_LINE );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 
GL_LINE );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); 

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, Width, Height,
 0, GL_RGBA, GL_FLOAT, myMatrix);



How can I check if the values of myMatrix have been correctly saved into this texture?

BTW, is there any wrong with the parameters for glTexParameteri?

What is purpose of the code? what is that matrix?

  • MIN & MAG Filter: it should be GL_LINEAR… or meybe GL_NEAREST if you are performing some computation not rendering

how can you check values?

  • just render that texture and by its coulour you coul gess are those values are good or wrong. That is simple method.
  • you can use gEDebugger to check data that you have on the GPU

that matrix saves the values of a 2D function, I want to send that texture to a shader and do some computation there.

And I have difficulty in understanding the internal format and format, which indicates the format of the texture?

so maybe you should use OpenCL instead of OpenGL. They both work well with each other.