Tagged Questions
5
votes
1answer
92 views
Slow glReadPixels
I have implemented a lense flare for my game, and it looks great.
The first draft used individual sprites each with its own draw call. This was very slow, so I reengineered it to use a single draw ...
2
votes
2answers
59 views
How scanline rendering finds an intersection with an object
I'm a newbie with graphics and after I read many articles on the web I still don't understand how in rasterizing from a pixel coordinate like (0;0) on the screen the intersection with an object (let's ...
1
vote
2answers
107 views
How to clear a buffer to 1.0 instead of 0.0 in OpenGL?
Using glClear() you can set the buffer specified by the parameter to 0.0. This is useful say if you want pixels not covered by models to be black. Because vec3(0.0, 0.0, 0.0) results in black.
But ...
1
vote
0answers
81 views
How do you display non-cutout transparent 2D textures with a depth buffer? (OpenGL)
I've been able to get my 2D renderer to display transparent cutout textures by testing the alpha of a fragment and discarding if it is less than 1 (or any fraction really). The problem is I want to ...
0
votes
2answers
215 views
GLSL light coloring blocked surfaces
I have created a very simple lighting shader. It currently only supports point lights, but it lights up surfaces that are completely blocked from the light. I know why, but I want to know how I can ...
4
votes
1answer
379 views
Can I use the default depth buffer when drawing to FBO?
How to attach default depth buffer to FBO?
How to use depth renderbuffer buffer attached to FBO (after drawing to it) as a default depth buffer?
Basically I want to use the same depth buffer for both ...
3
votes
1answer
700 views
Renderbuffer to GLSL shader?
I have a software that performs volume rendering through a raycasting approach. The actual raycasting shader writes the raycasted volume depth into a framebuffer object, through gl_FragDepth, that I ...
3
votes
1answer
386 views
The Depth buffer and Perspective
I'm having trouble understanding the behaviour of my OpenGL program; and in drawing my Z-Buffer out to the screen.
It will probably be best to just start with code, here is my GLSL shader:
in vec3 ...
3
votes
2answers
1k views
computing gl_FragDepth
I am trying to draw spheres using a billboard, so I have a normal map with a z component that I am sampling in my fragment shader. I just need to add this z component to the depth of my fragment to ...
3
votes
0answers
690 views
Sampling from depth texture causes shader to stop working
I'm currently having issues with depth textures. When I sample from a depth texture it causes my other samplers to fail. For example, when I set gl_FragColor manually the depth buffer is correct. I ...
2
votes
1answer
363 views
Writing the correct value in the depth buffer when using ray-casting
I am doing a ray-casting in a 3d texture until I hit a correct value. I am doing the ray-casting in a cube and the cube corners are already in world coordinates so I don't have to multiply the ...
7
votes
2answers
4k views
How do I use depth testing and texture transparency together in my 2.5D world?
Note: I've already found an answer (which I will post after this question) - I was just wondering if I was doing it right, or if there is a better way.
I'm making a "2.5D" isometric game using OpenGL ...
4
votes
2answers
2k views
In OpenGL Can I Discover the Depth Range of a Depth Buffer?
I am doing a GL multi-pass rendering app for iOS. The first pass renders to a depthbuffer texture. The second pass uses the values in the depth buffer to control the application of a fragment shader. ...