An annoying compile issue

WhatMeWorry via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Oct 25 20:44:19 PDT 2015


I'm porting over some C++/glm/openGL code.  I've used gl3n for a 
while now (successfully) to port over glm code, but I've got this 
pebble in my shoe:

glm::mat4 model;
model = glm::scale(model, glm::vec3(size, 1.0f));   // size is a 
vec2

So my D code consists of:

mat4 model;
model = model.scale(vec3(size, 1.0f));  // size is a vec2


Error: function gl3n.linalg.Matrix!(float, 4, 4).Matrix.scale 
(float x, float y, float z) is not callable using argument types 
(Vector!(float, 3))


First, isn't Vector!(float,3) a template which creates a tuple 
consisting of float, float, float; so aren't the argument types 
identical?

I can workaround the issue by simply
model = model.scale(size.x, size.y, 1.0f);

but that seems like cheating :)

Is there an elegant D fix. Not to imply that there is any other 
kind.





More information about the Digitalmars-d-learn mailing list