• entries
455
639
• views
424495

# TLM : In what scientist are calling 'pretty gay'..

103 views

So, it was wednesday, I was in my pointless Java 2D lesson because I've nothing else todo with my wednesday nights and I enjoying swaning around the place like god... hey, I take the ego trips where I can alright?

At one point Andrew, my course leader type, who watches over this module, said to me 'I assume you've got your TLM simulation work with some nice output?'.
There was a pause where I weighted up my two options;
1 - 'no, not as yet'
2 - 'yeah, it's no problem...'

Now, 1 would have earned me a disappointed look and some comments about not much time left, 2 on the other hand gets me off free and I just have to fake it a bit if questions are asked... [grin]

So, I totally went for option 2, bluffed it and came home thinking 'ah poo, I should really get this done'.

Sunday rolls around, I figure it's this or the 2D game thing and as I didn't fancy the Java I hit the code at about 3pm or so.

The code infact compiled and ran first time, huzzah!
And I thought I'd pulled it off, sure no driving data, but with a stable TLM simulation it was maintaining zero state...

Turns out I was wrong, once I did some minor debug to get something on screen I noticed it was wrong, plotting it to the colour channel showed that I had half a quad of red and half of black; it should have been all black.

The next 4h or so is spent trying to track the problem down, everything is tried from default init-ing things to 1.0f, checking clamp values, not running the sim and even removing the copy as I thought that was going wrong and I was only getting half the data or something.

Having confirmed all my textures were blank and I was definately setting a VBO to 1.0f and STILL seeing the same pattern I decided the data can't be getting into the shader right, and while I knew my attribute indices were sane at resource gathering I couldn't confirm at render time, so I went to check... and that's when I noticed IT.

A game of spot the difference follows;
if(heightStream_ > -1){	glBindBuffer(GL_ARRAY_BUFFER, heightMap_);	glEnableVertexAttribArray(heightStream_);	glVertexAttribPointer(heightStream_,4,GL_FLOAT,GL_FALSE,0,NULL );}

if(heightStream_ > -1){	glBindBuffer(GL_ARRAY_BUFFER, heightBuffer_);	glEnableVertexAttribArray(heightStream_);	glVertexAttribPointer(heightStream_,4,GL_FLOAT,GL_FALSE,0,NULL );}

The second snippet it right. [tears]

Yes, FOUR hours of debug work all because I'd used the wrong bloody var.

To quote my most recent SVN commit comment;
Quote:
 TLMFullShader sequence works without driving data. Remind me to use better names than 'buffer' and 'map' in future for things, apprently my brain isn't good enuff to notice the difference :(

However, the good news is that, pending any other stupidness, the TLM sim should now work properly once I give it some driving data.

Right now however, I'm going to go shoot myself a few times as I deserve it.

## 1 Comment

Quote:
 Yes, FOUR hours of debug work all because I'd used the wrong bloody var.

i know what u mean ive suffered the same hairpulling numerous times, personally i believe all this crap should get picked up at compile time.

its not so bad as flash, for the last month ive been working with it, theyve dumbed down the lang so much that when u make a mistake its hard to track down something when it does go wrong
ie (dont know if u know flash)
but i can type

function main()
{
this_fuckin_function_doesnt_exist();
}

no probs, doesnt balk that the function is nonexistant (no warnings nothing)
its like a yes man, will always tell u yes youre doing great when youre perched on the edge of a cliff about to apply your foot to the gas

## Create an account

Register a new account