Jump to content
  • Advertisement
Sign in to follow this  
bgoldbeck

GLM Math Lib, Help on Swizzling

This topic is 2640 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm new to the GLM Mathematics library and I have a problem with swizzling. Right now if i do:

vec3 A;
float x = A.x;

My IDE doesn't like it and throws up a red flag saying "unable to resolve identifier x". However, the code compiles, runs, and works fine. I would like to avoid this way of attaining float values from vec3 objects anyway. What is another way I can do this?

Share this post


Link to post
Share on other sites
Advertisement
Chances are you IDE just isn't clever enough to process the macros and so on.

Did you try

vec3 A;
float x = A[0];


Did you use the #define or include the swizzle.hpp file?

[font="monospace, fixed"] [/font]
#define GLM_SWIZZLE
#include <glm/glm.hpp>
[font="monospace, fixed"] [/font]

OR

[font="monospace, fixed"] [/font]#include <glm/glm.hpp>
#include <glm/gtc/swizzle.hpp>
[font="monospace, fixed"] [/font]

The 2nd one might be better for your IDE.

See: http://glm.g-truc.ne...9.2/a00002.html

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!