Trace: » p.wiki » p.jit.gl.shader

p.jit.gl.shader

what is p.jit.gl.shader?

Do you ever find yourself wanting to try out different shaders in your patch and then having to patch up a whole new set of parameter variables just to see how they look? Well, this is a patch that eliminates that task. I find myself using it again and again. Basically, its a wrapper for jit.gl.shader that automatically reveals a shader's parameters and allows you to edit them easily.

To use, simply replace the jit.gl.shader object with p.jit.gl.shader and double click on the box to open the patch.

p.jit.gl.shader screenshot

features

p.jit.gl.shader enables you to:

  • reveal and edit the shader's parameters and their values;
  • quickly open the jxs shader file using mxj quickie;
  • automatically reload and recompile the shader if the jxs file is altered on disk;

download

The current version is 5.02

arguments

The first argument must be the name of a drawing context

attributes and messages

All attributes and messages are forwarded to jit.gl.shader.

menus

<print> prints all messages from jit.gl.shader to the max window
<quickie> opens an mxj quickie with the current shader code
<filewatch> if enabled, any changes to the shader file on disk will automatically reload the shader file into jit.gl.shader
<params> opens a coll with all the current parameters and their values
<getstate> opens a window displaying all the attributes and their values

the populate button will open a dialogue window to select a folder of shader files and populates the menu with the names of the files. Select a file from this menu to load the shader into jit.gl.shader.

the help menu provides quick access to help files and reference pages for jit.gl.shader. The version number is listed at the end of the menu.

the messages menu lists all the messages that jit.gl.shader accepts. (Items selected send the message to jit.gl.shader but won't have any effect unless the message doesn't require arguments.)


There are two message strips. The top one shows the name of the current drawing context and the name given to the shader object. The lower message strip shows the shader that is loaded. Clicking on it reloads the shader's parameter values.

Temporarily save parameter values using the preset object.

storing settings in a coll

You can store and recall settings in p.jit.gl.shader using a coll as set out in the diagramme below:

restore settings from a coll

First, to save your parameter settings, open the <params> coll menu item. Save the file.

Set up a umenu to autopopulate with the folder items where you saved the file.

Finally, select your file from the umenu.

change log

The following lists all the changes made to p.jit.gl.shader

changes to p.jit.gl.shader 5.01

  • minor changes to fix some bugs;
  • created wiki documentation.

changes to p.jit.gl.shader 5.02

  • now sends correct number of parameter arguments to jit.gl.shader.

Discussion

Antoine Villeret, 02/Jan/2009

hi Pelado,

congratulations for your work and thanks for letting it free

i am using p.storage in some projects and i tried p.jit.gl.shader but i have some problems due to my hardware configuration i think, i got an error : “setting GLSL param: GL Error: Invalid operation” because of some extras “0” added to the param message in fact I think that GLSL is expecting a float for example and i was sending a list of 4 values…

moreover i think it will be good to set the default shader folder to the jitter default shader folder and setting it with the max relative notation : “C74:/jitter-shaders”

best

antoine

pelado, 02/Jan/2009

Hi Antoine,

I've changed p.jit.gl.shader to send the correct number of arguments with each parameter message now. I haven't experienced the problem you describe, but it was worth fixing anyway. However, each argument is still always a float, even if an integer is expected. Let me know if you still get any problems.

Funny you should mention the settings for the umenu. Only yesterday I checked this and changed it to what you suggest. I was sure that I had done it not long ago, and tonight I changed it again but then realised that umenu converts the “C74:/jitter-shaders” to match the path for my computer. Anyway that's sorted now as well and I've altered the download to reflect the changes.

Thanks for letting me know.

pelado

Antoine, 04/Jan/2009

hi Pelado,

it seems to work fine now, thanks !

in fact, i started to build my own shader wrapper but it's not the same as your ! i manage all parameters with a pattrstorage that allows interpolation between presets and i make one XML file per .jxs file and it is automatically reloaded with the .jxs also i create boxes for all shader parameters with a script

it's not still ready but i hope it will be soon, i'll inform you about its release

best

antoine

pelado, 05/Jan/2009

Good. :-D I like the sound of your wrapper, do let me know when its ready.

lars, 08/Jan/2009

hi pelado,

thanks for sharing your work, very useful. I can´t remember how much time I spend for setting up the shader parameters..

thanks a lot!

Nicholas C. Raftis III, 26/Mar/2009

Hello, and thanks for the awesome object, Ive started writing shaders because of how easy it makes things. The one thing though that I think could use improvement is the ability to save your settings, I hit the params umenu and it gives me the great text with all the current settings but everything isn't setup for me to use in a way that I can figure out, I tried setting it up with coll, or putting it in a message box and banging it, but it seems that I need to change all the text around to use the setting, like I have to add param before each line, and take out the ”;”s. Is there a way you could setup an easy way to use these text presets inside here? if there isn't one already that I just couldn't figure out?

pelado, 30/Apr/2009

You can save the parameters printed to the window using the 'save as..' menu. The params are in a coll format so all you need to do is open the saved file in a coll and dump them into the shader to restore the settings. I've posted a screeshot above to show you a possible set up.

Rolf, 15/Jul/2010

Very nice and helpful information has been given in this article. I like the way you explain the things. Keep posting. Thanks challenging the results of trades (tender) Ukraine

Enter your comment (wiki syntax is allowed):
NWCQE
Edit this pageShare/Save/Bookmark Creative Commons License Driven by DokuWiki