Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TGLAdapter.cxx
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Timur Pocheptsov, Jun 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #include "TGLAdapter.h"
13 
14 /** \class TGLAdapter
15 \ingroup opengl
16 Allow plot-painters to be used for gl-inpad and gl-viewer.
17 */
18 
19 ClassImp(TGLAdapter);
20 
21 ////////////////////////////////////////////////////////////////////////////////
22 /// Constructor.
23 
24 TGLAdapter::TGLAdapter(Int_t glDevice)
25  : fGLDevice(glDevice)
26 {
27 }
28 
29 ////////////////////////////////////////////////////////////////////////////////
30 /// Set as current GL context.
31 
32 Bool_t TGLAdapter::MakeCurrent()
33 {
34  return fGLDevice != -1 && gGLManager->MakeCurrent(fGLDevice);
35 }
36 
37 ////////////////////////////////////////////////////////////////////////////////
38 /// Swap front/back buffers.
39 
40 void TGLAdapter::SwapBuffers()
41 {
42  if (fGLDevice != -1)
43  gGLManager->Flush(fGLDevice);
44 }
45 
46 ////////////////////////////////////////////////////////////////////////////////
47 /// Mark gl-device for later copying into x-pixmap.
48 
49 void TGLAdapter::MarkForDirectCopy(Bool_t isDirect)
50 {
51  gGLManager->MarkForDirectCopy(fGLDevice, isDirect);
52 }
53 
54 ////////////////////////////////////////////////////////////////////////////////
55 /// Read gl buffer into x-pixmap.
56 
57 void TGLAdapter::ReadGLBuffer()
58 {
59  gGLManager->ReadGLBuffer(fGLDevice);
60 }
61 
62 ////////////////////////////////////////////////////////////////////////////////
63 /// Extract viewport from gl.
64 
65 void TGLAdapter::ExtractViewport(Int_t *vp)const
66 {
67  gGLManager->ExtractViewport(fGLDevice, vp);
68 }
69 
70 ////////////////////////////////////////////////////////////////////////////////
71 /// Select off-screen device for rendering.
72 
73 void TGLAdapter::SelectOffScreenDevice()
74 {
75  gGLManager->SelectOffScreenDevice(fGLDevice);
76 }