Little Endian
Little Endian

Reputation: 830

What happened to glDepthRange in OpenGL ES 2.0 for iOS?

I used glDepthRange(1.0, 0.0) in a Mac OS X program to give myself a right-handed coordinate system. Apparently I don't have that option with iOS using OpenGL ES 2.0. Is there a quick fix so that higher z-values show up in front, or do I have to rework all of my math?

Upvotes: 0

Views: 1528

Answers (1)

DanP
DanP

Reputation: 187

well you can try glDepthFunc. the default value is GL_LESS, if you use GL_GREATER, pixels with higher z values will be rendered.

glDepthFunc(GL_GREATER);

alternatively, you can add this line on your vertex shader

gl_Position.z = -gl_Position.z;

Upvotes: 3

Related Questions