-1

I am generating 3D polycrystals structure based on Cellular automata method. My rendered structure looks like: http://www-e.uni-magdeburg.de/dzoellne/simulation/Bilder/3D_structure.gif

Is there any way to mark boundaries of each color ? Each color limited by black line, something like this: http://web.boun.edu.tr/jeremy.mason/research/images/monte_carlo.png

Unfortunately I'm using old 1.1 OpenGL.

genpfault
  • 51,148
  • 11
  • 85
  • 139

2 Answers2

0

Well, I might have a solution, but it is slow. Take from the buffer your curent image and store it into an array. After go over every pixel in the array and where the pixel should be black put a black dot on the screen. Taking the image is slow and puting dots is also slow but I don't see another way around in 1.1.

0

Maybe some use of a Stencil buffer?

I'd try to render the image twice, with slight (1px) offset in X and Y. During the rendering assign different stencil value to each color. Then if you render first pass with 'add' operation on stencil buffer, and the second pass with 'subtract', you should get simple edge detection in the stencil buffer. Then you just need to render black quad with stencil test enabled.

I realize that this approach may be not pixel-perfect and give some artifacts but it's the best that comes to my mind ATM :).

kolenda
  • 2,741
  • 2
  • 19
  • 30