Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualJosh Petrie

Posted 22 July 2013 - 10:27 AM

Hello, I'm trying to implement the early depth pass that is often mentioned but it is not working as described.  *update* I'd like to use the shadow pass for both but I have now just realized after posting that the depth is being written to an FBO and this seems likely to be the issue.   *UPDATE_2* I disabled the FBO and the results are the same, nothing is rendered. Everything works fine until I get to the part where the depth configuration code is set for the color writes.     The following is how I'm initializing the depth texture,  it is pretty much verbatim from the PowerVR SDK and works for Windows, iOS, and also through the WINE emulator. 

 

//===================================================================================================
glGenTextures(1, &m_uiShadowMapTexture);
glBindTexture(GL_TEXTURE_2D, m_uiShadowMapTexture);
 
//-------------------------------------------------
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, (GLsizei)viewWidth, (GLsizei)viewHeight, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
 
//------------------------------------------------------------------
glGenFramebuffers(1, &m_uiFrameBufferObject);
glBindFramebuffer(GL_FRAMEBUFFER, m_uiFrameBufferObject);
//---------------------
#ifdef WIN32 glDrawBuffer(GL_NONE);
//_ON_SOME_MACHINES_THIS_IS_REQUIRED / ON_SOME_IT_FAILS
glReadBuffer(GL_NONE);
//_SAME_AS_ABOVE
#endif
 
//---------------------
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_uiShadowMapTexture, 0);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
//====================================================================================================
 
This next part works fine when I render the depth models to a texture
 
//====================================================================================================
glEnable(GL_DEPTH_TEST);
 
glEnable(GL_DEPTH_TEST);
glDepthMask(1);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
glDepthFunc(GL_LESS);
glBindFramebuffer(GL_FRAMEBUFFER, m_uiFrameBufferObject);
 
//draw calls....
//==========================================================================
 
Next comes the part where things fail.
 
//==========================================================================
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glDepthMask(0);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glDepthFunc(GL_EQUAL);
//==========================================================================  

 

The glDepthMask() and glDepthFunc() both cause the screen to go blank.  Any thoughts on this? Help on this matter would be much appreciated.   Also, how should the       glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); line be setup.  Should GL_DEPTH_BUFFER_BIT be included since we are trying to use the information already stored instead of clearing it?


#7Josh Petrie

Posted 22 July 2013 - 10:24 AM

Hello, I'm trying to implement the early depth pass that is often mentioned but it is not working as described.  *update* I'd like to use the shadow pass for both but I have now just realized after posting that the depth is being written to an FBO and this seems likely to be the issue.   *UPDATE_2* I disabled the FBO and the results are the same, nothing is rendered. Everything works fine until I get to the part where the depth configuration code is set for the color writes.     The following is how I'm initializing the depth texture,  it is pretty much verbatim from the PowerVR SDK and works for Windows, iOS, and also through the WINE emulator.   //=================================================================================================== glGenTextures(1, &m_uiShadowMapTexture); glBindTexture(GL_TEXTURE_2D, m_uiShadowMapTexture); //------------------------------------------------- glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, (GLsizei)viewWidth, (GLsizei)viewHeight, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); //------------------------------------------------------------------ glGenFramebuffers(1, &m_uiFrameBufferObject); glBindFramebuffer(GL_FRAMEBUFFER, m_uiFrameBufferObject); //--------------------- #ifdef WIN32 glDrawBuffer(GL_NONE);//_ON_SOME_MACHINES_THIS_IS_REQUIRED / ON_SOME_IT_FAILS glReadBuffer(GL_NONE);//_SAME_AS_ABOVE #endif //--------------------- glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_uiShadowMapTexture, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0); //====================================================================================================   This next part works fine when I render the depth models to a texture   //==================================================================================================== glEnable(GL_DEPTH_TEST);         glEnable(GL_DEPTH_TEST);         glDepthMask(1);         glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);          glDepthFunc(GL_LESS);                 glBindFramebuffer(GL_FRAMEBUFFER, m_uiFrameBufferObject);     //draw calls....   //========================================================================== Next comes the part where things fail. //==========================================================================                             glBindFramebuffer(GL_FRAMEBUFFER, 0);             glDepthMask(0);         glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);          glDepthFunc(GL_EQUAL); //==========================================================================   The glDepthMask() and glDepthFunc() both cause the screen to go blank.  Any thoughts on this? Help on this matter would be much appreciated.   Also, how should the       glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); line be setup.  Should GL_DEPTH_BUFFER_BIT be included since we are trying to use the information already stored instead of clearing it?


#6marcClintDion

Posted 22 July 2013 - 03:15 AM

There is far too much arrogance and out right abuse by site moderators, they are teaching other people to behave this way.  The posts I've made will all be shorty removed and replaced with this notice.  Game development is not the only thing being taught here, bad behavior is being taught as well.


#5marcClintDion

Posted 14 June 2013 - 04:07 AM

Hello, I'm trying to implement the early depth pass that is often mentioned but it is not working as described.  *update* I'd like to use the shadow pass for both but I have now just realized after posting that the depth is being written to an FBO and this seems likely to be the issue.  
*UPDATE_2* I disabled the FBO and the results are the same, nothing is rendered.

Everything works fine until I get to the part where the depth configuration code is set for the color writes.  
 
The following is how I'm initializing the depth texture,  it is pretty much verbatim from the PowerVR SDK and works for Windows, iOS, and also through the WINE emulator.

 
//===================================================================================================
glGenTextures(1, &m_uiShadowMapTexture);
glBindTexture(GL_TEXTURE_2D, m_uiShadowMapTexture);
//-------------------------------------------------
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, (GLsizei)viewWidth, (GLsizei)viewHeight, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//------------------------------------------------------------------
glGenFramebuffers(1, &m_uiFrameBufferObject);
glBindFramebuffer(GL_FRAMEBUFFER, m_uiFrameBufferObject);
//---------------------
#ifdef WIN32
glDrawBuffer(GL_NONE);//_ON_SOME_MACHINES_THIS_IS_REQUIRED / ON_SOME_IT_FAILS
glReadBuffer(GL_NONE);//_SAME_AS_ABOVE
#endif
//---------------------
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_uiShadowMapTexture, 0);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
//====================================================================================================
 
This next part works fine when I render the depth models to a texture
 
//====================================================================================================
glEnable(GL_DEPTH_TEST);
        glEnable(GL_DEPTH_TEST);
        glDepthMask(1);
        glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); 
        glDepthFunc(GL_LESS);
      
      
        glBindFramebuffer(GL_FRAMEBUFFER, m_uiFrameBufferObject);
 
 
//draw calls....
 
//==========================================================================
Next comes the part where things fail.
//==========================================================================
                      
        glBindFramebuffer(GL_FRAMEBUFFER, 0);
 
 
        glDepthMask(0);
        glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 
        glDepthFunc(GL_EQUAL);
//==========================================================================
 
The glDepthMask() and glDepthFunc() both cause the screen to go blank.  Any thoughts on this? Help on this matter would be much appreciated.
 
Also, how should the         glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
line be setup.  Should GL_DEPTH_BUFFER_BIT be included since we are trying to use the information already stored instead of clearing it?
 


#4marcClintDion

Posted 14 June 2013 - 04:07 AM

Hello, I'm trying to implement the early depth pass that is often mentioned but it is not working as described.  *update* I'd like to use the shadow pass for both but I have now just realized after posting that the depth is being written to an FBO and this seems likely to be the issue.  
*UPDATE_2* I disabled the FBO and the results are the same, nothing is rendered, same as before.

Everything works fine until I get to the part where the depth configuration code is set for the color writes.  
 
The following is how I'm initializing the depth texture,  it is pretty much verbatim from the PowerVR SDK and works for Windows, iOS, and also through the WINE emulator.

 
//===================================================================================================
glGenTextures(1, &m_uiShadowMapTexture);
glBindTexture(GL_TEXTURE_2D, m_uiShadowMapTexture);
//-------------------------------------------------
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, (GLsizei)viewWidth, (GLsizei)viewHeight, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//------------------------------------------------------------------
glGenFramebuffers(1, &m_uiFrameBufferObject);
glBindFramebuffer(GL_FRAMEBUFFER, m_uiFrameBufferObject);
//---------------------
#ifdef WIN32
glDrawBuffer(GL_NONE);//_ON_SOME_MACHINES_THIS_IS_REQUIRED / ON_SOME_IT_FAILS
glReadBuffer(GL_NONE);//_SAME_AS_ABOVE
#endif
//---------------------
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_uiShadowMapTexture, 0);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
//====================================================================================================
 
This next part works fine when I render the depth models to a texture
 
//====================================================================================================
glEnable(GL_DEPTH_TEST);
        glEnable(GL_DEPTH_TEST);
        glDepthMask(1);
        glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); 
        glDepthFunc(GL_LESS);
      
      
        glBindFramebuffer(GL_FRAMEBUFFER, m_uiFrameBufferObject);
 
 
//draw calls....
 
//==========================================================================
Next comes the part where things fail.
//==========================================================================
                      
        glBindFramebuffer(GL_FRAMEBUFFER, 0);
 
 
        glDepthMask(0);
        glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 
        glDepthFunc(GL_EQUAL);
//==========================================================================
 
The glDepthMask() and glDepthFunc() both cause the screen to go blank.  Any thoughts on this? Help on this matter would be much appreciated.
 
Also, how should the         glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
line be setup.  Should GL_DEPTH_BUFFER_BIT be included since we are trying to use the information already stored instead of clearing it?
 


#3marcClintDion

Posted 14 June 2013 - 03:59 AM

Hello, I'm trying to implement the early depth pass that is often mentioned but it is not working as described.  *update* I'd like to use the shadow pass for both but I have now just realized after posting that the depth is being written to an FBO and this seems likely to be the issue.  

 

Everything works fine until I get to the part where the depth configuration code is set for the color writes.  
 
The following is how I'm initializing the depth texture,  it is pretty much verbatim from the PowerVR SDK and works for Windows, iOS, and also through the WINE emulator.

 
//===================================================================================================
glGenTextures(1, &m_uiShadowMapTexture);
glBindTexture(GL_TEXTURE_2D, m_uiShadowMapTexture);
//-------------------------------------------------
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, (GLsizei)viewWidth, (GLsizei)viewHeight, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//------------------------------------------------------------------
glGenFramebuffers(1, &m_uiFrameBufferObject);
glBindFramebuffer(GL_FRAMEBUFFER, m_uiFrameBufferObject);
//---------------------
#ifdef WIN32
glDrawBuffer(GL_NONE);//_ON_SOME_MACHINES_THIS_IS_REQUIRED / ON_SOME_IT_FAILS
glReadBuffer(GL_NONE);//_SAME_AS_ABOVE
#endif
//---------------------
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_uiShadowMapTexture, 0);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
//====================================================================================================

 

This next part works fine when I render the depth models to a texture

 

//====================================================================================================

glEnable(GL_DEPTH_TEST);
        glEnable(GL_DEPTH_TEST);
        glDepthMask(1);
        glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); 
        glDepthFunc(GL_LESS);
      
      
        glBindFramebuffer(GL_FRAMEBUFFER, m_uiFrameBufferObject);
 
 
//draw calls....
 
//==========================================================================
Next comes the part where things fail.
//==========================================================================
                      
        glBindFramebuffer(GL_FRAMEBUFFER, 0);
 
 
        glDepthMask(0);
        glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 
        glDepthFunc(GL_EQUAL);
//==========================================================================
 
The glDepthMask() and glDepthFunc() both cause the screen to go blank.  Any thoughts on this? Help on this matter would be much appreciated.
 
Also, how should the         glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
line be setup.  Should GL_DEPTH_BUFFER_BIT be included since we are trying to use the information already stored instead of clearing it?
 
*UPDATE_2* I disabled the FBO and the results are the same, nothing is rendered, same as before.

PARTNERS