OpenGL / C ++ - How to fill an area around a point with a mouse click?

I have my mouseclick handler set up correctly. I have a drawing with some shapes. Is there a way for me to fill the surrounding part of the point until it hits the polygon border. Something like Microsoft Paint's "fill" command.

Thank!

+2


source to share


4 answers


Let's look at the ability to select OpenGL using glSelectBuffer .
Refer to this chapter in the red book for an explanation.



+4


source


The advice for using glSelectBuffer is pretty good. However, after reading this chapter, look for the chapter "Now that you know" and find the section "Selecting an Object with Back Buffer" - it is much simpler and usually completely consistent.



+2


source


What you are looking for is called Flood Fill and it is a per pixel algorithm; which means you'll want to view frame objects with shaders or use the (very slow) glDrawPixels.

+1


source


Using opengl? I seriously doubt it ... What can you do to define the clicked shape and draw that shape in a different color.

0


source







All Articles