We are about to switch to a new forum software. Until then we have removed the registration on this forum.
hey! does anybody help me to understand shaders better? Im reading all tutorials that i found, includes PShader reference processing page. For now, im trying to pass the data of vertex into a glsl vertex shader (im editing shaders in Atom) i found this max/msp tutorial and i cant figure it out how translate this to processing.
anybody helps me? thanks a lot. PD: if anybody knows any book o information about shaders an how implement in processing please share! thank
Answers
https://processing.org/tutorials/pshader/
Can you please post a MCVE that demonstrates your status of progress?
https://www.google.de/search?q=vertex+displacement
Happy new Year.
I did a little get started File - still a lot of work to do. Good luck.
optimized version
learning version
Thanks @nabr. still working here. Ok, i see that PG graphics replace the jit. texture to pass as an uniform the noise! but why only the fill is displacement and not the geometry?
you mean the lines of the sphere in the gif ( learning version scetch ) i guess. i think, becourse the lines are drawn on a different shader in processing. (not completely sure) . so you are displacing the sphere vertex but to the processings line shader.
Ok. well, now im trying to translate the example to see also the geometry displacement. i`ll post the results. i have one silly question...How vertex shader know that "in vec4 position" is the positions of each vertex?. i mean, is not a build in variable. in others versions i see the gl_vertex, and gl_normal. How does it work? Also with the names of "uniform mat4 transform" is the same if i change the name? "uniform mat4 blahblah". how interpreted shader that is the product of the projection and the modelview matrices?
Hello
you have many good questions here. And im of time. @clankill3r
You have different Buffers one of them is used to store Vertex Data so called Vertex Buffer Object or short VBO. After a Buffer is created you assign a variable to send the data to the vertex shader. Processing is using in vec4 position; as name for this variable
I think this is a good exampel
https://forum.processing.org/two/discussion/12775/simple-shadow-mapping
The post is from 2015 and the user refers to a much older tutorial 2012 (the site was updated since then)
OpenGL is a commutative driven project more or less ...
gl_vertex, and gl_normal is outdated.
deprecated.
Means is still work, but their is no community that maintain it.
No you have to use the Processings names, otherwise you have to go Low Level and change "the interface." See:
https://github.com/processing/processing/wiki/Advanced-OpenGL
posLoc = gl.glGetAttribLocation(shader.glProgram, "position");
If you look at simple-shadow-mapping link i shared in this forum. It's exactly that someone implemented a "function" and is not reachable anymore, still users request his function to work, but the Developer don't feel responsible anymore. That is why you uses #version directive.
https://github.com/processing/processing/wiki/Advanced-OpenGL
But java is also very forgiving. Just try things out.
Perfect! i`v understanding a little bit more. is there any place to find the names of the shaders input? (witch name is compute by processing?)
Hello
update:
Becourse it a bug. If you in the JOGL Mode you already a step away from implementing your own bug free Engine. So i m not using processing frequently egough. Maybe it will be fixed with the next version in processing.
All you are asking for is here, look at the source !
https://github.com/processing/processing
Also interesting https://github.com/codeanticode/pshader-experiments
(a little updated but still useful) https://codeanticode.wordpress.com/2014/05/08/shader_api_in_processing_2/
i didnt found any kind of "list" of build in variables names like codeanticode post in processing github. maybe im looking with the wrong words. i will keep looking.
Becourse it a bug
what is exactly the bug? the shader that you wrote should show the geometry displacement? thanks again nabr and answer only if you`ve time!EDIT: i found it here: https://github.com/processing/processing/blob/master/core/src/processing/opengl/PShader.java
EDIT2: what about this? https://forum.processing.org/two/discussion/2839/wireframe-display-with-shaders#latest