Go to the documentation of this file.00001 #include <iostream>
00002 #include <pangolin/pangolin.h>
00003
00004 using namespace pangolin;
00005 using namespace std;
00006
00007 void setImageData(float * imageArray, int width, int height){
00008 for(int i = 0 ; i < width*height;i++) {
00009 imageArray[i] = (float)rand()/RAND_MAX;
00010 }
00011 }
00012
00013 int main( int , char* argv[] )
00014 {
00015
00016 pangolin::CreateGlutWindowAndBind("Main",640,480);
00017 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00018
00019
00020 glEnable (GL_BLEND);
00021 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
00022
00023
00024 pangolin::OpenGlMatrix proj = ProjectionMatrix(640,480,420,420,320,240,0.1,1000);
00025 pangolin::OpenGlRenderState s_cam(proj);
00026 pangolin::OpenGlRenderState s_cam2(proj);
00027
00028
00029 View& d_cam1 = pangolin::Display("cam1")
00030 .SetAspect(640.0f/480.0f)
00031 .SetHandler(new Handler3D(s_cam));
00032
00033 View& d_cam2 = pangolin::Display("cam2")
00034 .SetAspect(640.0f/480.0f)
00035 .SetHandler(new Handler3D(s_cam2));
00036
00037 View& d_cam3 = pangolin::Display("cam3")
00038 .SetAspect(640.0f/480.0f)
00039 .SetHandler(new Handler3D(s_cam));
00040
00041 View& d_cam4 = pangolin::Display("cam4")
00042 .SetAspect(640.0f/480.0f)
00043 .SetHandler(new Handler3D(s_cam2));
00044
00045 View& d_img1 = pangolin::Display("img1")
00046 .SetAspect(640.0f/480.0f);
00047
00048 View& d_img2 = pangolin::Display("img2")
00049 .SetAspect(640.0f/480.0f);
00050
00051
00052
00053
00054 pangolin::Display("multi")
00055 .SetBounds(1.0, 0.0, 0.0, 1.0)
00056 .SetLayout(LayoutEqual)
00057 .AddDisplay(d_cam1)
00058 .AddDisplay(d_img1)
00059 .AddDisplay(d_cam2)
00060 .AddDisplay(d_img2)
00061 .AddDisplay(d_cam3)
00062 .AddDisplay(d_cam4);
00063
00064 const int width = 64;
00065 const int height = 48;
00066 float * imageArray = new float[width*height];
00067 GlTexture imageTexture(width,height,GL_LUMINANCE32F_ARB);
00068 imageTexture.SetNearestNeighbour();
00069
00070
00071 while( !pangolin::ShouldQuit() )
00072 {
00073 if(HasResized())
00074 DisplayBase().ActivateScissorAndClear();
00075
00076
00077 setImageData(imageArray,width,height);
00078 imageTexture.Upload(imageArray,GL_LUMINANCE,GL_FLOAT);
00079
00080
00081 glEnable(GL_DEPTH_TEST);
00082 glColor3f(1.0,1.0,1.0);
00083
00084 d_cam1.ActivateScissorAndClear(s_cam);
00085 glutWireTeapot(1.0);
00086
00087 d_cam2.ActivateScissorAndClear(s_cam2);
00088 glutWireTeapot(1.0);
00089
00090 d_cam3.ActivateScissorAndClear(s_cam);
00091 glutWireTeapot(1.0);
00092
00093 d_cam4.ActivateScissorAndClear(s_cam2);
00094 glutWireTeapot(1.0);
00095
00096 d_img1.ActivateScissorAndClear();
00097 imageTexture.RenderToViewport();
00098
00099 d_img2.ActivateScissorAndClear();
00100 imageTexture.RenderToViewport();
00101
00102
00103 pangolin::FinishGlutFrame();
00104 }
00105
00106 delete imageArray;
00107
00108 return 0;
00109 }