facehead1992

05-06-2015, 03:45 AM

I'm following a tutorial on an OpenGL particle system that references this gist. (https://gist.github.com/fenbf/30e3ca85659624380392) I've come across some perplexing problems in the glm content though.

Inside, it has the following lines...

float normalFactor = glm::dot(force, glm::vec4(0.0f, 1.0f, 0.0f, 0.0f));

if (normalFactor < 0.0f)

force -= glm::vec4(0.0f, 1.0f, 0.0f, 0.0f) * normalFactor; <--ERROR HERE

float velFactor = glm::dot(p->m_vel[i], glm::vec4(0.0f, 1.0f, 0.0f, 0.0f)); <--ERROR HERE

It is where I receive errors from Visual Studio 2013 that are confusing me a bit.

Multiplication of glm::vec4 and normalFactor: "Error: no operator '*' matches these operands. Operands are: glm::vec4 * float"

glm::dot call with two vec4 objects: "Error: no instance of overloaded function 'glm::dot' matches the argument list. Argument types are: (glm::vec4, glm::vec4)

I checked the declaration of glm::vec4's operators and there is indeed a scaling '*' operator.

I also checked the implementation of glm::dot and it explicitly accepts vecType objects (which tvec4 and vec4 both are by extension).

Why then, if both of these implementations exist, do I receive these errors?

I have included various header files at the top of my cpp file, in varying combinations to try and make it work...

#include "ParticleUpdaters.hpp" //relevant to the tutorial

#include <glm/glm.hpp>

#include <glm/vec4.hpp>

#include <glm/common.hpp>

#include <glm/geometric.hpp>

#include <glm/trigonometric.hpp>

None of them seem to have anything that makes the code actually compile.

Either the guy who made the tutorial deliberately made code that doesn't compile, or I am missing something extremely obvious. Can anyone point me in the right direction?

Also, I have found that it can be difficult to identify which exact header file contains which functions. Can someone please show me a simple searchable database/website/something online I can reference for that?

Inside, it has the following lines...

float normalFactor = glm::dot(force, glm::vec4(0.0f, 1.0f, 0.0f, 0.0f));

if (normalFactor < 0.0f)

force -= glm::vec4(0.0f, 1.0f, 0.0f, 0.0f) * normalFactor; <--ERROR HERE

float velFactor = glm::dot(p->m_vel[i], glm::vec4(0.0f, 1.0f, 0.0f, 0.0f)); <--ERROR HERE

It is where I receive errors from Visual Studio 2013 that are confusing me a bit.

Multiplication of glm::vec4 and normalFactor: "Error: no operator '*' matches these operands. Operands are: glm::vec4 * float"

glm::dot call with two vec4 objects: "Error: no instance of overloaded function 'glm::dot' matches the argument list. Argument types are: (glm::vec4, glm::vec4)

I checked the declaration of glm::vec4's operators and there is indeed a scaling '*' operator.

I also checked the implementation of glm::dot and it explicitly accepts vecType objects (which tvec4 and vec4 both are by extension).

Why then, if both of these implementations exist, do I receive these errors?

I have included various header files at the top of my cpp file, in varying combinations to try and make it work...

#include "ParticleUpdaters.hpp" //relevant to the tutorial

#include <glm/glm.hpp>

#include <glm/vec4.hpp>

#include <glm/common.hpp>

#include <glm/geometric.hpp>

#include <glm/trigonometric.hpp>

None of them seem to have anything that makes the code actually compile.

Either the guy who made the tutorial deliberately made code that doesn't compile, or I am missing something extremely obvious. Can anyone point me in the right direction?

Also, I have found that it can be difficult to identify which exact header file contains which functions. Can someone please show me a simple searchable database/website/something online I can reference for that?