depth-buffer

Android OpenGL ES Framebuffer objects - rendering depth-buffer to texture

。_饼干妹妹 提交于 2019-12-18 10:44:53
问题 I am using an Android device running Froyo supporting OpenGL ES 1.1 and OpenGL ES 2.0 I want to render the depth buffer to a texture. Having seen a number of examples for OpenGL, OpenGL ES on other platforms (including iPhone) I have tried a number of FBO configurations. I seem to be able to get an FBO set-up with a colour texture but every time I attach a depth texture it fails. My current code is based on this example but creating a colour texture as well instead of setting draw and read

Writing texture data onto depth buffer

☆樱花仙子☆ 提交于 2019-12-18 03:41:56
问题 I'm trying to implement the technique described at : Compositing Images with Depth. The idea is to use an existing texture (loaded from an image) as a depth mask, to basically fake 3D. The problem I face is that glDrawPixels is not available in OpenglES. Is there a way to accomplish the same thing on the iPhone? 回答1: The depth buffer is more obscured than you think in OpenGL ES; not only is glDrawPixels absent but gl_FragDepth has been removed from GLSL. So you can't write a custom fragment

Android OpenGL 3D picking

倖福魔咒の 提交于 2019-12-18 02:54:50
问题 I'm on Android OpenGL-ES 2.0 and after all the limitations that come with it, I can't figure out how to take 2D screen touches to the 3D points I have. I can't get the right results. I'm trying to implement shooting a ray into the point cloud, which I can then compare distances of my points to the ray, finding the closest point. public class OpenGLRenderer extends Activity implements GLSurfaceView.Renderer { public PointCloud ptCloud; MatrixGrabber mg = new MatrixGrabber(); ... public void

WebGL 3d usage for depth sorting 2d objects

ぃ、小莉子 提交于 2019-12-14 03:59:24
问题 This question has a strong relation with my other question: Isometric rendering without tiles, is that goal reachable? I want to depth sort objects in an isometric world (html5 canvas). The world is not tiled, so every item in the world can be placed on each x, y, z coordinate. Since it's not a tiled world, depth sorting is hard to do. I even want that if items intersect, that the visible parts are drawn as if it were intersecting parts in a fully 3d world. As people answered in my other

opengl depth buffer slow when points have same depth

我只是一个虾纸丫 提交于 2019-12-13 15:09:20
问题 I'm making a 2d game involving drawing huge numbers of overlapping quads to the screen. What goes in front of what doesn't really matter. If I draw each of my quads with z values from 0 upwards and have glDepthFunc(GL_LESS) set I get quite a nice speed boost as you would expect. This is to avoid having to draw quads which are either totally hidden or partially hidden behind other quads. So I draw the quads using something like: float small = (float(1)/1000000); for (int iii = 0; iii < 100000;

32-bit depth buffer in OpenTK GLControl

喜你入骨 提交于 2019-12-13 06:52:25
问题 How to set a number of bits in the depth buffer of GLControl? I've tried this: GLControl glControl = new GLControl( new GraphicsMode( new ColorFormat(8,8,8,8), 32)); and it still gives 24-bit depth buffer. What am I missing? 回答1: Your GPU most likely supports 32bit depth, but not when rendering to the default framebuffer. To obtain a 32bit depth buffer you need to create and render to a framebuffer object. Refer to the following page in the OpenTK documentation: http://www.opentk.com/doc

Java OpenGL saving depth buffer

浪子不回头ぞ 提交于 2019-12-13 06:47:01
问题 I'm not entirely sure if I can do what I want here, but I have a bunch of objects being rendered in OpenGL (using JOGL). For one group of objects, I want to ensure that certain objects in that group are rendered in front of other objects in that group. I've tried clearing the depth buffer bit and rendering the "front" objects last, and that works, except it messes up other depth buffering on screen. What it comes down to is I have a list of objects being rendered and I want to ensure that

Reconstructing world position from linear depth

这一生的挚爱 提交于 2019-12-13 05:12:53
问题 i have issues reconstructing world positions from previously stored linear depth in glsl. I read lots of info online, but can't find my problem... So this is what I got: VS (storing depth to 32F): float linDepth(float z) { return (-z-zNear)/(zFar-zNear); } void main() { vec4 position = uViewMatrix * uModelMatrix * vec4(aPosition, 1); depth = linDepth(position.z); //store linear view-depth } FS (reconstuction): void main() { vec3 vUV = vec2(0..1, 0..1); (from screen aligned quad) vec3 ndc =

Directx 11 depth test not working

断了今生、忘了曾经 提交于 2019-12-13 03:22:02
问题 I cannot get my program to correctly choose which models to place in front. I have followed the MSDN code exactly. My code appears to correctly draw all polygons in a particular call of DrawIndexed, but each subsequent call seems to cause models to be drawn in the order they are drawn, not based on whether they are closer to the screen. Here is my code for initializing Direct3d: DXGI_SWAP_CHAIN_DESC sd; ZeroMemory( &sd, sizeof( sd ) ); sd.BufferCount = 1; sd.BufferDesc.Width = width; sd

Frame Buffer Object (FBO) and Render & Depth Buffers Relation

断了今生、忘了曾经 提交于 2019-12-12 16:24:35
问题 I saw many examples on the web (for example) which do the following Create and Bind FBO Create and Bind BUFFERS (texture, render, depth, stencil) Then, UnBind BUFFERS To work with FBO- Bind FBO, do the work then UnBind FBO However, also Bind texture BUFFER for read, write etc. with texture BUFFER BUT NEVER EVER SEEN re-Bind of other BUFFERS (render, depth, stencil), Why? Example of BUFFERS creation and bind/unbind (Below code is just for example only to show what I explained and works