Talk:OpenGL Programming/Modern OpenGL Tutorial 02

What is meant by "In init_resources, we move the triangle_vertices definition, create one (1) data buffer and make it the current active buffer:" Where is the function moved? From one file to another? From one line to another? I would suggest heavily that this wikibook make use of better highlighting of what is expected done by those who follow the tutorial and extra information. When code is to be entered to follow the tutorial, it should be very clear where it is to be done. 77.215.111.72 (discuss) 13:55, 9 December 2012 (UTC)
 * Can you make a suggestion, using the complete final source code (see link at the bottom of the tutorial) ? Beuc (discuss • contribs) 14:07, 15 December 2012 (UTC)
 * I agree with OP that the statement needs clarification. I followed the tutorial and did not understand what the tutorial was asking me to do. As for a suggestion: "Move the triangle_vertices definition from the onDisplay function and place it at the beginning of the init_resources function . Also, add code to create a buffer and make it the currently active buffer as shown below:" (underlining used to highlight the clarification) Lafleurcp (discuss • contribs) 19:33, 3 September 2014 (UTC)

A minor point. The triangles file is called triangle.c in tut1 and triangle.cpp in this tut. Apostrophyx (discuss • contribs) 13:31, 26 December 2012 (UTC) This actually isn't that minor. I struggled to get VS2013 to compile until I renamed triangle.c to triangle.cpp Jbattin (discuss • contribs) 04:37, 29 December 2014 (UTC)

In the "Debugging shaders" section, the print_log function is presented. First, let me say there is nothing wrong with the code. This is a low-priority suggestion. The code is formatted in a way that I've never liked: an if statement, followed by one line of independent code, followed by another if statement that uses the exact same conditional test. I understand why this was done, but using function pointers can clean up the code. Although, admittedly, function pointers may not be suitable for the tutorial audience. Here's the code I used (which follows my personal naming conventions): Lafleurcp (discuss • contribs) 20:43, 3 September 2014 (UTC)

Code issues
Is a comma missing in the code of section "Abstracting differences between OpenGL and GLES2"?
 * I assume you're referring to the initialization of the "sources" variable. No, there is no missing comma as of the time of this writing. The "sources" variable holds two character pointers/strings. The first is a version header (handled by the #ifdef-#else-#endif block), and the second is the variable "source" (which contains the content of the shader file). In the case of the GL ES 2.0 header, the #version and #define information are held in a single string. The string is broken across two lines to improve readability in the code, but as far as the code is concerned, it is still only one string. Do not let that line break (or the embedded newlines) confuse you.Lafleurcp (discuss • contribs) 19:19, 3 September 2014 (UTC)

The file_read function contains a "problem" comment regarding closing the FILE handle when error conditions arise, and a response that implies the correction(s) would be burdensome or messy. Some of the solutions implied would be burdensome or messy. However, I'm providing a soluton from my own files that addresses the problem. Note, however, that I employ my own naming conventions--naming conventions that differ from those in the tutorial.

If you eliminate the comments, the size of the code is very similar to the original. The file handle is properly closed in all situations, the content of the shader file is returned in the same manner as the original, and the user/programmer still makes only one function call to ReadShaderFile in the create_shader function later in the tutorial.Lafleurcp (discuss • contribs) 20:16, 3 September 2014 (UTC)