Sunday, May 23, 2010

Adrian has been receiving a face lift with fancy glsl opengl stuff. Now I've seen good number of problems with using the GLSL shaders. But what i found today was a little more annoying. So today i thought i'd update the display drivers to a latest version because its' been a while and it's always good to have the latest ones... because all the other users might be using them. Now Adrian which was working fine starting showing a colored screen instead of the actual game, I was shocked because i haven't changed anything but a working code stopped working now.

Apparently iv'e assumed something that i shouldn't have.. see.. the vertex shader that we use has a line which goes something like this:

gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;

This looks fine.. if we dont' set the texture matrix, it should ideally be and identity matrix .. or so i thought. Any way... Now .. after digging through all the code.. making modifications everywhere i could think off.. I finally figured .. i just had to get rid of the gl_TextureMatrix[0].. from the above line. Now i know i shouldn't be using it if im' not initializing it.. but cmon!! it worked before what happened now?. Is it defined somewhere that the default texture matrix is not ensured to be an Identity matrix?..

Sunday, May 09, 2010

I know OpenGL2.0 has been out for a while now and i have been developing small example programs for learning purpose, But I've been putting off developing using OpenGL2.0 (GLSL) etc because I wasn't sure if people would be able to play them because of hardware issues. I wanted to develop a game which used OpenGL2.0 features. I wanted to try it out for Last PyWeek but most of the people participating did not have compatible graphics hardware so i scraped that idea. But after having looked at a couple of game engine related blog posts at http://blog.wolfire.com/, I decided i have to write a game with Graphics Engine using GLSL shaders.

So Instead of writing from scratch, I thought it would be best if I tried out on an already developed game and "Adrian" was the obvious choice. We have been updating the game since last year during our free time (yes.... this isn't a solo effort... ) and so updating graphics engine came up. I wanted to start small and so started off with the implementation of Post-Processing pipeline for the game engine. Here are the results..

Saturday, May 08, 2010

I've been working on updating our good old game "Adrian". Trying to update the graphics engine to use shaders, frame buffers and all that stuff. Actually the other day i found a wonderful game dev blog which discussed various graphics engine tweaks, implementations etc. I've been eager to work on something with shaders.. thought Adrian might be the best bet. So i quickly started writing some basic code for handling multiple pass rendering and some basic code for handling frame buffer objects etc. I've read a lot about glsl .. even done some examples (simple ones) before so i did not think it would hard to get stuff running.. boy was i wrong.. I struggled to get multiple textures to work in my shaders.. and the reason?.. well let me put it in code...

now the most obscure stuff is setting the sampler handle values to 0, 1, .. corresponding to the texture you bind it to..(GL_TEXTURE0, 1.. ) instead of the texture id itself.. and now most ridiculously frustrating part.. you need to call glUseProgram(program) before you can set these variables. Most people got the other stuff wrong.. but i was stuck with this problem for like 12hrs or so... actually i just figured out about this problem and thought i should document it somewhere before i forget it again.. so there you go.. if you want to tread in the glsl waters.. you better be careful.. they are very .very.. weird.. :D