pass vertex attribute matrix through jit.gl.sketch?
Hi all,
I am rendering a geometry twice in the screen using a named jit.gl.mesh and a jit.gl.sketch.
The mesh geometry is being processed by a shader, which is bound and unbound through OpenGL commands in the jit.gl.sketch command list.
The shader is taken from Pelado's morph shader example, and it is intended to deform geometry vertices by means of a noise matrix, which is passed to the shader through as vertex attribute matrix.
My question is: how can I pass this vertex attribute matrix to jit.gl.sketch? when I pass it through jit.gl.mesh, as in Pelado's example, it doesn't work.
here is my code, thanks in advance
I forgot to include the shader:
/////dShader.txt /////////////////////////////////////////////////////////////
i'm not sure if it's possible to pass vertex attributes to a gl.mesh that is drawn by a gl.sketch.
is there any particular reason you need to use sketch to do your drawing?
Thanks for your answer Robert! I am using jit.gl.sketch to draw the geometry because I thought that this method would spare a lot of resources when rendering the same vertices (jit.gl.mesh) twice... but maybe there are other options?
should be no more efficient than setting @automatic 0 on your gl.mesh and banging it twice each frame.
SOLVED - Thank you Robert, you gave me the right clue!!
I finally made it work with jit.gl.sketch. In my earlier patch, I was giving unnecessary openGL commands, but it was as simple as treating the jit.gl.mesh as any other object, independently of its having a shader or not.
The binding and unbinding of texture and shader programs is already handled automatically by Jitter in the [jit.gl.mesh] object, so why outhink the smart Cycling74 programmers? :p.
Below the corrected, working patch, the shader is the same I posted earlier.
For anyone interested, the 2 bang method Robert was talking about is in this post: https://cycling74.com/forums/multiple-views-in-one-context