Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: sf::Shader and glm::mat4  (Read 4540 times)

0 Members and 2 Guests are viewing this topic.

GLS

  • Newbie
  • *
  • Posts: 16
    • View Profile
sf::Shader and glm::mat4
« 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?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: sf::Shader and glm::mat4
« Reply #1 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

GLS

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: AW: sf::Shader and glm::mat4
« Reply #2 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

GLS

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: AW: sf::Shader and glm::mat4
« Reply #3 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.

Gambit

  • Sr. Member
  • ****
  • Posts: 283
    • View Profile
Re: AW: sf::Shader and glm::mat4
« Reply #4 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.

GLS

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: AW: sf::Shader and glm::mat4
« Reply #5 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?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: sf::Shader and glm::mat4
« Reply #6 on: December 16, 2014, 09:15:32 pm »
Laurent Gomila - SFML developer

GLS

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: sf::Shader and glm::mat4
« Reply #7 on: December 16, 2014, 09:24:15 pm »
I Get It. Thank you!

GLS

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: sf::Shader and glm::mat4
« Reply #8 on: February 07, 2015, 08:36:04 pm »
Hi! There is no progress on this issue? How to pass in the shader matrix 4x4?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: sf::Shader and glm::mat4
« Reply #9 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.
Laurent Gomila - SFML developer