OpenGL ES 2.0: Weird artifact renderering plane

Started by
1 comment, last by Tchom 10 years, 11 months ago

I'm trying to render a basic plane and I'm having a pretty bad time. I render the square ant it draws, but it also seems to draw a giant half-cube on top of it.

Y2mBAmt.png

Is there any obvious mistake I'm making that might be responsible for this?

Advertisement
Sadly it could be lots of things.

Check your data. Are you really just going over the points you think you are?

Check your code. Step through each line, are there any extra draw calls? Any extra transformations?

Check your shaders, if any, for the same things.


Writing an rendering engine is tricky and math-intensive. Sometimes you create a subtle bug and the world explodes and you can't figure out why. Or the world becomes black and you can't figure out why. Or even worse, sometimes you don't notice anything at all is wrong and then suddenly the engine falls apart because of a graphical glitch written months earlier.

It is generally best to go with an existing rendering engine unless this is a learning experiment for you.

@frob

Thanks for the advice. I'm very quickly learning that debugging rendering code is very different to other kinds of debugging. I'm working on this for a hobby project, so I'm enjoying the challenge and the smug sense of self-satisfaction that comes with owning your own engine.

I found the bug and believe it or not, it was my own carelessness. Turns out I was passing the wrong number of indices into my "GLES20.glDrawArrays" call.

This topic is closed to new replies.

Advertisement