![]() ![]() ![]() In order not to lose quite a lot of precision, it's probably more helpful to split the value between components, as your vendor almost certainly doesn't support floating point target buffers. Use OpenGL ES functions to read shader compile or link logs only in development builds of your app, as shown in Listing 10-1. Because you're in window coordinates, intensity will range from 0.0 (closest possible unclipped fragment) to 1.0 (farthest possible unclipped fragment). OpenGL ES 2.0 render to framebuffer/texture results in black texture Ask Question Asked 7 years, 7 months ago Modified 7 years, 7 months ago Viewed 1k times 0 I'm using libgdx but this is pretty much vanilla opengl es 2.0 stuff. You should get a greyscale with the intensity of the colour representing depth. just gl_FragColor = vec4(vec3(gl_FragCoord.z), 1.0) To convince yourself, try writing a quick shader that puts gl_FragCoord.z out hastily in low precision, e.g. Alternatively, you can load world-space z as a varying and write that from your fragment shader, in case that's an easier way around. If you're in ES 2.0, your fragment shader can access the current fragment's depth (in window coordinates) as part of gl_FragCoord, so you can write that to the colour buffer, use glReadPixels to get the result back and proceed. ![]() Using an FBO, you can render without displaying the results. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |