Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

104 Neutral

About zenux

  • Rank
  1. Ok, thank you. I've just seen that it's maybe possible to have something better with texture 2d array and gl_Layer. I will try it.
  2. Sorry, I haven't good screenshot of my shadow map. I have seen after debug session that the last object drawn is always visible on my shadow maps no matter his depth value. If I sort my objects by depth value (from the further to the nearest): I haven't problem anymore. No, I haven't GL_DEPTH_ATTACHMENT on my FBO for two reasons: * I have already several depth buffers (see my first post). * What OpenGL will write in GL_DEPTH_ATTACHMENT ? A common depth buffer will be wrote for all vertex emitted by the geometry shader ? I need different depth buffer: http://http.developer.nvidia.com/GPUGems3/elementLinks/10fig11.jpg
  3. Thanks FXACE for your help. I have try your source code but it's not working as I expected. I get exactly the same value that gl_FragCoord.z: no depth test (GL_LESS) are applied on this value
  4. @FXACE: sorry but I don't understand your solution. First, I think the built-in variable "gl_TexCoord" doesn't exist anymore since OpenGL 3.0, no ? Then, the variable gl_Position doesn't contain the right value because OpenGL has not done the depth test yet in vertex/geometry shader, no ? @dpadam450: I don't write gl_FragDepth. I read the value.
  5. Thanks for your reply. I have tried to execute "glDepthMask(GL_TRUE);" and "glEnable(GL_DEPTH_TEST);" just before draw objects to be sure but I still have the problem.
  6. Hello, I need to create several depth buffer (for each vertex emitted by a geometry shader) on my FBO. Here the source code: glBindFramebuffer(GL_FRAMEBUFFER, fboID); //depth buffer 1 glTexImage2D( GL_TEXTURE_2D, 0, GL_R32F, shadowMapResolution, shadowMapResolution, 0, GL_RED, GL_FLOAT, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureID, 0); //depth buffer2 //.... In fragment shader, I have: layout (location = 0) out float fragDepth; void main() { fragDepth = gl_FragCoord.z / gl_FragCoord.w; } Problem: the depth value is well written in my texture but the value is not right. Indeed, it seems that the value has not been affected by the depth test function: glDepthFunc(GL_LESS). What can I do to solve this problem ? Thank you in advance.
  7. zenux

    Write multi depth buffer

    I have tested all possiblities with the GL_DEPTH_COMPONENT* and nothing works. I suppose that it's not a float used behind GL_DEPTH_COMPONENT. If it's the case: why is not a float ? There is maybe a better encoding for depth values ? I didn't know the existance GL_R32F. I have tested and it works. Thank you.
  8. zenux

    Write multi depth buffer

    Thank you for your reply. I already tested your solution. I have also tested with "fragDepth=1.0" and I don't get the expected behavior. I have tested with a texture GL_RGBA where I put the depth value on one of the component. It works but only 1/4 of the texture is used. Which kind of texture format can I use to store the depth value on 32 bits ?
  9. Hi, I would like write in several depth buffers for each vertex emitted by my geometry shader. I have create a FBO and I attach several color textures on it. Here a sample of the first one: glTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, width, heigh, 0, GL_DEPTH_COMPONENT, GL_FLOAT, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureID0, 0); In my fragment shader, I try to write in the first depth buffer: #version 330 layout (location = 0) out float fragDepth; void main() { fragDepth = gl_FragCoord.z; } Unfortunatly, it doesn't work. I guess, it's because the float should be convert it in GL_DEPTH_COMPONENT. How I can do that ? Thank you in advance.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!