Using OpenGL

Darren via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Sep 3 05:40:58 PDT 2016


On Saturday, 3 September 2016 at 11:33:10 UTC, Mike Parker wrote:
> On Saturday, 3 September 2016 at 11:02:11 UTC, Lodovico 
> Giaretta wrote:
>
>>
>> glGetShaderInfoLog(vertexShader, 512, null, &infoLog[0]);
>
> I prefer:
>
>  glGetShaderInfoLog(vertexShader, 512, null, infoLog.ptr);

That is a good tip to know.

I went through another tutorial. Changed the source code and left 
out the shaders.  I get another coloured background but still no 
triangle.  I have a feeling that

     glBufferData(GL_ARRAY_BUFFER, 
cast(int)g_vertex_buffer_data.sizeof,
                  cast(void*)g_vertex_buffer_data, GL_STATIC_DRAW);

in one example, or

     glBufferData(GL_ARRAY_BUFFER, vertices.sizeof, 
cast(void*)vertices, GL_STATIC_DRAW);
     glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * 
GLfloat.sizeof, cast(GLvoid*)0);

in the other might be responsible, since they seem to be related 
to drawing the triangle and I'm casting arguments in order to get 
the program to compile.
(In the first line, glBufferData wants an int, and .sizeof 
returns a uint, apparently.)

I'm sure there's something simple I'm missing but I just don't 
have the experience to recognise it.


More information about the Digitalmars-d-learn mailing list