|
Table of Contents
Main screen functionsmglOpen: Opens the screen
usage: mglOpen(whichScreen, <screenWidth>, <screenHeight>, <frameRate>, <bitDepth>)
Open last monitor in list with current window settings mglOpen Open with resolution 800×600 60Hz 32bit fullscreen mglOpen(1,800,600,60,32); Open in a window mglOpen(0);
mglFlush: Flips front and back buffer
purpose: swap front and back buffer (waits for one frame tick) mglClose: Closes the screen
purpose: close OpenGL screen Other screen functionsmglSwitchDisplay: Switch between multiple monitors
usage: mglSwitchDisplay(<displayID>)
You can use this to open up two separate screens and control them independently. For example, say you have two monitors 1 and 2. You open the first in the usual way: mglOpen(1) Then you switch monitors so that you can open up the other one mglSwitchDisplay mglOpen(2) Now if you want draw to the first display, you can do mglSwitchDisplay(1) mglClearScreen(0.5); mglFlush; Similarly, to draw to the second display mglSwitchDisplay(2); mglClearScreen(1); mglFlush; You can check the status of all open displays with: mglSwitchDisplay(-2); If you want to close all displays at once, you can do: mglSwitchDisplay(-1); mglMoveWindow: Moves windows created by mglOpen(0)
usage: mglMoveWindow(leftPos,topPos)
mglOpen(0); mglMoveWindow(100,100);
mglDescribeDisplays: Get information about your monitor and computer system
usage: [displayInfo computerInfo] = mglDescribeDisplays() mglFrameGrab: Frame grab to a matlab matrix
usage: mglFrameGrab(<frameRect>)
mglOpen();
mglScreenCoordinates;
mglClearScreen([0 0 0]);
global MGL;
mglPoints2(MGL.screenWidth*rand(5000,1),MGL.screenHeight*rand(5000,1));
mglPolygon([0 0 MGL.screenWidth MGL.screenWidth],[MGL.screenHeight/3 MGL.screenHeight*2/3 MGL.screenHeight*2/3 MGL.screenHeight/3],0);
mglTextSet('Helvetica',32,[1 1 1]);
mglTextDraw('Frame Grab',[MGL.screenWidth/2 MGL.screenHeight/2]);
frame = mglFrameGrab;
mglFlush
imagesc(mean(frame,3)');colormap('gray')
|