Chef de Rang

 

C# Texture Class for OpenGL

During the development of Nux we needed to start applying textures to the game objects. The texture assets we were given were for the most part PNG and GIF files and were already transparent which potentially meant we wouldn't have to worry about texture masks. This was ideal as we had some 500 textures which could be included and making masks for each would have been rather monotonous.

The texture class came from one of my earlier pieces of work, a version of Space Invaders written in the 2nd year. As it was, bitmaps and jpegs worked fine but any transparency was rendered as black. A quick code tweak to adjust the pixel format fixed the issue and now we could load our textures with no problems!

We were using the Tao Framework for our OpenGL but there shouldn't be any reason why it shouldn't work with any of the other OpenGL for C# libraries.

Download