texture glitches

Apprentice
Posts: 15
Joined: 2009.01
Post: #1
What's going on with this picture? I use a loop to draw the trees as green quads with a texture, the glitches show up mostly for the objects at the end of the loop.

[Image: rmmebq.jpg]
Quote this message in a reply
Moderator
Posts: 3,572
Joined: 2003.06
Post: #2
Looks fine to me, what's the glitch?
Quote this message in a reply
Apprentice
Posts: 15
Joined: 2009.01
Post: #3
the big green line, that's not supposed to be there, it's just a tree
Quote this message in a reply
Moderator
Posts: 3,572
Joined: 2003.06
Post: #4
Well, if they're just quads about the size of the tree then the only way that line could be that size is if you aren't sending the correct vertex coordinates, somehow. If it's at the end of your loop, that's obviously the place to look. You might try printf'ing all the vertex coordinates you're sending for each tree for sanity's sake.
Quote this message in a reply
Apprentice
Posts: 15
Joined: 2009.01
Post: #5
It only happens intermittently, all the vertex and texture coordinates are correct.
Quote this message in a reply
Moderator
Posts: 3,572
Joined: 2003.06
Post: #6
So you printf'd them to find out for absolute certain? Right where you do the draw call?

Whatever the case, if you are really using a quad about the size of a tree, there is no possible way that you could see garbage outside of that quad, unless the GL is getting garbage vertex coordinates. So *somehow* it is getting bad vertices; either via raw numbers, such as a bad pointer or index, or via an inadvertent transform. There could be any number of things occurring ... maybe you could possibly be blowing some hard limit with OpenGL, such as maybe a stack size. Who knows? Are you using an array pointer? Is that array pointer still valid? Does it always look like that green line? Same shape, same vertical orientation? Does it always go all the way across the screen like that?

I'm just going to say that my first *guess* is that you're not giving a valid set of vertices to the last object, probably because of an invalid array access (i.e. you're doing something like referencing index 1000 of a 1000 element array).
Quote this message in a reply
Apprentice
Posts: 15
Joined: 2009.01
Post: #7
yeah I don't know what's up, I use the exact same code to put all the data into an array and draw that way and it works solidly, but if I just draw with glBegin(GL_QUADS) it does that weird glitching.

I guess I should just use arrays for everything from now on.
Quote this message in a reply
Post Reply