SFML community forums

Help => Graphics => Topic started by: abreu20011 on June 23, 2019, 07:27:25 pm

Title: gl_TexCoord undeclared
Post by: abreu20011 on June 23, 2019, 07:27:25 pm
Hi everyone  :)

I have a fragment program that works fine into my main machine, but into a laptop with updated graphics drivers (Intel HD Grapchics) throws an error. Anyone imagine what's happens?

Seems to be a internal problem into SFML to initialize this variable correctly.
Besides, into my main machine if I don't declare version shader, no error are generated, but in this laptop I need to declare versiĆ³n to stop complaining GLSL errors.

I tried all GLSL versions, from 110 to 420 and in all versions don't works.
Actually my current versions are declared like this: #version 150 core

This line...:

vec2 uv = gl_TexCoord[0] + make_uv_from_rotation();

Throws the next error:

Failed to compile fragment shader:
ERROR: 0:39: 'gl_TexCoord' : undeclared identifier
ERROR: 0:39: 'gl_TexCoord' : left of '[' is not of type array, matrix, or vector
 
Title: Re: gl_TexCoord undeclared
Post by: Hapax on June 23, 2019, 10:42:02 pm
Are you using a custom vertex shader? Are you preparing it there?
See the minimal vertex shader:
https://www.sfml-dev.org/tutorials/2.5/graphics-shader.php#minimal-shaders

Also, should you not also be specifying the components that are required?
e.g. gl_TexCoord[0].st
(or at least the components of the final result of your addition)
Title: Re: gl_TexCoord undeclared
Post by: abreu20011 on October 19, 2020, 03:56:11 am
Just in case someone find this usefull, I don't remember the exactly problem of this, but one problem you can find is the the texture rect.

m_Shape->setTextureRect(IntRect(0, 0, 1, 1));
 

if you don't set any texture, SFML doesn't call setTextureRect, so has a value of {0,0,0,0}