Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CameraViewport.cpp
1 #include "CameraViewport.hh"
2 #include <Base/Common/W32Compat.hh>
3 #include <Base/Debug/Error.hh>
4 
5 #include <iostream>
6 
7 #ifdef BIAS_HAVE_OPENGL
8 # include <Gui/biasgl.h>
9 #endif // BIAS_HAVE_OPENGL
10 
11 
12 using namespace std;
13 using namespace BIAS;
14 
15 
16 CameraViewport::CameraViewport()
17 {
18  InitMembers();
19 }
20 
21 CameraViewport::CameraViewport(const int vx0, const int vy0, const unsigned int vwidth, const unsigned int vheight )
22 : x0(vx0), y0(vy0), width(vwidth), height(vheight)
23 {}
24 
26 {
27  x0=y0=0;
28  width=height=256;
29 }
30 
32 {
33  BIASASSERT(height!=0);
34  return width / height;
35 }
36 
37 
38 std::ostream & BIAS::CameraViewport::Print(std::ostream & os) const
39 {
40  os<<"CameraViewport: "<<endl
41  <<"x0 "<<x0<<endl
42  <<"y0 "<<y0<<endl
43  <<"width "<<width<<endl
44  <<"height "<<height<<endl
45  ;
46  return os;
47 }
48 
49 
50 #ifdef BIAS_HAVE_OPENGL
52 {
53  glViewport(
54  (GLint)x0
55  ,(GLint)y0
56  ,(GLsizei)width
57  ,(GLsizei)height
58  );
59 }
60 #endif // BIAS_HAVE_OPENGL
void DisplayGL() const
double GetAspect() const
std::ostream & Print(std::ostream &os=std::cout) const