noob / paint pixels?

on a given polygon, is it possible to “paint” individual pixels?

I know we can make a polygon a given color, but can it be “painted”, at the pixel level as in a 2d paint program?

any pointers to information on this topic appreciated


uh ? glDrawPixels ?

Or texturing ?

Yes it is possible, there are many ways. You may just need typical texturing, however if you’re describing exactly what you want accurately something like eyespace texgen (with a projective coordinate or texture matrix) could accomplish this, as could stencil operations, zbuffer operations or destination alpha buffer operations in conjunction with drawpixels.

The eyespace texgen would be the simplest approach and only require the rendering of the polygon once with no significant complications.

In my humble interpretation I believe you want to move a textured polygon around, click on the screen and use some kind of brush to update the texture.

If it is, you can use something like gluUnproject to find out which 2D texture pixel corresponds to the picked screenpoint, update the colorvalue of that pixel in the texture array of your program and reload the updated texture to video memory using TexImage or SubTeximage(faster).