I am trying to make a simple bot for a web game, so I would like to be able to read the pixel color on the screen. I did this on Windows using GetPixel (), but I can't figure out what it is on OS X. I was looking online and came across glReadPixel. When I made a simple command line tool in Xcode, I entered the following code. However, I cannot get it to work. I get an EXC_BAD_ACCESS error message:
GLfloat r;
glReadPixels(0, 0, 1, 1, GL_RED, GL_FLOAT, &r);
I thought the above code would save the red pixel value at (0,0) in r. Oh, I would like to avoid approaching the screen because it is slow. Any help?
PS Using the command line tool, my ultimate goal is to create a bash script or applescript, since I already have a command line tool that can be clicked on the screen.
source
share