I’ve been getting complaint about the Ryzom Core Studio GUI Editor plugin crashing instead of rendering what it should, so I did a little investigation. Apparently if you try to render OpenGL into a simple QWidget it will crash the driver ( at least the Intel one I have on my lappy ).
The solution: use QGLWidget instead of QWidget on Linux, even if you don’t use the rendering features of it.
The screen shows it working on my HP 6910p laptop, running XUbuntu 14.04.
Lately I’ve been messing around with OpenGL 3.3 core / GLSL lighting a bit more.
First I created a scene with a floor and the now used to boredom box of mine. Then I added a global light source ( that is it doesn’t change with the camera like the one I posted about earlier ) with red color and started to experiment a little with light color and texture color mixing:
Obviously this one wasn’t a very successful experiment 😛
The next one was a little bit better already:
This time in addition to the color mixing changes, I also changed how ambient light is handled: The parts where the diffuse red light source cannot light the scene are only lit with the ambient light source, which basically only modifies the luminosity of the texels. The result is as it can be seen on the picture, the side of the box is not colored red.
After all this I worked on it a bit more and added another diffuse light source, with blue color and a direction that can hit the box where the red light can’t, therefore one side of the box becomes reddish the other side becomes blueish. The floor of course becomes a mix of the two.
Here’s video that shows it, enjoy!
…and then I said, let there be light! …and there was light!
So after having studied OpenGL shaders a bit in my book, I’ve made another textured cube: this time the texture is a wooden box instead of the OpenGL logo. Also I’ve added lighting using vertex and fragment shaders.
Basically how it works is, there’s a diffuse light source in the scene at -100.0, 100.0, 100.0 and some ambient lighting too ( 30% ambient contribution ). The vertex shader interpolates the texture coordinates, and the diffuse lighting between the vertices for the fragment shader, and then the fragment shader samples the texture at the interpolated coordinates and multiplies the color with ( ambient + diffuse ).
Fairly simple, and yet looks pretty nice imho. So enjoy!