Shaders, Shaders, Shaders…


Long time no post… Have been busy finishing my degree and dealing with some non college related work, getting hyped for the day I get my bachelor degree and start a new life chapter!

Anyway, just a quick update with something I did today, I’m learning OpenGL 3.3 shaders in a subject, which is something I was looking forward to learn for some time. Monday’s class was about texturing and the final exercise was to create a multi textured crate with an ugly snow flake on it & diffuse + specular illumination. After the multi textured crate was done, had to mess it up a little, just for the fun of it:


First milestone, blah


Final result

– Triple multitexture with linear blending

– Alpha attenuation in moss layer

– Ambient + Diffuse + Specular lighting

The cake image is from Borgore – Decisions marketing stuff, all rights reserved to Borgore and his awesomeness.

One problem I struggled while implementing this was that I had an uniform in the shaders named very similarly but not the exact same as the location I was querying OpenGL in my application. When dealing with textures this is something you will only have a problem when you try to sample two different textures in the same shader program. And why is that? Because by default, when you run glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, texture1);, without setting the uniform, OpenGL will propagate texture1 to all the samplers in your shader, therefore, if you only want one, there will be no problem at all… Always learning!

That’s all for today, but don’t forget:



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s