Jump to content
  • Advertisement
Sign in to follow this  

Toubles wqith basic shaders in GLSL

This topic is 755 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone !

I have a strange problem with basic shaders in GLSL that struggles me, using OpenGL ES 2.0 on Android. (Main program is in Java)


Here's the vertex shader :

attribute vec4 position;
attribute vec2 iTexCoord;
attribute vec4 iColor;
attribute float iAngle;

uniform mat4 vpMatrix;

varying vec2 oTexCoord;
varying vec4 oColor;
varying float oAngle;

void main() {
    oTexCoord = iTexCoord;
    oColor = iColor;
    oAngle = iAngle;
    gl_Position = vpMatrix * position;

And here's the fragment shader

precision mediump float;

varying vec2 oTexCoord;
varying vec4 oColor;
varying float oAngle;

uniform sampler2D sampler;

void main() {
	gl_FragColor = texture2D(sampler, oTexCoord / 4.0 + vec2(0.0, 0.8)) * oColor;

Whatever I do, gl_FragColor is always sampled from oTexCoord. Even if my rule of 3 is designed to sample a normal map in the last row of the color map. (All is in a regular sprite sheet).

I'm really new to GLSL(even if I used HLSL before), so this should be a dumb question.



Edited by Tournicoti

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!