Using OpenGL

Darren via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Sep 3 10:13:49 PDT 2016


On Saturday, 3 September 2016 at 16:07:52 UTC, Mike Parker wrote:
> On Saturday, 3 September 2016 at 16:01:34 UTC, Mike Parker 
> wrote:
>
>> The following compiles, runs, and shows the triangle. It's the 
>> code you posted above with the corrected call to glBufferData 
>> along with more D style (as I would write it anyway) and less 
>> C.
>

The dynamic array!  Thank you so much, I changed that on another 
file and it finally drew the triangle.  And I ran your code and 
it works brilliantly.  I should now be in a comfortable position 
to digest all this information now.  Can't thank you enough.

> One thing I overlooked. In lines where a variable is both 
> declared and initialized, like this one:
> GLFWwindow* window = glfwCreateWindow(...);
>
> I normally let the compiler use type inference as I did in the 
> manifest constant declarations:
> auto window = glfwCreateWindow(...);
>
> IMO, when you're dealing with long or ugly type names, it makes 
> the code look cleaner.

Yeah, it is nicer to read.

Now I wonder if I can load shaders from separate files (à la 
http://www.opengl-tutorial.org/beginners-tutorials/tutorial-2-the-first-triangle/).


More information about the Digitalmars-d-learn mailing list