Question

So basicly I am creating a 2D game. I am using VBOs and GLSL Shaders. Now what I do is that every texture I load, I create a VBO for it, so every drawable object that uses that texture it's elements will be inserted into that VBO. So a while ago I was trying to create a grid like object by creating a lot of small boxes and positioning them next to each other. They were all in the same VBO because they all had the same texture to create the grid like object. Once they got like over 10 or so, they started having weird artifacts.

So I by-passed this by creating one big drawable and repeating the texture over it multiple times. The artifacts were gone. Now I started doing text mapping (Each letter is an instance but they share the same texture, text map) and I have noticed when I go over 6 letters artifacts start to appear. I have no idea why this is happening I dont have even a lead.

So I was wondering if anyone has a clue to what might be causing this problem..

Note: I noticed also that in my lighting system (same texture but different RGB values) that if I put two lights too close to each other, that they intersect after like 3 the artifacts start. This might be the caus, because the text actually intersects due to padding.. How can I fix 2 textures that intersect and use the same texture that caus artifacts?

Edit: ^^^ Never mind that I removed the padding and the artifacts were still there..

Was it helpful?

Solution

Solved. The problem was that in glDrawElements 2nd argument I was passing in a number that was larger than the actual amount of indexes I had, so OpenGL was trying to render extra triangles.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top