Sign in to follow this  
Tchom

OpenGL ES 2.0: Weird artifact renderering plane

Recommended Posts

Tchom    197

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?

Share this post


Link to post
Share on other sites
frob    44911
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.

Share this post


Link to post
Share on other sites
Tchom    197

@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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this