Talk:OpenGL Programming

smaller screen shots?
Would it make sense to have smaller screen shots? I'm thinking of icon-size instead of small image size. That would make the layout a lot smaller and would provide a better overview of the table of contents (which is the whole point of a table of contents :) and it would require less scrolling. --Martin Kraus (discuss • contribs) 13:07, 29 August 2011 (UTC)
 * Thanks for the suggestion. I rearranged the page with smaller screenshots and double-columns - but I didn't go as small as icon-sized :) Beuc (discuss • contribs) 20:07, 29 August 2011 (UTC)
 * That's better. Maybe you could also remove the numbers to the left of the images? -Martin Kraus (discuss • contribs) 11:27, 30 August 2011 (UTC)
 * Hmmm, I think I like it better with the digits. I did a test without - it doesn't convey the same "everything you'll want to know in N steps" feeling :) Beuc (discuss • contribs) 22:15, 30 August 2011 (UTC)

TODO / WIP illustrations
I copy these two illustrations here, so we can easily copy/paste the code when we need them on the wikibook front page.

OpenGL 2.1 - big picture missing
It seems the OpenGL 2.1 ("modern") part jumps directly to code and vertex/fragment shaders. I think a big picture (what stages does the pipeline consist of, what data is passed from what stage to what stage, etc.) is missing there. See for an example. -- NotInventedHere (discuss • contribs) 08:40, 6 December 2011 (UTC)


 * The overview that you cite is given in an appendix of the OpenGL Programming book. Thus, it is certainly not missing. Would it be a good idea to start with that overview instead of putting it into an appendix? Here are some reasons against this approach:
 * It's very difficult to understand what the stages of the pipeline are good for before you see any application of the pipeline. It's easier to start with some simple examples and later introduce the pipeline, once its main features and uses are known.
 * Many modern learners prefer to learn from tutorials that teach useful stuff instead of books that talk about abstract concepts (e.g. the OpenGL pipeline) that cannot be used for anything without a lot of other information.
 * For some learners (in particular with a strong technical background), it is very helpful to know the pipeline. Presenting the pipeline in an appendix and linking to it at appropriate places in the tutorials allows these learners to read about the pipeline at the best possible time: when they already have an idea how the pipeline fits into the rendering process and they are curious how it works exactly.
 * I understand that there are also reasons in favor of a more prominent introduction to the pipeline but I think the current version is a quite good solution. --Martin Kraus (discuss • contribs)


 * The overview has been written by me a while back, basically filling in the (in my eyes crucial) information my OpenGL ES tutorial book ("OpenGL ES 2.0 Programming Guide") was missing, making it hard to comprehend. So it's been written from a learner's perspective. Anyways, I agree that no long-winded pipeline introduction is needed, but some advance words about it (some paragraphs) would be good. The problem with my text is that it's too long and applies to OpenGL ES. I would rework it if I had the time and knowledge about OpenGL 2.0 (non-ES). -- NotInventedHere (discuss • contribs) 22:59, 28 December 2011 (UTC)

Sides labelled wrongly
In the topic that adds the cube I notice that at least in my implementation (and also from what I can tell by thinking through the code) the index's that are listed as making up some of the sides are labelled as making up different sides. For example // left 4, 5, 1,   1, 0, 4,

Looks to me like it makes up the BOTTOM of the cube, not the left. Can anyone clarify? 62.49.19.234 (discuss) 13:02, 4 March 2012 (UTC)

Copyright of these tutorials?
What is the license of these tutorials? Is it ok to use these kinds of code (and e.g. Wikipedia's code examples) in closed source projects? For example, in the GLSL_Programming/Introduction there is a box that says "Unless stated otherwise, all example source code on this page is granted to the public domain." at the bottom of the page. --88.148.251.200 (discuss) 10:39, 16 December 2012 (UTC)


 * Without such a notice, any code in Wikibooks is by default under the Creative Commons Attribution-ShareAlike 3.0 license, which makes it difficult to use it in closed source projects. Thus, you have to ask the author for permission. (For code from the GLSL Programming wikibook you don't have to ask because that box grants the code to the public domain.) --Martin Kraus (discuss • contribs) 18:55, 17 December 2012 (UTC)

GLFW
I don't use it myself, but many newer applications are using GLFW ( https://www.glfw.org/ ) instead of libraries like GLUT to get an OpenGL application up and running on a variety of platforms. GLFW handles creating windows and receiving input from users. Think it would be useful to mention somewhere on the wiki.

TinyGL and forks
For systems that don't have a full OpenGL implementation, TinyGL offers a way to run some older OpenGL (approx. 1.1) functions on the machine. It does CPU rendering. It runs very well on handheld devices such as gaming consoles. It's also been used on operating systems like Amiga, BEOS and Syllable that may not normally offer OpenGL support. There are several forks of TinyGL including TinySDGL (which works with SDL), PicoGL (which supports SDL, nano-x, vesa and X11 backends) and TinyGLES (used by glshim). Some forks include an alternative floating point library for devices that don't support floating point calculations efficiently. There's even a tinygl.js implementation that uses emscripten to run TinyGL with JavaScript at web sites. If one wants to use OpenGL on platforms that don't have OpenGL implementations or don't have the GPU/hardware support to run them efficiently, TinyGL and its forks are a good alternative. Most demos and some applications targeting OpenGL 1.1 work fine with TinyGL or some of its forks. (I'm currently working on a fork of PicoGL that takes some of the additions from various TinyGL forks and incorporates them as well as other useful features so that it's easier to port older OpenGL applications and get them working.) One can also use TinyGL or a fork to supply missing OpenGL functionality on systems that only support OpenGLES. For instance, one can port a demo or game using SDL and a TinyGL fork to an Android device.

Drawing text
I've been looking for resources on how to draw text (using TrueType fonts). Have not found much information on it other than to use someone else's library. Would love to see some documentation added to the wiki. Most references say it's difficult and gloss over the problem. So far, I've found out that there are two main libraries typically used to access the TrueType fonts, Freetype2 ( https://www.freetype.org/ ) and stb_truetype.h ( https://github.com/nothings/stb ). From what I've read from others, the opinion is that Freetype typically has better rendering quality than stb_truetype.h. The best example library I could find for showing different methods of getting fonts to the screen using Freetype was oglft ( http://oglft.sourceforge.net/ ) which demos using techniques such as glBitmap, glDrawPixels, texture mapping and others. Most, but not all font libraries that work later versions of OpenGL seem to use texture mapping and a texture alias. Freetype2 or stb_truetype.h generate pixmaps at the size requested and several pixmaps are stored together as a texture using glTexImage2D. A texture atlas is used to limit the amount of data one needs to transfer from the CPU to the GPU. glTexSubImage2D is used to update parts of the texture atlas as needed. fontstash is one example of a texture atlas ( https://github.com/memononen/fontstash ). There are a few other tutorials on the Internet. Would love to see more detailed information on design pros and cons for this. There are other methods of drawing fonts such as tessellation. The texture atlas method seems to be the easiest method to use on both older and newer versions of OpenGL if you need to support working with more than one version.

If some knows more details on the subject, it would be great to see a section added that details how to draw TrueType fonts, pros and cons of various approaches, what to do and what not to do when rendering fonts. Thanks.

Thanks
Hey there, I just wanted to jump in and thank you guys, your tutorials are being invaluably useful to me. Happy hacking, and have the best luck! Martin.