0

I am trying to detect whether a particular pixel is filled or not in OpenGL in order to implement the flood fill algorithm. So, I searched and found the glreadpixel function but I don't get how I can use this function and whether or not it can solve my problem.

Bart
  • 19,692
  • 7
  • 68
  • 77
java_doctor_101
  • 3,287
  • 4
  • 46
  • 78

2 Answers2

7

The proper way is probably not to read back pixels. Instead, you should do all manipulations in a bitmap that you manage on your own. Then you request OpenGL to show this bitmap.

Lars Pensjö
  • 522
  • 2
  • 8
3

OpenGL is not a image manipulation library. It's a drawing API and it should not be used for tasks like this. Reading back image data is very expensive in OpenGL and should be avoided.

datenwolf
  • 159,371
  • 13
  • 185
  • 298