1 #include "GLProjectionParametersBase.hh"
3 # include <OpenGL/glu.h>
7 #include <OpenGLFramework/Base/glfScreen.hh>
8 #include <OpenGLFramework/Base/glfException.hh>
9 #include <GLviewer/OutputAttachments/OutputWowDisplay.hh>
10 #include <GLviewer/OutputAttachments/OutputHaze.hh>
11 #include <GLviewer/OutputAttachments/OutputWowDisplay2.hh>
12 #include <GLviewer/OutputAttachments/OutputUnderwater.hh>
13 #include <GLviewer/OutputAttachments/OutputLensDistortion.hh>
14 #include <Utils/GlewInitWrapper.hh>
15 #include <Base/Common/CompareFloatingPoint.hh>
19 #define RAD_TO_DEG 57.29577951
65 #ifdef BIAS_HAVE_CLASS_DISTORTIONRENDERING
66 distortionRendering_.AddDebugLevel(lv);
68 #ifdef BIAS_HAVE_CLASS_FISHEYERENDERING
69 fisheyeRendering_.AddDebugLevel(lv);
81 BIASERR(
"Call derived class!");
86 BIASERR(
"Call derived class!");
108 #ifdef BIAS_HAVE_CLASS_OFFSCREENRENDERING
110 renderTarget = offscreenRendering_.GetFBO();
136 for(
unsigned int i=0; i<3; i++) {
151 0.0, 0.0, 0.0, 1.0 };
152 glMatrixMode(GL_MODELVIEW);
158 Draw(std::vector<SceneBase *>& scenes,
162 { GLenum err = glGetError();
if (err != GL_NO_ERROR) { BIASERR(
"My OpenGL Error 3: " << gluErrorString(err)); } }
164 unsigned int imgWidth, imgHeight;
174 BIASERR(
"failure updating ModelViewMatrix\n");
178 GetMyselfAsProjectionParameterBase()->GetImageSize(imgWidth, imgHeight);
179 BIASDOUT(GLP_VIEWPORT,
"Size from ProjectionParameters: "<<imgWidth<<
"x"<<imgHeight);
180 BIASASSERT(imgWidth!=0 && imgHeight!=0);
182 #ifdef BIAS_HAVE_CLASS_OFFSCREENRENDERING
185 BIASDOUT(GLP_VIEWPORT,
"Setting viewport for offscreen to: "<<imgWidth<<
"x"<<imgHeight);
189 unsigned int imgWidth, imgHeight;
190 GetMyselfAsProjectionParameterBase()->GetImageSize(imgWidth, imgHeight);
191 BIASDOUT(GLP_VIEWPORT,
"Imagesize in BeginDraw:"<<imgWidth<<
"x"<<imgHeight);
192 if(offscreenRendering_.Init(imgWidth, imgHeight)!=0) {
193 BIASERR(
"offscreen rendering could not be initialized\n");
199 BIASERR(
"GL Error in Offscreenrender initialization in Draw() : " << e.
GetMessageString());
202 #endif // BIAS_HAVE_CLASS_OFFSCREENRENDERING
206 BIASDOUT(GLP_VIEWPORT,
"Getting Viewport for control in Draw:"<<viewport[0]
207 <<
","<<viewport[1]<<
","<<viewport[2]<<
","<<viewport[3]);
211 BIASERR(
"error updating Projection matrix!");
218 if(imgWidth == (
unsigned)viewport[2] &&
219 imgHeight == (
unsigned)viewport[3] &&
226 return Draw_(scenes);
251 int &sizex,
int &sizey){
253 glGetIntegerv(GL_VIEWPORT, viewport);
254 lowerleftx = viewport[0];
255 lowerlefty = viewport[1];
263 int sizex,
int sizey){
264 glViewport(lowerleftx,lowerlefty,sizex,sizey);
284 int imageWidth,
int imageHeight,
285 std::vector<SceneBase*>& scenes)
295 BIASERR(
"viewport dimensions do not match parameters!"<<endl
296 <<
"image="<<imageWidth<<
"x"<<imageHeight<<
" viewport="
297 <<viewport[0]<<
";"<<viewport[1]<<
" -> "
298 <<viewport[2]<<
";"<<viewport[3]<<endl);
321 for(
unsigned int i=0; i<4; i++)
325 cout<<
"new Viewport:"<<viewport[0]<<
","<<
326 viewport[1]<<
","<<viewport[2]<<
","<<
332 double decisionScaleWidth = ((double)viewport[0] - (
double)viewport[2]) / (
double)imageWidth;
333 double decisionScaleHeight = ((double)viewport[1]- (
double)viewport[3]) / (
double)imageHeight;
334 double decisionScale;
335 if(decisionScaleWidth<decisionScaleHeight)
336 decisionScale = decisionScaleWidth;
338 decisionScale = decisionScaleHeight;
340 if(
Equal(decisionScale,1.0))
343 SetGLViewport_(viewport[0], viewport[1]+(viewport[3]-imageHeight),
344 imageWidth, imageHeight);
346 SetGLViewport_(viewport[0], viewport[1],viewport[2], viewport[3]);
350 unsigned int newImageWidth=0, newImageHeight=0;
351 int ggT = imageWidth;
361 if(ggT == 1 && decisionScale < 1)
363 BIASERR(
"viewport too small for rescale");
368 int smallestImageWidth = imageWidth / ggT;
369 int smallestImageHeight = imageHeight / ggT;
371 decisionScaleWidth = (double)viewport[2]/(
double)smallestImageWidth;
372 decisionScaleHeight= (double)viewport[3]/(
double)smallestImageHeight;
373 if(decisionScaleWidth<decisionScaleHeight)
374 decisionScale = decisionScaleWidth;
376 decisionScale = decisionScaleHeight;
377 int flooredDecisionScale = (int)floor(decisionScale);
378 if(flooredDecisionScale == 1)
380 newImageWidth = smallestImageWidth;
381 newImageHeight = smallestImageHeight;
383 if(flooredDecisionScale > 1)
385 newImageWidth = (int) ((
double)smallestImageWidth * flooredDecisionScale);
386 newImageHeight = (int)((
double)smallestImageHeight * flooredDecisionScale);
388 if(flooredDecisionScale < 1)
390 BIASERR(
"this should never happen!");
413 double ratio = double(imageWidth)/ double(newImageWidth);
417 BIASERR(
"UpdateGLProjectionMatrix_ failed");
421 SetGLViewport_(viewport[0], viewport[1]+(viewport[3]-newImageHeight),
422 newImageWidth, newImageHeight);
424 cout<<
"setting the vp to: "<<viewport[0]<<
" "
425 <<viewport[1]+(viewport[3]-newImageHeight)<<
" "
426 <<newImageWidth<<
" "<<newImageHeight<<endl;
442 BIASWARN(
"AdaptToCroppedImage disabled on last Vision-N merge, reactivate if required!");
487 int visibleHeight = imageHeight - drawingUpperLeft_[1];
489 int newWidth, newHeight, newLLY;
490 if(visibleWidth < viewport[2])
493 newWidth = visibleWidth;
498 newWidth = viewport[2];
501 if(visibleHeight < viewport[3])
504 newHeight = visibleHeight;
505 newLLY = viewport[3] - visibleHeight;
510 newHeight = viewport[3];
511 newLLY = viewport[1];
514 newWidth, newHeight);
518 drawingUpperLeft_[1],
522 viewport[2], viewport[3]);
552 for(
unsigned int i=0; i<4; i++) {
558 double decisionScaleWidth = (double)viewport[2] / (
double)imageWidth;
559 double decisionScaleHeight = (double)viewport[3] / (
double)imageHeight;
568 double decisionScale;
569 if(decisionScaleWidth<decisionScaleHeight)
570 decisionScale = decisionScaleWidth;
572 decisionScale = decisionScaleHeight;
574 if(
Equal(decisionScale,1.0) ) {
583 SetGLViewport_(viewport[0], viewport[1]+(viewport[3]-imageHeight),
584 imageWidth, imageHeight);
588 SetGLViewport_(viewport[0], viewport[1],viewport[2], viewport[3]);
596 double tmpImageHeight, tmpImageWidth;
597 tmpImageWidth = (double)imageWidth * decisionScale;
598 tmpImageHeight = (double)imageHeight * decisionScale;
599 double ratio = (double)imageWidth / tmpImageWidth;
608 int newImageWidth = (int)rint(tmpImageWidth);
609 int newImageHeight = (int)rint(tmpImageHeight);
611 newImageWidth, newImageHeight) != 0 ) {
615 SetGLViewport_(viewport[0], viewport[1]+(viewport[3]-newImageHeight),
616 newImageWidth, newImageHeight);
636 for(
unsigned int i=0; i<4; i++)
658 BIASWARN(
"AutoSimplePerspectiveCam only for perspective cameras, guess why?!");
662 default: cerr<<
"unknown matching behaviour\n";
return -1;
break;
669 const unsigned int ulY,
670 const unsigned int width,
671 const unsigned int height,
672 std::vector<SceneBase *> scenes)
683 glGetIntegerv(GL_VIEWPORT, viewport);
686 if((
int)width!=viewport[2] || (
int)height!=viewport[3]) {
687 cerr<<
"viewport dimensions do not suffice!\n";
692 int res =
Draw_(scenes);
710 glGetIntegerv(GL_VIEWPORT, tmp.
GetData());
711 cout <<
"\nentering BeginDraw_(): GLViewport is " << tmp[0]
714 <<
", " << tmp[3] << endl;
715 BIASASSERT(tmp[1] != 1);
724 BIASERR(
"Error in InitBeforeDraw in BeginDraw_() : " << e.
GetMessageString());
731 if (theTarget == NULL) {
735 renderTarget = theTarget;
739 renderTarget->
Bind();
753 glPushAttrib(GL_TRANSFORM_BIT | GL_ENABLE_BIT |
754 GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
757 if(glIsEnabled(GL_BLEND)) {
758 glBlendEquationSeparate(GL_FUNC_ADD, GL_MAX);
759 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
763 glEnable(GL_DEPTH_TEST);
764 glDepthFunc(GL_LEQUAL);
767 glDepthMask(GL_TRUE);
783 BIASERR(
"UpdateGLProjectionMatrix_ failed!");
788 glMatrixMode(GL_PROJECTION);
792 glMatrixMode(GL_MODELVIEW);
804 GLF_THROW_ON_OPENGL_ERROR
807 glGetIntegerv(GL_VIEWPORT, tmp.GetData());
808 cout <<
"entering EndDraw_(): GLViewport is " << tmp[0]
811 <<
", " << tmp[3] << endl;
816 glEnable(GL_DEPTH_TEST);
817 #ifdef BIAS_HAVE_GLEW
821 if(glIsEnabled(GL_BLEND) == GL_TRUE ) {
823 BIASDOUT(GLP_ACTIVITY_HIGH,
"rendering bg image !");
825 glBlendEquationSeparate(GL_FUNC_ADD, GL_MAX);
826 glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_DST_ALPHA);
827 GLF_THROW_ON_OPENGL_ERROR
830 BIASDOUT(GLP_ACTIVITY_HIGH,
831 "preparing subtraction from background image !");
832 glDisable(GL_DEPTH_TEST);
833 glBlendEquationSeparate(GL_FUNC_SUBTRACT, GL_MAX);
834 glBlendColor(0.5, 0.5, 0.5, 1.0);
835 glBlendFunc(GL_ONE, GL_CONSTANT_COLOR);
837 glMatrixMode(GL_PROJECTION);
840 glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
841 glMatrixMode(GL_MODELVIEW);
844 glColor3f(0.5, 255.5, 0.5);
846 glVertex3f(-1, 1, -1);
847 glVertex3f(1, 1, -1);
848 glVertex3f(1, -1, -1);
849 glVertex3f(-1, -1, -1);
853 glMatrixMode(GL_PROJECTION);
856 glBlendEquationSeparate(GL_FUNC_ADD, GL_MAX);
858 glBlendFunc(GL_CONSTANT_COLOR, GL_ONE);
862 BIASDOUT(GLP_ACTIVITY_HIGH,
"Blending Disabled: skipping blending/subtraction");
870 BIASDOUT(GLP_ACTIVITY_HIGH,
"backgroundImageScene->Render() now !");
871 glDisable(GL_STENCIL_TEST);
875 glMatrixMode(GL_PROJECTION);
877 glMatrixMode(GL_MODELVIEW);
884 #ifdef BIAS_HAVE_CLASS_OFFSCREENRENDERING
889 if (theTarget != NULL) {
900 glGetIntegerv(GL_VIEWPORT, tmp.GetData());
901 cout <<
"leaving EndDraw_(): GLViewport is " << tmp[0]
904 <<
", " << tmp[3] << endl << endl;
906 GLF_THROW_ON_OPENGL_ERROR
913 if (!GetMyselfAsProjectionParameterBase()->
PoseValid())
915 BIASERR(
"pose invalid?!");
943 int yInLastViewport = y - lastUsedGLViewport_[1];
944 if(xInLastViewport<0 ||
946 xInLastViewport>lastUsedGLViewport_[2] ||
947 yInLastViewport>lastUsedGLViewport_[3])
949 cerr<<
"argument point does not lie in last viewport\n";
982 double depth = 0.0; depth =
GetDepth(p);
984 BIASWARNONCE(
"Depth is 0!");
986 GetMyselfAsProjectionParameterBase()->UnProjectToRay(p, pos, opticalray);
987 if(opticalray.
NormL2()==0.0) {
988 BIASWARNONCE(
"returned ray has zero length!");
991 return HomgPoint3D(opticalray[0], opticalray[1], opticalray[2], 0);
994 return GetMyselfAsProjectionParameterBase()->UnProjectToPoint(p, depth);
1007 return GetMyselfAsProjectionParameterBase()->UnProjectToPoint(point2D,depth);
1013 return GetMyselfAsProjectionParameterBase()->Project(point);
1024 for(
unsigned int i=0; i<3; i++)
1035 pPPB=GetMyselfAsProjectionParameterBase();
1064 if(!pPPB) { cout<<
"setextr failed"<<endl;
return -1;}
1077 if(!pPPB) { cout<<
"setextr failed"<<endl;
return -1;}
1095 float scenex,
float sceney,
float scenez,
1096 float upx,
float upy,
float upz)
1114 BIASERR(
"Camera center and scene point must not be the same!");
1121 cerr<<
"Up vector must not be the null vector \n";
1128 cerr<<
"Up vector and viewing direction must not be parallel \n";
1136 for(
unsigned int i=0; i<3; i++) {
1159 if(
Less(p[0], 0.0) ||
Less(p[1], 0.0)) {
1160 BIASERR(
"point not in image");
1164 unsigned int ul[2] = {(
unsigned int)floor(p[0]), (
unsigned int)floor(p[1])};
1165 double depthUL =
GetDepth(ul[0], ul[1]);
1166 if(depthUL == 0.0)
return 0.0;
1168 unsigned int ur[2] = {(
unsigned int)ceil(p[0]), (
unsigned int)floor(p[1])};
1169 double depthUR =
GetDepth(ur[0], ur[1]);
1170 if(depthUR == 0.0)
return 0.0;
1172 unsigned int ll[2] = {(
unsigned int)floor(p[0]), (
unsigned int)ceil(p[1])};
1173 double depthLL =
GetDepth(ll[0], ll[1]);
1174 if(depthLL == 0.0)
return 0.0;
1176 unsigned int lr[2] = {(
unsigned int)ceil(p[0]), (
unsigned int)ceil(p[1])};
1177 double depthLR =
GetDepth(lr[0], lr[1]);
1178 if(depthLR == 0.0)
return 0.0;
1180 double dx = p[0] - ul[0];
1181 double dy = p[1] - ul[1];
1184 dy*(depthLL - depthUL) +
1185 dx*(depthUR - depthUL) +
1186 dy*dx*(depthUL + depthLR - depthLL - depthUR));
1194 float depthRead = 0.0;
1199 glReadPixels(accessX,
1203 GL_FLOAT, &depthRead);
1215 for (
int x=0; x<lastUsedGLViewport_[2]; x++)
1236 if(res!=0)
return res;
1244 const float invalid,
1245 const bool flip)
const {
1246 if(flip) depthMap.
Flip();
1250 for (
unsigned y=0; y<depthMap.
GetHeight() ; y++) {
1251 for (
unsigned x=0; x<depthMap.
GetWidth(); x++) {
1252 if (z[y][x] >= 1.0) z[y][x] = invalid;
1253 else if(z[y][x] != invalid){
1266 const float invalid,
1267 const bool flip)
const {
1268 if(flip) depthMap.
Flip();
1272 for (
unsigned int y=0; y<depthMap.
GetHeight() ; y++)
1274 for (
unsigned int x=0; x<depthMap.
GetWidth(); x++)
1276 if (z[y][x] >= 1.0) z[y][x] = invalid;
1277 else if(z[y][x] != invalid)
1287 const float invalid,
1288 const bool flip)
const
1290 if(flip) depthtoz.
Flip();
1296 for (
int x=0; x<lastUsedGLViewport_[2]; x++)
1298 if(depth[y][x] != invalid)
1302 GetMyselfAsProjectionParameterBase()->
1317 if(res!=0)
return res;
1328 glGetIntegerv(GL_DEPTH_BITS,&depthbits);
1331 cerr<<
"no depth buffer available\n";
1337 BIASERR(
"You never rendered, no screenshot now.");
1365 glBindTexture(GL_TEXTURE_2D, texID);
1366 glCopyTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT, 0,0, width, height, 0);
1374 int redbits, greenbits;
1375 glGetIntegerv(GL_RED_BITS, &redbits);
1376 glGetIntegerv(GL_GREEN_BITS, &greenbits);
1380 BIASERR(
"You never rendered, no screenshot now.");
1386 (colorType == 1 && greenbits>0) ||
1387 (colorType == 3 && greenbits==0) ||
1388 (colorType != 1 && colorType != 3 ) )
1398 cerr<<
"red framebuffer bits are zero!";
1409 glPixelStorei(GL_PACK_ALIGNMENT, 1);
1431 if((err=glGetError()) != GL_NO_ERROR)
1432 cerr<<
"Error getting image "<<gluErrorString(err)<<endl;
1442 int redbits, greenbits;
1443 glGetIntegerv(GL_RED_BITS, &redbits);
1444 glGetIntegerv(GL_GREEN_BITS, &greenbits);
1450 BIASERR(
"You never rendered, no screenshot now.");
1475 BIASERR(
"red framebuffer bits are zero!\n");
1482 glPushAttrib(GL_PIXEL_MODE_BIT);
1483 glPixelTransferf(GL_RED_SCALE, 0.299);
1484 glPixelTransferf(GL_GREEN_SCALE, 0.587);
1485 glPixelTransferf(GL_BLUE_SCALE, 0.114);
1504 if(glGetError() != GL_NO_ERROR)
1505 cerr<<
"Error getting image "<<gluErrorString(glGetError())<<endl;
1524 #ifndef BIAS_HAVE_CLASS_OFFSCREENRENDERING
1526 cerr<<
"offscreen rendering cannot be activated due to missing or "<<
1527 "inactive GLEW/GL/CG features!\n";
1538 BIASERR(
"adding output attachments after first call to draw not supported");
1585 BIASDOUT(GLP_ACTIVITY_BASIC,
"Adding output attachment: WoWVX");
1588 BIASDOUT(GLP_ACTIVITY_BASIC,
"Adding output attachment: Haze");
1592 BIASDOUT(GLP_ACTIVITY_BASIC,
"Adding output attachment: WoWVX2");
1596 BIASDOUT(GLP_ACTIVITY_BASIC,
"Adding output attachment: Underwater");
1600 BIASDOUT(GLP_ACTIVITY_BASIC,
"Adding output attachment: Lens Distortion");
1605 BIASERR(
"Unknown Output Attachment, bailing out..");
virtual BIAS::Vector3< double > GetC() const
Get projection center.
void Release()
reimplemented from ImageBase
bool Less(const T left, const T right, const T eps=std::numeric_limits< T >::epsilon())
comparison function for floating point values
virtual void TranslateZToDepth(BIAS::Image< float > &ztodepth, const float invalid=0.0, const bool flip=true) const
helper function which converts a z map obtained with the last camera into a depth map for the last ca...
BIAS::Vector2< unsigned int > lastDrawingUpperLeft_
Keeping track which image part was drawn last time Draw() was called.
virtual int EndDraw_(BIAS::glfFramebufferObject *theTarget=NULL)
virtual void Render()
this is the entry point seen from GLProjectionParametersBase.
BIAS::Vector4< int > lastFullGLViewport_
Remembering the last full viewport prevent unecessary calculations in AutoRescaleParams behaviour...
exemplary output attachment, creating a bluish haze effect on the rendered output ...
int GetZBuffer(BIAS::Image< float > &zBuffer)
int DrawPartOfImage_(const unsigned int ulX, const unsigned int ulY, const unsigned int width, const unsigned int height, std::vector< SceneBase * > scenes)
Renders a rectangular part of actual image.
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
int GetGLViewport_(int &lowerleftx, int &lowerlefty, int &sizex, int &sizey)
BIAS::HomgPoint2D Project(BIAS::HomgPoint3D &point)
static int instanceCounter
void AddDebugLevel(const long int lv)
BIAS::Matrix4x4< double > GLProjectionMatrix_
exemplary output attachment, creating a underwater effect
bool offscreenRenderingEnabled_
std::deque< BIAS::GLProjectionOutputAttachment * > outputAttachments_
Scene that renders a background image behind all other scenes.
virtual void SetR(const BIAS::RMatrix &R)
Set orientation from rotation matrix R.
bool IsEmpty() const
check if ImageData_ points to allocated image buffer or not
virtual void Assign(BIAS::ProjectionParametersBase &p)
int GetDepthMap(BIAS::Image< float > &depthMap, const float invalid=0.0)
Calculates depth map from current z-Buffer state.
camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
bool callInitBeforeDraw_
}@
virtual void SetRenderTarget(BIAS::glfRenderTarget *RT)
BIAS::SceneBGImage * backgroundImageScene_
bool GetViewportCoordinates(int &x, int &y)
Takes x, y as window coordinates, checks whether the coordinates lie in the rendered image (in the vi...
void AppendOutputAttachment(int type, std::vector< int > args=std::vector< int >())
bool ExtrinsicStateChanged_
Changes to the parameters or GL state that lead to new calculation of GL_MODELVIEW matrix...
rescale internal projection parameters preserving aspect ratio and scale by integer values only...
std::deque< int > outputAttachmentIdentifiers_
virtual int BeginDraw_(BIAS::glfFramebufferObject *theTarget=NULL)
int SetGLViewport_(int lowerleftx, int lowerlefty, int sizex, int sizey)
bool IntrinsicStateChanged_
Changes to the parameters or GL state that lead to new calculation of GL_PROJECTION matrix...
int GetMetricZMap(BIAS::Image< float > &metricZMap, const float invalid=0.0)
BIAS::Vector4< int > lastUsedGLViewport_
Keeping track which part of image was drawn last time Draw() was called and where it was drawn...
virtual int GetExtrinsics(BIAS::Vector3< double > &C, BIAS::Vector3< double > &up) const
BIAS::Matrix4x4< double > GLModelViewMatrix_
unsigned int instanceNum_
Exception class used for run-time errors in the OpenGLFramework.
virtual ~GLProjectionParametersBase()
void SwitchToOffscreenRendering(bool offscreen=true)
unsigned int GetWidth() const
virtual int Draw(std::vector< BIAS::SceneBase * > &scenes, BIAS::SceneBGImage *backgroundImageScene=NULL, BIAS::glfFramebufferObject *theTarget=NULL)
Renders scenes passed as argument beginning with the smallest index.
virtual void AddDebugLevel(const long int lv)
const std::string & GetMessageString() const
Returns the description of the error including the file name and line number where the error occured...
void PrepareOutputAttachments_()
virtual void SetQ(const BIAS::Quaternion< double > &Q)
Set orientation from unit quaternion Q.
exemplary output attachment to create 2D+Depth output for Wow Displays
void CrossProduct(const Vector3< T > &argvec, Vector3< T > &destvec) const
cross product of two vectors destvec = this x argvec
GLProjectionOutputAttachment * GetAttachmentByType(int type)
Render part of the image or the whole image, does not change projection parameters.
void SetToUnknownState_()
virtual void Set(BIAS::ProjectionParametersBase *p)
static GlewInitWrapper * GetInstance()
BIAS::GLProjectionParametersInterface::ViewingReshapeBehaviour AutoViewingMatchBehaviour_
virtual void SetDebugLevel(const long int lv)
static glfScreen & GetInstance()
Returns the global screen instance.
virtual void Bind() const =0
Makes this render target the currently used render target.
BIAS::Vector2< unsigned int > drawingUpperLeft_
When cutting the image this field is telling the projection the upper left corner of the drawn image ...
unsigned int GetChannelCount() const
returns the number of Color channels, e.g.
virtual int Draw_(std::vector< SceneBase * > &scenes, BIAS::glfFramebufferObject *theTarget=NULL)=0
Implement in deriving classes.
void SetDebugLevel(const long int lv)
virtual double Z2Depth_(const int x, const int y, const double z) const =0
unsigned int GetHeight() const
virtual BIAS::RMatrix GetR() const
Get orientation as rotation matrix R.
virtual void SetGLCameraToLocal()
Sets gl's Modelview matrix for rendering relative to camera coordinate system (ignoring camera pose)...
Matrix4x4 Transpose() const
virtual void SetIntrinsics(BIAS::ProjectionParametersBase *p)
T * GetData()
get the pointer to the data array of the matrix (for faster direct memeory access) ...
std::deque< std::vector< int > > outputAttachmentOptions_
BIAS::Vector4< float > ClearColor_
virtual BIAS::glfRenderTarget * GetRenderTarget()
class HomgPoint3D describes a point with 3 degrees of freedom in projective coordinates.
Calculate new simple perspective camera parameters keeping the current field of view in "y direction"...
void SetZClippingPlanes(float n, float f)
Setting the near and far z-Clipping planes.
void ClearDepthBuffer(float depth=1.0f)
Clears the depth buffer of the render target with the given value.
void GetImage(BIAS::Image< unsigned char > &image)
virtual void Bind() const
Makes this render target the currently used render target.
void Init(unsigned int Width, unsigned int Height, unsigned int channels=1, enum EStorageType storageType=ST_unsignedchar, const bool interleaved=true)
calls Init from ImageBase storageType is ignored, just dummy argument
bool Equal(const T left, const T right, const T eps)
comparison function for floating point values See http://www.boost.org/libs/test/doc/components/test_...
const StorageType * GetImageData() const
overloaded GetImageData() from ImageBase
void Sub(const T &scalar, Vector3< T > &dest) const
Substraction with a scalar, storing results in destination vector.
BIAS::glfRenderTarget * currentRenderTarget_
void ForceSceneUpdate()
Rendering will call UpdateCameraRelatedState() on scenes.
Matrix3x3< T > Transpose() const
returns transposed matrix tested 12.06.2002
const T * GetData() const
get the data pointer the member function itself is const (before {..}) because it doesn't change the...
void Rescale(float ratio)
Returns the absolute world coordinate frame position of camera.
void MultIP(const T &scalar)
virtual void TranslateZToMetricZ(BIAS::Image< float > &depthMap, const float invalid=0.0, const bool flip=true) const
bool subtractFromBackgroundImage_
void SetFarClippingPlane(float f)
bool informScenesOfChange_
Abstract projection params have changed, scenes have to be informed about this.
bool FirstRenderingPassFinished_
Do not do anything! Do not render either!
int Flip()
flips the image vertically (row order is inverted) In place function return 0 in case of success...
void ClearStencilBuffer(int s=0)
Clears the stencil buffer of the render target with the given value.
virtual void ZBufferToDepthMap_(BIAS::Image< float > &depthMap)
used by GetDepthMap() which writes the current zbuffer in depthMap.
virtual BIAS::ProjectionParametersBase * GetMyselfAsProjectionParametersBase() const
the pure virtual GetMyselfAsProjectionParameterBase() forces the child classes to inherit from a proj...
void ClearColorBuffer(float red=0.0f, float green=0.0f, float blue=0.0f, float alpha=0.0f)
Clears the color buffer of the render target with the given color.
virtual void SetQC(const BIAS::Quaternion< double > &Q, const BIAS::Vector3< double > &C)
Set pose from unit quaternion Q and projection center C.
void SetSimplePerspective(const double FoV=M_PI/2, const unsigned int width=512, const unsigned int height=512)
Sets the parameters for a simple perspective camera with imagesize 512x512, focal length 512 (fov = 9...
Class for extra rendering pass in GLProjection (for now only used in glutGLviewer) ...
BIAS::HomgPoint3D UnProject(const unsigned int x, const unsigned int y)
int UpdateGLModelViewMatrix_()
Camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
virtual int UpdateGLProjectionMatrix_(unsigned int x0, unsigned int y0, unsigned int width, unsigned int height)=0
Interface for render targets.
rescale internal projection parameters preeerving aspectration but use non-integer values...
virtual int DrawWithMatchedParamsAndViewport_(int viewport[4], int imageWidth, int imageHeight, std::vector< SceneBase * > &scenes)
Takes care of adapting internal parameters and gl viewport by specified behaviour scheme...
void GetGreyImage(BIAS::Image< unsigned char > &image)
virtual void SetC(const BIAS::Vector3< double > &C)
Set projection center.
Vector3< T > & Normalize()
normalize this vector to length 1
void SetNearClippingPlane(float n)
virtual double GetDepth(const unsigned int x, const unsigned int y)
evaluate depth.
GLProjectionParametersBase()
double NormL2() const
the L2 norm sqrt(a^2 + b^2 + c^2)
class BIASGeometryBase_EXPORT HomgPoint2D
virtual void TranslateDepthToZ(BIAS::Image< float > &depthtoz, const float invalid=0.0, const bool flip=true) const
helper function which converts a z map obtained with the last camera into a depth map for the last ca...
virtual void Rescale_(float scale)=0
class BIASGeometryBase_EXPORT HomgPoint3D
virtual int SetExtrinsics(const BIAS::HomgPoint3D &C, const BIAS::RMatrix &R)
exemplary output attachment to create 2D+Depth output for Wow Displays
void ReadDepthBufferToTexture_(int texID, int width, int height)
const StorageType ** GetImageDataArray() const
overloaded GetImageDataArray() from ImageBase