CSharpGL icon indicating copy to clipboard operation
CSharpGL copied to clipboard

Drawing directly to texture buffer

Open laurentchougrani opened this issue 4 years ago • 1 comments

Hi there. I've been using CSharp GL and i think it's great!

I've been tingling with texture generation, and i can obtain a texture map from a 3D object (that i can transfer into an 2D image). Now i'd like to paint on that 2D image, so that the texture updates also directly on the buffer side (for direct rendering on the 3D object via texture coordinates).

I see there is an object called "glTexStorage2D" which is a "GLDelegates.void_uint_int_uint_int_int" (and it's read only) and which would seem to be the buffer memory (am i right?). I guess the way to go would be to set a specific value in that buffer corresponding to the pixel of the image (set at a specific color).

So my question would be :

  • Is glTexStorage2D the right object for what i want to achieve ?
  • How to get access to glTexStorage2D and change values ?

Any one has ideas on how to do that?

Thanks

laurentchougrani avatar Jan 28 '22 08:01 laurentchougrani

If you want to update texture frequently, try this demo: https://github.com/bitzhuwei/CSharpGL/tree/master/Demos/RenderToTexture. Or maybe you are looking for this: glTexSubImage2D

bitzhuwei avatar Jan 29 '22 14:01 bitzhuwei