Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ContextPBuffer.cpp
1 #include <GLviewer/ContextPBuffer.hh>
2 
3 #include <OpenGLFramework/Base/glfException.hh>
4 
5 using namespace std;
6 using namespace BIAS;
7 using namespace BIAS;
8 
9 
10 int ContextPBuffer::
11 Init(unsigned int width, unsigned int height,
12  unsigned int RBits, unsigned int GBits, unsigned int BBits,
13  unsigned int ABits, unsigned int DepthBits, unsigned int StencilBits)
14 {
16  cfg.width = width;
17  cfg.height = height;
18  cfg.doubleBuffer = 0;
19  cfg.redSize = RBits;
20  cfg.greenSize = GBits;
21  cfg.blueSize = BBits;
22  cfg.alphaSize = ABits;
23  cfg.depthSize = DepthBits;
24  cfg.stencilSize = StencilBits;
25 
26  try {
27  glfPBuffer::Init(cfg);
28  } catch (glfException& e) {
29  std::cout << "Error: " << e.GetMessageString() << std::endl;
30  return -1;
31  }
32  return 0;
33 }
34 
35 
36 int ContextPBuffer::
37 Render() {
38 // MakeCurrent();
39  int res =RenderContextBase::Render();
40  glFinish();
41  return res;
42 }
43 
44 
45 int ContextPBuffer::
47 {
48  MakeCurrent();
49  RenderContextBase::GetImage(Image);
50  glFinish();
51  return 0;
52 }
53 
54 int ContextPBuffer::
55 GetDepthMap(BIAS::Image<float>& Image, const float invalid)
56 {
57  //MakeCurrent();
58  int res = RenderContextBase::GetDepthMap(Image, invalid);
59  //glFinish();
60  return res;
61 }
62 
63 int ContextPBuffer::
64 GetMetricZMap(BIAS::Image<float>& Image, const float invalid)
65 {
66  MakeCurrent();
67  int res = RenderContextBase::GetMetricZMap(Image, invalid);
68  glFinish();
69  return res;
70 }
Exception class used for run-time errors in the OpenGLFramework.
Definition: glfException.hh:79
const std::string & GetMessageString() const
Returns the description of the error including the file name and line number where the error occured...
Configuration for a rendering context.