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::
46 GetImage(BIAS::Image<unsigned char>& Image, bool lock)
47 {
48  //TODO: Check if locking can be ignored here
49  MakeCurrent();
50  RenderContextBase::GetImage(Image);
51  glFinish();
52  return 0;
53 }
54 
55 int ContextPBuffer::
56 GetDepthMap(BIAS::Image<float>& Image, const float invalid, bool lock)
57 {
58  //TODO: Check if locking can be ignored here
59  //MakeCurrent();
60  int res = RenderContextBase::GetDepthMap(Image, invalid);
61  //glFinish();
62  return res;
63 }
64 
65 int ContextPBuffer::
66 GetMetricZMap(BIAS::Image<float>& Image, const float invalid, bool lock)
67 {
68  //TODO: Check if locking can be ignored here
69  MakeCurrent();
70  int res = RenderContextBase::GetMetricZMap(Image, invalid);
71  glFinish();
72  return res;
73 }
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.