Results 1 to 2 of 2

Thread: glm vec4/dot recognition issues

  1. #1
    Newbie Newbie
    Join Date
    May 2015
    Posts
    1

    glm vec4/dot recognition issues

    I'm following a tutorial on an OpenGL particle system that references this gist. I've come across some perplexing problems in the glm content though.
    Inside, it has the following lines...

    Code :
    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...

    Code :
    #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?

  2. #2
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,675
    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?
    You could always look at the documentation. It says exactly what header something is contained in.

    Alternatively, you could just not care. By including glm/glm.h, you get everything that's in core GLM. In the code you cited, that includes `vec4.hpp`, `common.hpp`, `geometric.hpp`, and `trigonometric.hpp`, among others.

Similar Threads

  1. Replies: 1
    Last Post: 11-17-2016, 07:52 AM
  2. Replies: 1
    Last Post: 06-02-2012, 05:26 AM
  3. shape recognition
    By spook1 in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 09-24-2011, 03:43 AM
  4. header recognition
    By D.M.Phillips in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 08-12-2007, 11:28 PM
  5. vec4 = mat4 + vec4
    By imported_Groovounet in forum OpenGL: GLSL
    Replies: 3
    Last Post: 08-06-2006, 05:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean