A new example has been added to the GLSL Core Tutorial showing the theory and implementation of directional lights, using both Gouraud and Phong shading models. Soon more light types, point and spotlights, will follow.
Both FreeGLUT and GLUT allow us to define an OpenGL context with multisampling. However the number of samples is fixed (4) and I’ve not found a way to change it using the API.
In here we’re going to see how to hack FreeGLUT so that we can change the default number of samples. This can be achieved either by changing the default value, or by adding a new function to set this value.
Note: This hack should be used only for testing purposes, not for redistribution, as FreeGLUT has a large base of users which already have the official version installed.
OpenGL renders to framebuffers. By default OpenGL renders to screen, the default framebuffer that commonly contains a color and a depth buffer. This is great for many purposes where a pipeline consists of a single pass, a pass being a sequence of shaders. For instance a simple pass can have only a vertex and a fragment shader.
For more complex graphical effects or techniques, such as shadows or deferred rendering, multiple passes are often required, where the outputs of a pass are inputs of the following pass, for instance as textures. In this context, instead of rendering to screen, and then copying the result to a texture it would be much nicer to render to texture directly. The figure shows a two pass pipeline, where the first produces three textures that are used in the second pass to compose the final image. This is one of the advantages of framebuffer objects: we can render to multiple outputs in a single pass.
Besides, rendering to screen requires the outputs to be of a displayable format, which is not always the case in a multipass pipeline. Sometimes the textures produced by a pass need to have a floating point format which does not translate directly to colors, for instance the speed of a particle in meters per second.
In this short tutorial we will see how a framebuffer object can be created, and used with shaders. A demo is also provided with full source code, and a VS 2010 solution.
The Lighthouse3D GLSL Core Tutorial has been updated with a few sections, namely how to check the result of the compilation and linking operations, freeing up resources, and how do shaders communicate between themselves on modern OpenGL. The shader interfaces are presented and discussed, with examples and a comparison between the several mechanisms OpenGL provides.
Shaderific is a great iOS application for OpenGL ES shader learning. The app provides the source code for the vertex and fragment shaders for 18 built-in demo shaders, and it allows the creation of new ones. Many 3D objects (including the required teapot) are available, and material and lighting can also be set. There is a free version that lets us try it out, but the changes are not kept once the app is closed.
Glow and Bloom is the latest article on this great series that presents graphic effects with source code, theory, and a WebGL demo.
The series already has 8 articles starting with the basics of lighting and exploring several effects. Many more are to be released according to the index.
I’ve been working for some time with wxWidgets. The only thing I’ve missed, regarding OpenGL, is the ability to define my own OpenGL context, in particular Core profile and Debug contexts.
To be able to set a context we, or the toolkit we’re using, must use the
wglCreateContextAttribsARB function, as defined in the WGL_ARB_create_context extension. As it happens, wxWidgets uses
wglCreateContext, hence no OpenGL context can be explicitly defined using the provided source code for the current release (2.9.4).
The solution is for the Windows platform, but other platforms should be as easy to change as well.
Note: I make no claim regarding the quality of the solution, it worked for me, and that’s all I claim. If anyone knows of a better way of doing this comments are most welcome, as they may prove useful for other readers (and me as well ).
Bloodshed Dev-C++ is a full-featured Integrated Development Environment (IDE) for the C/C++ programming language. It uses Mingw port of GCC (GNU Compiler Collection) as it’s compiler. Dev-C++ can also be used in combination with Cygwin or any other GCC based compiler.
Here is a short tutorial that was pointed to me to setup Dev C++ with OpenGL. The tutorial is from the collection of Programming Tutorials and Lecture Notes from the Computer Science Department of Central Connecticut State University.
The updated version of GLSL tutorial. Only the core version will be dealt in this tutorial.
The tutorial is, and will be in the near future, in construction. I don’t plan to close it, at least in the near future, unless a new version of OpenGL changes everything again.
I’ll be adding content from time to time, initially to get the base complete, and afterwards to provide examples.
The tutorial does not intend to replace the specs as THE source to fully grasp GLSL and OpenGL. The specs are essential, but can be hard to start learning. So consider the tutorial as a gentle introduction to the theme.
As always, your cooperation is a must to get things right. Tutorials always have bugs, mistakes, and things that are not clearly explained. Furthermore, I might get somethings wrong, but please be gentle Your feedback is important.
Well, this is it. Have fun playing with GLSL and OpenGL!
Move on to the Index.
NShader is a Visual Studio extension that provides syntax highlighting in VS 2008 and 2010 (express editions are not supported). The following extensions are recognized: .glsl, .frag, .vert, .fp, .vp, .geom (no tessellation shaders yet ).