Added a section on damage() for widget writers.

git-svn-id: file:///fltk/svn/fltk/trunk@266 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet
1999-02-01 20:38:57 +00:00
parent 3377e6e0d5
commit 44f8e8e32a
+19 -2
View File
@@ -24,6 +24,24 @@ file needed by WIN32 applications. </P>
<LI>A <TT>handle()</TT> method (if you need to recieve input from the
user). </LI>
</UL>
If your subclass provides static controls in the window, they must be
redrawn whenever the <tt>FL_DAMAGE_ALL</tt> bit is set in the value
returned by <tt>damage()</tt>. For double-buffered windows you will
need to surround the drawing code with the following code to make sure
that both buffers are redrawn:
<ul><pre>
#ifndef MESA
glDrawBuffer(GL_FRONT_AND_BACK);
#endif // !MESA
... draw stuff here ...
#ifndef MESA
glDrawBuffer(GL_BACK);
#endif // !MESA
</pre></ul>
<B>Note:</B> If you are using the Mesa graphics library, the call to
<tt>glDrawBuffer()</tt> is not required and will slow down drawing
considerably. The preprocessor instructions shown above will optimize
your code based upon the graphics library used.
<H3>Defining the Subclass</H3>
To define the subclass you just subclass the <TT>Fl_Gl_Window</TT> class:
<UL>
@@ -164,8 +182,7 @@ for maximum portability: </P>
<LI>You must choose a default visual with <A href=functions.html#gl_visual>
<TT>Fl::gl_visual()</TT></A>. </LI>
<LI>You cannot pass <TT>FL_DOUBLE</TT> to <TT>Fl::gl_visual()</TT>.</LI>
<LI>You cannot use <TT>Fl_Double_Window</TT> or <TT>Fl_Overlay_Window</TT>
. </LI>
<LI>You cannot use <TT>Fl_Double_Window</TT> or <TT>Fl_Overlay_Window</TT>.</LI>
</UL>
Do <I>not</I> call <TT>gl_start()</TT> or <TT>gl_finish()</TT> when
drawing into an <TT>Fl_Gl_Window</TT>!