Hello, i'm having an issue. I'm trying to render this texture, but when I did my texture was shown incorrectly.
Result:
As you see my other sprites are shown correctly but not this one, where the problem?
Vert shader:
std::string vertSource =
"#version 330 core\n"
"in vec2 position;"
"uniform vec2 trans = vec2(1.0,1.0);"
"uniform vec2 trans2 = vec2(0.0,0.0);"
"uniform vec2 objsize;"
"uniform vec2 winsize;"
"uniform float timer = 0;"
"attribute vec4 texCoord;"
"varying vec2 texCoordV;"
"void main()"
"{"
" texCoordV = vec2(texCoord);"
//" texCoordV.x /= 3;"
//" texCoordV.x += (1.0f/3);"
//" texCoordV.x *= 2;"
" vec2 trans3 = ( ( trans2 * vec2( 2.0, 2.0 ) ) / winsize ) + vec2( -1.0, -1.0 );"
" trans3 += ( objsize / winsize );"
" vec4 test = vec4( ( position * trans ) + trans3, 0.0, 1.0 );"
" test.xy *= "
" mat2"
" ("
" vec2( cos( timer ), -sin( timer )),"
" vec2( sin( timer ), cos( timer ))"
" );"
" gl_Position = test;"
"}";
Frag shader:
std::string fragSource =
"#version 330 core\n"
"out vec4 out_color;"
"uniform sampler2D textureMap;"
"varying vec2 texCoordV;"
"uniform float text = 0;"
"void main()"
"{"
" if( text == 1 )"
" out_color = texture2D(textureMap, texCoordV);"
" else"
" out_color = vec4(0.0,1.0,0.0,1.0);"
"}";