Platforms to show: All Mac Windows Linux Cross-Platform
/MacFrameworks/OpenCL/OpenCL Picture Method Tests
Required plugins for this example: MBS Main Plugin, MBS MacFrameworks Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacFrameworks/OpenCL/OpenCL Picture Method Tests
This example is the version from Sun, 17th Mar 2012.
Project "OpenCL Picture Method Tests.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
EventHandler Sub Open()
const size = 500
// create test picture
dim pic1 as Picture = LogoMBS(size)
// create destination picture
dim pic2 as new Picture(size, size, 32)
// get device list
dim devices() as CLDeviceMBS = OpenCLMBS.AllDevices(CLDeviceMBS.kDeviceTypeAll)
dim device as CLDeviceMBS = devices(0)
// Create context for that device
dim c as new CLContextMBS(device)
// query what format REAL Studio uses for pictures
dim RowPitch as integer
dim format as CLImageFormatMBS = OpenCLMBS.GetPictureImageFormat(pic1, RowPitch)
// create a matching memory object
dim m as new CLMemMBS(c, CLMemMBS.kMemoryReadWrite, format, size, size, RowPitch)
// create command queue
dim cq as new CLCommandQueueMBS(c, device, 0)
// copy picture content into CLMem object
cq.EnqueueWritePicture(m, 0, 0, size, size, pic1)
// and copy back to second picture
cq.EnqueueReadPicture(m, 0, 0, size, size, pic2)
// finally display it
Backdrop = pic2
End EventHandler
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project
See also:
The items on this page are in the following plugins: MBS MacFrameworks Plugin.