opengl - Using a buffer for selectioning objects: accuracy problems -
in each frame (as in frames per second) render, make smaller version of objects user can select (and selection-obstructing objects). in buffer render each object in different color. when user has mousex , mousey, buffer color corresponds position, , find corresponding objects. can't work fbo render buffer texture, , rescale texture orthogonally screen, , use glreadpixels read "hot area" around mouse cursor.. know, not efficient performance ok now.
now have problem buffer "colored objects" has accuracy problems. of course disable lighting , frame shaders, somehow still artifacts. need clean sheets of color without variances.
note here put color information in unsigned byte in gl_red. (assumiong maximally have 255 selectable objects).
are these caused rescaling texture? (i replace looking scaled coordinates int small texture.), or need disable other flag colors want. can technique used reliably?
it looks you're using gl_linear
gl_texture_mag_filter
. use gl_nearest
instead if don't want interpolated colors.
Comments
Post a Comment