On Saturday, 2 May 2015 at 22:36:29 UTC, anonymous wrote:
On Saturday, 2 May 2015 at 22:01:10 UTC, WhatMeWorry wrote:
   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

You have to be explicit:

    Vertex[6] triangle = /* [1] */
    [
        Vertex(
            vec3(0.0,  1.0, 0.0),
            vec3(1.0,  0.0, 0.0),   // red
        ),
        ...
    ];

[1] `Vertex triangle[6]` works, but please don't do that.

Thanks. I assume you would prefer I use triangle[] but with OpenGL calls the dynamic arrays don't work. But maybe that is another question for another time.

Reply via email to