Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
mgl:mglmetal [2022/09/06 14:02]
joshryu0425 [Specific Commands]
mgl:mglmetal [2023/08/09 12:19] (current)
Line 131: Line 131:
 In case you do need to build it, there are three places to look these days (as of Spring 2022). In case you do need to build it, there are three places to look these days (as of Spring 2022).
  
-==== mglMakeMetal.m ==== +===== mglMakeMetal.m ​===== 
 This builds most of the mex-functions for MGL, including functions for things like HID inputs and sounds. This builds most of the mex-functions for MGL, including functions for things like HID inputs and sounds.
  
Line 138: Line 138:
 </​code>​ </​code>​
  
-==== mglMakeSocket.m ====+===== mglMakeSocket.m ​===== 
  
 This builds mex-functions specifically for socket communications with the new mglMetal swift application. After building you can test the results with mglTestSocket.m. The test will open a pair of sockets and send a bunch of data between them, using various data types that the mglMetal Swift app supports. This builds mex-functions specifically for socket communications with the new mglMetal swift application. After building you can test the results with mglTestSocket.m. The test will open a pair of sockets and send a bunch of data between them, using various data types that the mglMetal Swift app supports.
Line 147: Line 147:
 </​code>​ </​code>​
  
-==== mglMetal.app ====+===== mglMetal.app ​=====
 To build the standalone mglMetal Swift application,​ you need to use Xcode. From testing so far, it looks like you'll need macOS 10.15.7 Catalina or later, with Xcode 12.4 or later. To build the standalone mglMetal Swift application,​ you need to use Xcode. From testing so far, it looks like you'll need macOS 10.15.7 Catalina or later, with Xcode 12.4 or later.
  
Line 172: Line 172:
 </​code>​ </​code>​
  
 +Note that the default setting for Xcode is to build debug binaries into the directory:
 +
 +  ~/​Library/​Developer/​Xcode/​DerivedData/​Build/​Products/​Debug
 +
 +So, mglMetalExecutableName now looks into that directory to see if there is a version of mglMetal that has a newer timestamp then the ones found in the mgl library. If so, it uses that, and will tell you it is doing that when you run mglOpen.
 ====== Development status ===== ====== Development status =====
 Development of MGL v3 with Metal is still in progress. Although we're not ready to declare v3 complete, a lot of functionality is in place. You might want to test it out! Development of MGL v3 with Metal is still in progress. Although we're not ready to declare v3 complete, a lot of functionality is in place. You might want to test it out!
Line 201: Line 206:
 You can also look for the latest known [[https://​github.com/​justingardner/​mgl/​issues\ | issues at GitHub]]. You can also look for the latest known [[https://​github.com/​justingardner/​mgl/​issues\ | issues at GitHub]].
  
-==== Major functionality ==== +===== Major functionality ​===== 
-^ Function name ^ Implementation status ​^ Notes ^ +^ Function name ^ Status ​^ Notes ^ 
-| mglOpen | Working alpha Code for this is in mglMetalTest,​ not yet pulled ​out into a clean function with all the same functionality ​as the mglOpen function, but should be trivial.| +| mglOpen | working ​Currently starts ​out as windowed onlyCan we pass initial window state as command line arg? Or start out with window hidden?
-| mglFlush | Working alpha | Works by busy-waiting on the flush within mglMetal - seems like this could be rethought to free up time on the matlab side | +| mglFlush | working ​| Works by busy-waiting on the flush within mglMetal - seems like this could be rethought to free up time on the matlab side. Schedule instead of wait? 
-| mglClose | Not yet implemented ​Trivial. But, need to decide if there should be a close state in which mglMetal is minimized ​+| mglClose | working ​ 
-| mglClearScreen | Working alpha | | +| mglClearScreen | working ​| | 
-mglLine ​Working alpha | | +mglLines2 ​working| | 
-| mglPoints2 | Working alpha | | +| mglPoints2 | working ​| | 
-mglQuads ​Working alpha | | +mglPoints2c ​working | | 
-| mglFixationCross | Working alpha | | +| mglQuad | working ​| | 
-| mglCreateTexture | Working alpha | | +| mglFixationCross | working ​| | 
-| mglBltTexture | Working alpha | | +| mglCreateTexture | working ​2D float textures working. 1D uint textures not yet. What to do about old mglBltTExture gl features? Need to deal with the alignment to 256 byte issue. ​
-| mglVisualAngleCoordinates | Not yet implemented ​TrivialAlready have the shader vertex code setup to accept a transformation matrix from matlab ​+| mglBltTexture | working ​
-mglSetGammaTable ​No need to update ​| | +| mglText | working | Works via Matlab image and mglMetalCreateTexture. Wants some love for backwards colors, color grading, alpha blending, and texture sizing vs natural font size 
-mglGetGammaTable ​No need to update ​| | +| mglVisualAngleCoordinates ​| working |  | 
-Keyboard / mouse functions ​No need to update ​| | +| mglMoveWindow.m | working | | 
-National Instruments digital / analog I/O NO need to update ​| | +| mglGetWindowPos.m | working | | 
-Task code No need to update ​| |+ 
 + 
 +===== Secondary priority functionality ===== 
 +^ Function name ^ Status ^ Notes ^ 
 +| mglFrameGrab.m | | Not working per se, but mglMetalSetRenderTarget.m and mglMetalReadTexture.m are working ​| 
 +| mglMovie.m | |  ​
 +mglSwitchDisplay.m ​| |  
 +mglStencilCreateBegin.m ​| |  
 +mglStencilCreateEnd.m  ​| |  
 +mglStencilSelect.m ​| |  
 +mglHFlip.m ​working | 
 +| mglVFlip.m | working| ​ | 
 +| mglScreenCoordinates.m | working| ​ | 
  
-==== Secondary priority functionality ==== 
  
-==== Minor functionality ====+===== Minor functionality ====
 +^ Function name ^ Status ^ Notes ^ 
 +| mglFillOval.m | working | |  
 +|mglFillRect.m |working | |  
 +|mglFillRect3D.m | working | |  
 +|mglGluAnnulus.m | working ​ | |  
 +|mglGluDisk.m | working | |  
 +|mglGluPartialDisk.m |working | |  
 +|mglPoints3.m | working | |  
 +|mglPolygon.m | working | |  
 +|mglTextDraw.m | Can we deprecate on-the-fly texture creation and instead provide way to update text in an exiting texture? ​ |   
 +|mglTextSet.m |working | Setting params to both globals mgl and MGL. Should we pick one?| 
 +|mglTransform.m |working | simplified for Metal, no longer supports various OpenGL operations and constants| 
 +|mglVolume.m | | (mglPrivateVolume) Volume property does not exist|
  
-==== Functionality not affected by Metal ==== 
  
-==== Functionality ​no longer needed ​====+===== Functionality ​not affected by Metal ===== 
 +^ Function name ^ Status ^ Notes ^ 
 +|mglSetGammaTable | | needs testing| 
 +|mglGetGammaTable | | needs testing| 
 +|mglCharToKeycode.m | working | Fixed crash from Catalina on| 
 +|mglDeleteSound.m | working | | 
 +|mglDescribeDisplays.m | working | | 
 +|mglDisplayCursor.m | | | 
 +|mglGetKeyEvent.m | working | Fixed crash from Catalina on | 
 +|mglGetKeys.m | working | | 
 +|mglGetMouse.m | working | | 
 +|mglGetMouseEvent.m | working | | 
 +|mglGetParam.m | working | We have global mgl and MGL, should we pick one?| 
 +|mglGetSecs.m | working | 
 +|mglInstallSound.m | working | | 
 +|mglIsCursorVisible.m | | | 
 +|mglKeycodeToChar.m | working | Fixed crash from Catalina on | 
 +|mglListener.m | working | | 
 +|mglPlaySound.m | working | | 
 +|mglPostEvent.m | working | | 
 +|mglPrivateListener.m | working | | 
 +|mglResolution.m | | | 
 +|mglSetMousePosition.m | working | | 
 +|mglSetParam.m |working | We have global mgl and MGL, should we pick one?| 
 +|mglSetSound.m | | | 
 +|mglShowKey.m |not working | | 
 +|mglSimulateRun.m |working| | 
 +|mglSystemCheck.m |working | Should add socket and metal tests?| 
 +|mglWaitSecs.m | working | |
  
-==== Brainard Lab functionality ==== 
  
 +===== Functionality no longer needed =====
 +^ Function name ^ Notes ^ Done ^
 +| mglBindTexture.m | Fast binding of textures. No need to continue to support ​ | n/a|
 +|mglStrokeText.m | Discontinue | n/a|
 +|mglNoFlushWait.m | Still needed? | Check|
 +|mglFlushAndWait.m |  No need to update / or provide as wrapper | Check |
  
 +===== Brainard Lab functionality =====
 +^ Function name ^ Notes ^ Done ^
 +| mglBindFrameBufferObject.m | Chris Broussard function | |
 +| mglDrawImage.m | Chris Broussard function | |
 +| mglShader.m | Chris Broussard function | |
 +| mglUnbindFrameBufferObject.m | Chris Broussard function | |
 +| mglCreateFrameBufferObject.m | Chris Broussard function | |
 ====== Matlab - Metal Communications ====== ====== Matlab - Metal Communications ======
  
Line 294: Line 363:
 | mglPolygon | vertices with color components | | Draw the given vertices as a triangle strip. | | mglPolygon | vertices with color components | | Draw the given vertices as a triangle strip. |
 | mglArcs | vertices with color, size, and shape components | | Draw the given vertices as points, with various curved shape options. | | mglArcs | vertices with color, size, and shape components | | Draw the given vertices as points, with various curved shape options. |
-| mglUpdateTexture | texture number, width, height, and rgba float texture data | | Replace the given texture'​s contents, to be displayed during this frame.|+| mglUpdateTexture | texture number, width, height, and rgba float texture data | | Replace the given texture'​s contents, to be displayed during this frame. ​ |