[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
XOR drawing in Cocoa
> From: "Joe Esch" <joe@xxxxxxxxxxxx>
>
> I can draw the temporary graphics in OpenGL, but I don't know how to update
> them without redrawing the entire scene. For a large model, this can be
> farily slow.
>
> What I am looking for is a way to display some temporary graphics (e.g. a
> selection rectangle) over the OpenGL view without having to redraw the
> entire OpenGL scene on every mouse move.
>
> I am already using the stencil buffer for computing shadows.
Wild theory:
Request an auxilary buffer when you create your OGL context and copy your
scene data to the aux buffer via glCopyPixels (glReadBuffer(GL_BACK),
glDrawBuffer(GL_AUX0)) whenever you want to show the selection graphics.
After that, turn off depth tests and draw your selection graphics. Repair
your scene from the data stored in the aux buffer again via glCopyPixels
(glReadBuffer(GL_AUX0), glDrawBuffer(GL_BACK)).
Should work, at least in theory.
Regards,
Dietmar Planitzer