Advanced GLSL - pass 1D, 3D and float textures form processing?
in
Core Library Questions
•
9 months ago
Hi,
I was looking at shader examples in processing (especcially "landscape"), and its pretty cool. I already made shaders which raycast (or raymarch) big smooth 3D landscale generated on GPU from 2D texture using bicubic interpolation.
I would like to use power of GPU processing more. I have in mind 2 things which I want to program in future:
- Rendering of volumetric data using raymarching algorithm (some sciencetific visualization of electron density)
- Using GLSL for solving partial differential equations (like Fluid navier stokes example in processing)
For that I would probably need
- 3D and 1D texture. I know that in GLSL language is also sampler1D and sampler3D which I can in principle use to pass int[] and int[][][] data arrays into GLSL and than read numbers from it using texelFetch() however I don't know how to pass 1D or 2D texture into glsl from processing. Currently I pass all textures to shader as PImage - like myPShader.set("texData", myPImge ). Is there any general way how to do that? Does processing openGL interface implement all openGL features (up to which version 2.0 3.0 )?
- For more precise computations I would prefer pass texture as float arrays (32 or 64 bit) rather than images (where each pixel stores 4x 8bit numbers R,G,B,A). Also I would like to simply pass rather float array float[], float[][], float[][][] rather than converting it to PImage ( using obstructions like loadPixels(); updatePixels();) and than convert it back inside the shader.
Before I spend to much time searching or figuring out how processing interface to OpenGL is working, I would like to know the limitations of current implementation. What is possible and what is not? And if there is possible any workarround in case of features are missing in interface but are in principle possible with the version of OpenGL which is supported by the libraries?
3