-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Description
Relating to this topic : http://forum.processing.org/two/discussion/7484/vertex-attribute-bug-#Item_5
I just set a color if the vertex X position is > 0 or not. So if the vertex is really in world space, not in view, if i move the camera the color would stay at the same position on the box. Here, the color move on the box when i move the camera not the world(so the view matrix ?)
Is-it a normal behaviour ?
PDE
import peasy.*;
PShader cubemapShader; PeasyCam cam;
void setup() { size(800, 640, P3D); frameRate(60);
// Load cubemap shader. cubemapShader = loadShader("cubemapfrag.glsl", "cubemapvert.glsl"); cam = new PeasyCam(this, 0, 0, 0, 180); cam.setYawRotationMode(); }
void draw() { background(0); shader(cubemapShader); box(50); resetShader(); }
Vertex
uniform mat4 transform;
attribute vec4 position;
varying vec4 pos;
void main() {
pos = position;
gl_Position = transform * position;
}
Fragment
varying vec4 pos;
void main() { if(pos.x > 0.0){ gl_FragColor = vec4(1,0,0,1); } else{ gl_FragColor = vec4(0,0,1,1); } }