SFML community forums

Help => Graphics => Topic started by: GLS on December 16, 2014, 06:52:04 pm

Title: sf::Shader and glm::mat4
Post by: GLS on December 16, 2014, 06:52:04 pm
Hi! How to pass in shader matrix 4x4?
vert.glsl:
attribute vec4 a_position;
attribute vec4 a_color;

uniform mat4 u_MVP;

varying vec4 v_color;

void main()
{
        v_color = a_color;
        gl_Position = u_MVP * a_position;
}
 
main.cpp
glm::mat4 projectionMatrix;
glm::mat4 viewMatrix;
glm::mat4 modelMatrix;
sf::Shader shader;
//...
if (!shader.loadFromFile("res/shaders/vert.glsl", "res/shaders/frag.glsl"))
{
        exit(1);
}
//...
sf::Shader::bind(&shader);
shader.setParameter("u_MVP", glm::value_ptr(projectionMatrix * viewMatrix * modelMatrix)); // error
//...
sf::Shader::bind(NULL);
 
Error in shader.setParameter. Please tell me the solution?
Title: AW: sf::Shader and glm::mat4
Post by: eXpl0it3r on December 16, 2014, 07:11:42 pm
What about providing the error?
What did you try to solve the issue on your own? We're not your 24/7 programming support, you're a programmer you need to know or learn how to solve problems on your own.
Title: Re: AW: sf::Shader and glm::mat4
Post by: GLS on December 16, 2014, 07:30:29 pm
What about providing the error?
sf :: Shader not support the transfer of a 4x4 matrix in the vertex shader
Title: Re: AW: sf::Shader and glm::mat4
Post by: GLS on December 16, 2014, 07:40:02 pm
We're not your 24/7 programming support
Look at my profile, I am addressing here is very rare.
Title: Re: AW: sf::Shader and glm::mat4
Post by: Gambit on December 16, 2014, 07:46:13 pm
We're not your 24/7 programming support
Look at my profile, I am addressing here is very rare.

He didnt mean literally. Its a figure of speech.
Title: Re: AW: sf::Shader and glm::mat4
Post by: GLS on December 16, 2014, 08:22:46 pm
He didnt mean literally. Its a figure of speech.
Sorry, I use Google Translate and may where it is not correctly put it?
Title: Re: sf::Shader and glm::mat4
Post by: Laurent on December 16, 2014, 09:15:32 pm
https://github.com/SFML/SFML/issues/538
Title: Re: sf::Shader and glm::mat4
Post by: GLS on December 16, 2014, 09:24:15 pm
I Get It. Thank you!
Title: Re: sf::Shader and glm::mat4
Post by: GLS on February 07, 2015, 08:36:04 pm
Hi! There is no progress on this issue? How to pass in the shader matrix 4x4?
Title: Re: sf::Shader and glm::mat4
Post by: Laurent on February 07, 2015, 10:22:21 pm
Quote
There is no progress on this issue?
No need to ask, if there was, it would be visible in the issue itself ;)

Quote
How to pass in the shader matrix 4x4?
Until something is done on our side, I don't think it is even possible.