Gouraud shading in Processing 2
in
Core Library Questions
•
11 months ago
Hi
I'm a relative newbie to Processing so apologies if this has been covered elsewhere (I have searched though!) I'm trying to implement a Gouraud shader in my processing sketch and have had no luck trying to create external GLSL files in my sketch's Data folder. I've copied source code from various sample files (found by searching for "GLSL Gouraud") and saved them as glsl files, either individually or as seperate Vertex and Fragment glsl files. Using the following syntax...
PShader gouraud;
void setup(){
//usual setup stuff
gouraud = loadShader("gouraud.glsl");
}
void draw(){
shader(gouraud);
//retained mode PShape and other vertex data follows
}
... I generally get an empty grey window when I run the sketch. So. Three questions...
1. Does anyone know of a working gouraud shader glsl file and appropriate syntax for inclusion in Processing?
2. If not, are there any plans to include one with the included Examples in a future Beta release? (would seem like a useful shader!)
3. Are there alternate methods using lower-level OpenGL calls that would achieve this aim? (I'm aware that in principle I could roll my own gouraud shader using vertex normals and per vertex fill settings but I was hoping for an out of the box solution - I have enough programming fish to fry with my project! ;-) )
Many thanks for any answers,
Matt
I'm a relative newbie to Processing so apologies if this has been covered elsewhere (I have searched though!) I'm trying to implement a Gouraud shader in my processing sketch and have had no luck trying to create external GLSL files in my sketch's Data folder. I've copied source code from various sample files (found by searching for "GLSL Gouraud") and saved them as glsl files, either individually or as seperate Vertex and Fragment glsl files. Using the following syntax...
PShader gouraud;
void setup(){
//usual setup stuff
gouraud = loadShader("gouraud.glsl");
}
void draw(){
shader(gouraud);
//retained mode PShape and other vertex data follows
}
... I generally get an empty grey window when I run the sketch. So. Three questions...
1. Does anyone know of a working gouraud shader glsl file and appropriate syntax for inclusion in Processing?
2. If not, are there any plans to include one with the included Examples in a future Beta release? (would seem like a useful shader!)
3. Are there alternate methods using lower-level OpenGL calls that would achieve this aim? (I'm aware that in principle I could roll my own gouraud shader using vertex normals and per vertex fill settings but I was hoping for an out of the box solution - I have enough programming fish to fry with my project! ;-) )
Many thanks for any answers,
Matt
1