Questions tagged [stencil-buffer]

The stencil buffer is a concept implemented in various 3D graphics APIs used for performing "stencil" operations, used to minimize rasterization of hidden pixels or to implement various effects.

Resources:

202 questions
2
votes
1 answer

OpenGL ES Stencil Buffer not working on specific devices

I'm using OpenGL ES 2.0, and using a Stencil Buffer. Below is code from a simple Stencil Buffer Demo I made. The Stenciling is only works properly on one device. Devices are as follows: Android 4.2.2, PowerVR SGX 544MP (GPU), Allwinner A10 tablet.…
user2934090
  • 133
  • 2
  • 13
2
votes
2 answers

OpenGL Stencil Buffer, how well supported are they?

How commonly supported is the Stencil Buffer right now by hardware in OpenGL? Is it better/worse supported than shaders? If the hardware doesn't support it, will it be emulated in software? I haven't been able to find any hard data on the…
Anne Quinn
  • 12,609
  • 8
  • 54
  • 101
2
votes
2 answers

Render off screen (with FBO and RenderBuffer) and pixel transfer of color, depth, stencil

I'have to render off screen in OpenGL and then pass the image to a QImage. Plus, just for exercise I'd like to transfer to the CPU also the depth and the stencil buffer. For drawing offscreen I've used Frame Buffer Object with Render Buffer (and not…
nkint
  • 11,513
  • 31
  • 103
  • 174
2
votes
1 answer

How to do "AND" stencil in OpenGL?

I have a scene rendered, and I'm doing some post-processing that takes place only on a portion of the screen. I use a sphere to "cut" the area, but I get the "full" sphere, whereas I would need "AND" cut of the surfaces that are inside the sphere.…
manabreak
  • 5,415
  • 7
  • 39
  • 96
2
votes
0 answers

glColorMask/glDepthMask vs fragment shader

In OpenGL ES 2.0, if writes to the color buffer and depth buffer are disabled with glColorMask/glDepthMask (because I only want to change the stencil buffer), there are no buffers the fragment shader could write anything to. Can I reasonably assume…
dietr
  • 1,238
  • 11
  • 24
2
votes
1 answer

opengl: why the shadow disappear when i stand in the shadow?

if i don't stand in the shadow,the shadow effect look perfect.but when i'm in the shadow,the shadow is gone.I don't why? here is my code to realize the shadow effect. void CastShadow(SECTOR &sec, float *lp) {//lp is the relative position to the…
nomorefancy
  • 113
  • 7
1
vote
3 answers

Error when attaching depth/stencil buffer to the framebuffer

I create a depth/stencil buffer by issuing this series of command to OpenGL: glBindTexture(GL_TEXTURE_2D, 0) glGenTextures(1, &TextureId) glBindTexture(GL_TEXTURE_2D, TextureId) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,…
qdii
  • 12,505
  • 10
  • 59
  • 116
1
vote
1 answer

Draw Text with stencil buffer

I set up the stencil buffer so only parts of the screen are affected by draw calls. Specifically, I want to draw into a small area. It will become an UI, so everything drawn will be some kind of 2D sprite. Using the sprite object works very well.…
Nico Schertler
  • 32,049
  • 4
  • 39
  • 70
1
vote
1 answer

Does iOS5 support both GL_STENCIL_INDEX and GL_STENCIL_INDEX8?

With the following code: GLuint viewRenderbuffer, viewFramebuffer, viewDepthbuffer, stencilBuffer; // Create the framebuffer object glGenFramebuffers(1, &viewFramebuffer); glBindFramebuffer(GL_FRAMEBUFFER, viewFramebuffer); // Create a render…
Stéphane Péchard
  • 2,013
  • 3
  • 22
  • 35
1
vote
1 answer

Can I solve this OpenGL problem with the depth/stencil buffers

I'm trying to render meshes with the points and edges as black lines and points, similar to a modeling engine like blender. I have 3 separate draw routines to draw points, lines, and faces (each face is one or more triangles with a shared normal).…
BENG
  • 143
  • 4
1
vote
1 answer

Creating Hole in object using ThreeJS and Stencil method

I am trying to make a hole in a solid object(box) using stencil method in ThreeJS. I found few web pages and similar questions on the net in this regard but couldn't work them out. Specifically This link is what I want to achieve(even one hole is…
ali
  • 529
  • 4
  • 26
1
vote
1 answer

pyglet stencil test on Mac OS

I am trying to use a stencil test to clip and create borders for 2d content, but it does not seem to work. It might be a platform issue, I am running the code on a M1 MacBook Air with MacOS 12.0.1 From the code below I would expect a blue square…
Daniele Bernardini
  • 1,516
  • 1
  • 12
  • 29
1
vote
1 answer

Is stencil command on Unity used only for making pixels invisible or is it more?

I want to have an object which is greyed out (grayscale) when it is inside a specific mesh. For now, I have followed some videos and used the stencil command in shader to make it invisible inside (or outside) the mesh but this is not what I quite…
Masea
  • 103
  • 2
  • 10
1
vote
2 answers

LibGDX / OpenGL Stencil Buffer masking not working

I'm using LibGDX to render 2d fog-of-war type functionality. This involves drawing a dark rectangle over the entire map with transparent holes in it where you can see the map below. I'm attempting to use OpenGl stencil buffer to create the circular…
The Shoe Shiner
  • 697
  • 4
  • 20
1
vote
0 answers

threejs and stencil buffer used as a mask

I cannot get the stencil buffer to work with threejs. can someone please explain to me what I need to changed. The yellow plane is to be used as a mask and we should only see the green plane where it overlaps the yellow plane. The example on threejs…