How to I translate this C++ structure/array
WhatMeWorry via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat May 2 15:01:08 PDT 2015
This is probably trivial but I just can't make a break thru.
I've got C++ code using glm like so:
struct Vertex
{
glm::vec3 position;
glm::vec3 color;
}
Vertex triangle[] =
[
glm::vec3(0.0, 1.0, 0.0),
glm::vec3(1.0, 0.0, 0.0), // red
// code removed for brevity.
];
And in D I'm using the gl3n library instead of glm.
struct Vertex
{
vec3 position;
vec3 color;
}
Vertex triangle[6] =
[
vec3(0.0, 1.0, 0.0),
vec3(1.0, 0.0, 0.0), // red
// code removed for brevity.
];
I keep getting the following:
MeGlWindow.d(171): Error: cannot implicitly convert expression
(Vector([0.000000F, 1.00000F, 0.000000F])) of type Vector!(float,
3) to Vertex
MeGlWindow.d(172): Error: cannot implicitly convert expression
(Vector([1.00000F, 0.000000F, 0.000000F])) of type Vector!(float,
3) to Vertex
MeGlWindow.d(174): Error: cannot implicitly convert expression
(Vector([-1F, -1F, 0.000000F])) of type Vector!(float, 3) to
Vertex
More information about the Digitalmars-d-learn
mailing list