Saturday, March 29, 2014

OpenGL Texture is not (just) Picture

I'm a beginner in OpenGL for sure and one of the most confusing thing (read: naming convention) that has plagued me in these last two days is OpenGL texture. Contrary to the naming for functions, constants and objects used for OpenGL texture, everything related to texture on those "interfaces" don't really apply to image/picture only. It's much more general than that. OpenGL texture is basically a "lookup-table" (array) and it can store anything as long as the data type matches with the texture that you use in your code. The naming for OpenGL texture "interface" that usually implies the use of image/picture is a legacy of the past. It was used since the day of fixed-function video card and used until now to preserve API backward-compatibility--at least that's one of the reason that I'm aware of.

Anyway, these are some useful links regarding OpenGL texture:
http://www.mathematik.uni-dortmund.de/~goeddeke/gpgpu/tutorial.html#arrays1
http://www.arcsynthesis.org/gltut/Texturing/Tutorial%2014.html

Friday, March 21, 2014

Adding New Directory to CodeBlocks Code Completion

CodeBlocks (http://www.codeblocks.org) cannot enumerate all of the possible C/C++ include directories automatically in some cases. For example, when you are using 3rd party C/C++ libraries which are installed in non-standard path. At least that's the state of CodeBlocks v13.12.

Now, how do you go about adding new directories to be added to the codecompletion parser? The procedure is explained in CodeBlocks FAQ at http://wiki.codeblocks.org/index.php?title=FAQ-Settings. However, as I found out, only the second method works in CodeBlocks v13.12, i.e. only the per-project non-standard include directories (to be parsed) can be configured. These are the steps:

  1. Activate the project (either by double clicking on it in the Projects pane or right click on the project and then click "Activate")
  2. Click on the "Project | Properties" menu. 
  3. Click on the "C/C++ parser options" tab. 
  4. Add the additional include directory to be parsed by the Code Completion plugin.
  5. Click on OK.
Now, you should have code completion working in CodeBlocks editor. If it's not working yet, you might need to close the project and re-open the project again.