opengl - glReadPixels() not working with textures -
i've been struggling days piece of code in c++ , opengl supposed detect object selection. code worked till introduced textures , see no response.
here's code:
void mousefunc(int x, int y) { glutsetwindow(id) //i have several subwindows gldisable(gl_lighting); gldisable(gl_color_material); gldisable(gl_texture_2d); gldrawbuffer(gl_back); //code draws single colored figure unsigned char pixel[3]; glint viewport[4]; glgetintergv(gl_viewport, viewport); glreadbuffer(gl_back); glreadpixels(x, viewport[3] - y, 1, 1, gl_rgb, gl_unsigned_byte, pixel); //code comparison between read , stored colors glenable(gl_lighting); glenable(gl_color_material); glenable(gl_texture_2d); }
Comments
Post a Comment