We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › shaders in processing
Pages: 1 2 
shaders in processing (Read 17575 times)
Re: shaders in processing
Reply #15 - Feb 29th, 2008, 7:18pm
 
It's been a long time since I wrote this, but I've updated it for the latest version of Processing, and it seems to work. Don't ask me to explain it all though, I'm not sure I can currently. It also has a specular map as well as dump mapping I think.
Also I think I may have a couple of bugs which end up cancelling each other out in it, so if things go weird when you try to use it, I'm sorry.

But here's a zip of the sketch including data files:
http://www.hardcorepawn.com/BumpMap.zip

You can see it online here:
http://www.hardcorepawn.com/Shiny/
Re: shaders in processing
Reply #16 - Mar 1st, 2008, 10:21pm
 
Wow thats great JohnG.

I recently started working on creating normalmaps in my 3D modeller and for another texture generator i`m working on.
And was looking around how i could created/show normalmapping and displacement mapping.

My modeller, experiment
http://www.xs4all.nl/~elout/sculptpaint/

(Recent sculptypaint build with normal map creation test.)
http://www.xs4all.nl/~elout/9feb/

Some normalmaps and its textures I created rather quick and tried with your demo;
...
...

And
...
...
Re: shaders in processing
Reply #17 - Mar 2nd, 2008, 2:06pm
 
hey john, thats good. ive been using your GLSL to shaders aswell, hope you dont mind.

i have one question. have you been able to work with Cg shaders in processing ?
Re: shaders in processing
Reply #18 - Mar 2nd, 2008, 2:45pm
 
I have no problem with people using it, I wouldn't have posted all the code here otherwise.

As for CG, if you check about halfway down page 1 of this thread, ac has written a CG version.
Re: shaders in processing
Reply #19 - Mar 2nd, 2008, 8:03pm
 
yea ive tried ac's cg class but it keeps giving me an error
on initialization.

error is something like:

"cant find procedure entry cgCreateEffect in dynamic library cg.dll"

any idea what this could be ?

ive downloaded cg.dll and jar and placed them in the opengl folder in \processing


EDIT:
java.lang.UnsatisfiedLinkError: C:\processing-0121\libraries\opengl\library\jogl_cg.dll: Impossível localizar o procedimento especificado (Not possible to locate specified procedure)
     at java.lang.ClassLoader$NativeLibrary.load(Native Method)
     at java.lang.ClassLoader.loadLibrary0(Unknown Source)
     at java.lang.ClassLoader.loadLibrary(Unknown Source)
     at java.lang.Runtime.loadLibrary0(Unknown Source)
     at java.lang.System.loadLibrary(Unknown Source)
     at com.sun.opengl.impl.NativeLibLoader$DefaultAction.loadLibrary(NativeLibLoader.ja
va:78)
Re: shaders in processing
Reply #20 - Mar 2nd, 2008, 10:30pm
 
I tried again the cgtest0 example (I didn't run it in a long time):

http://users.design.ucla.edu/%7Eacolubri/shaders/processing/cgtest0.applet/cgtest0.source.zip

locally on my machine, and works fine with v0135. Do you have the CG toolkit properly installed on your machine? I'm using CG v1.5:

http://developer.nvidia.com/object/cg-toolkit-15.html

Also, from the error message you posted seems that you are using processing v0121. Probably the CG support in that version wasn't very good. I'd try upgrading to 0135.

Keep in mind that there is one thing that still doesn't work, which is CG shaders working in the online applets. GLSL shaders do work in the applets, however.
Re: shaders in processing
Reply #21 - Mar 2nd, 2008, 10:56pm
 
ac,

the processing version is 135, i just keep using the same folder since 121 came out.

yes i installed cg toolkit aswell.

ok while checking the lib folder in processing ive noticed i had cg.dll and cgGL.dll in there aswell. that was what was causing the errors. i guess its old versions or not compatible dll versions.

works fine with your example.. thanks for the help ac.
Re: shaders in processing
Reply #22 - Mar 7th, 2008, 5:39pm
 
Hey. Very nice work JohnG.

As soon as I have time I'll start exploring this new possibility of Processing.

Keep up the good work!

:]
Re: shaders in processing
Reply #23 - Mar 19th, 2009, 4:21pm
 
Thank you JohnG, for a very concise and helpful example!
Re: shaders in processing
Reply #24 - Dec 4th, 2009, 6:54am
 
I'm playing with the GLSL class posted here. How do you change a shader parameter ?
Re: shaders in processing
Reply #25 - Jan 11th, 2010, 2:09pm
 
I'm using the GLSLGraphics lib but the code should be the same:
Code:

PGraphicsOpenGL pgl = (PGraphicsOpenGL) g;
GL gl = pgl.beginGL();
int loc = shader.getUniformLocation("theNameOfYourUniformVar");
gl.glUniform1fARB(loc, theValueOfYourUnform); // note that there are different methodes for the different var types
pgl.endGL();


Pages: 1 2