<span style="color:#3333FF;"> // Aspect ratio allows us to constrain width and height whilst fitting within specified
// bounds. A positive aspect ratio makes a view 'shrink to fit' (introducing empty bars),
// whilst a negative ratio makes the view 'grow to fit' (cropping the view).</span>
pangolin::View& d_cam = pangolin::Display("cam")
.SetBounds(0,1.0f,0,1.0f,-640/480.0)
.SetHandler(new pangolin::Handler3D(s_cam));
<span style="color:#3333FF;">
// This view will take up no more than a third of the windows width or height, and it
// will have a fixed aspect ratio to match the image that it will display. When fitting
// within the specified bounds, push to the top-left (as specified by SetLock).</span>
pangolin::View& d_image = pangolin::Display("image")
.SetBounds(2/3.0f,1.0f,0,1/3.0f,640.0/480)
.SetLock(pangolin::LockLeft, pangolin::LockTop);
I found with larger value of width and height of the whole window, I would get a larger cube like below: (Window: 1280 x 960)
Which did not happen in previous examples.
One interesting thing happened here:
glColor3f(1.0,1.0,1.0);
pangolin::glDrawColouredCube();
//Set some random image data and upload to GPU
setImageData(imageArray,3*width*height);
imageTexture.Upload(imageArray,GL_RGB,GL_UNSIGNED_BYTE);
//display the image
d_image.Activate();
glColor3f(1.0,1.0,1.0);
imageTexture.RenderToViewport();
According to: https://msdn.microsoft.com/en-us/library/windows/desktop/dd318399(v=vs.85).aspx
glColor3f() sets the current color, but when I commented out the first glColor3f(1.0,1.0,1.0), the result would just be like the original result.
Meanwhile the result would be: ↓↓↓↓↓↓↓↓↓↓ if i commented out the second one.
And according to display.h, I should be able to locate the image with .SetLock(pangolin::LockLeft, pangolin::LockTop);
But actually I failed to.