Skip to main content
gamedev.net
🔒 Locked

Texture / Blending question

Started by cmor 1 reply 900+ views
Original Post
cmor
cmor
Hi, I got the following problem / question: I want to map a 2D texture on a tesselated concave 2D polygon (a circle with "holes" in it) in a way that the texture covers only the (solid white) polygon and does not get scaled / distorted when the outline of the circle changes. (I tried mapping the texture on a rectangular triangle strip with a lower z-value, but that doesn't seem to work. If I specify texture coordinates for the outline of the circle, the texture overlaps some of the concave parts (as OpenGL cannot handle concave polygons). Is there an efficient way to just "fill" the white parts of the polygon body with texture data? Or is there a way to map a texture that it is solid when the pixel below it is white, and transparent otherwise? Thank you! -Christian
Phy
Phy
I think you can use the stencil buffer for such an effect, but I don't know much about it. Try Googling 'Stencil Buffer'.
cmor
cmor
Yes, the stencil buffer was exactly the right thing to use, thank's a lot! :)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.