android - Is it possible to create a diffuse effect on a 2d mesh in opengl? -


in picture below have 2d mesh represented white square. (the rounded corners mesh geometry) can see square has bit of shading around it's edges. want accomplish, shader adds diffuse effect whenever near edge. possible in opengl? use normals calculated angles of faces, has 2d mesh route not possible. suggestions appreciated. thanks.

enter image description here

there many ways accomplish in gl, graphics pipeline quite flexible.

one possibility: add new vertex data stream, contains distance of vertex closest edge. data passed fragment shader vertex shader, , used darken fragment, if close enough edge.


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -