G
G
GreatRash2016-05-27 10:09:28
Game development
GreatRash, 2016-05-27 10:09:28

Learning to write shaders, where is the error?

There is a sandbox for writing shaders under Three.js, I'm trying to write a simple fragment shader there, which stupidly copies all the colors from the texture and pastes them without modification. The code:

#ifdef GL_ES
precision mediump float;
#endif

#extension GL_OES_standard_derivatives : enable

varying vec2 vTextureCoord;
uniform sampler2D uTexture;

void main(void) {

  gl_FragColor = texture2D(uTexture, vTextureCoord);

}

But it doesn't compile. Where did I go wrong?
UPD: I don't understand anything at all. Apparently the variable names have a value of o_0, so it worked:
#ifdef GL_ES
precision mediump float;
#endif

#extension GL_OES_standard_derivatives : enable

varying vec2 vTextureCoord;
uniform sampler2D uSampler;

void main(void) {

  gl_FragColor = texture2D(uSampler, vTextureCoord);

}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question