On 06.11.2015 20:05, Spacen Jasset wrote:
Also, I had to add a dummy private constructor to make my structs
'createable', or is there another way?
e.g.
struct Texture
{
@disable this();
static Texture create()
{
return Texture(0);
}
...
private:
this(int)
{
glGenTextures(1, &textureId_);
enforce(0 != textureId_);
}
GLuint textureId_;
}
You can use Texture.init to initialize a variable:
----
struct Texture
{
@disable this();
static Texture create()
{
Texture t = Texture.init;
glGenTextures(1, &t.textureId_);
enforce(0 != t.textureId_);
return t;
}
private:
GLuint textureId_;
}
----