Skip to content

Instantly share code, notes, and snippets.

@ofTheo
Created May 24, 2012 20:27
Show Gist options
  • Save ofTheo/2784008 to your computer and use it in GitHub Desktop.
Save ofTheo/2784008 to your computer and use it in GitHub Desktop.
if( settings.useDepth ){
if(settings.depthAsTexture){ //depth as a texture - possibly stencil also.
//TODO: add depthAsTexture support for iOS / Android
#ifndef TARGET_OPENGLES
GLuint attachment;
depthBufferTex.texData.textureTarget = settings.textureTarget;
if( settings.useStencil ){
attachment = GL_DEPTH_STENCIL_ATTACHMENT;
depthBufferTex.texData.glTypeInternal = GL_DEPTH24_STENCIL8_EXT;
depthBufferTex.texData.glType = GL_DEPTH_STENCIL_EXT;
depthBufferTex.texData.pixelType = GL_UNSIGNED_INT_24_8_EXT;
}else{
GLint depthPixelType = GL_UNSIGNED_BYTE;
if(settings.depthInternalFormat==GL_DEPTH_COMPONENT){
depthPixelType = GL_UNSIGNED_BYTE;
}else if(settings.depthInternalFormat==GL_DEPTH_COMPONENT16){
depthPixelType = GL_UNSIGNED_SHORT;
}else if(settings.depthInternalFormat==GL_DEPTH_COMPONENT24){
depthPixelType = GL_UNSIGNED_INT;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment