Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Vertex attributes are passed in view space instead of model space to the vertex shader #2904

Copy link
Copy link
@P0ulp

Description

@P0ulp
Issue body actions

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); } }

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.