2D Graphics

RSS for tag

Discuss integrating two-dimensional graphics into your app.

Posts under 2D Graphics tag

24 Posts

Post

Replies

Boosts

Views

Activity

MTLDebugCommandBuffer lockPurgeableObjects
I'm using Xcode 13 after recently updating to MacOS Monterey, and only after updating am I getting this error: [MTLDebugCommandBuffer lockPurgeableObjects]:2103: failed assertion `MTLResource 0x14a8a8cc0 (label: null), referenced in cmd buffer 0x149091400 (label: null) is in volatile or empty purgeable state at commit' I haven't changed my code at all between updating to the latest OS, and it worked perfectly before. How can I fix this? I don't think there should be any reason that I can't use a command buffer on a texture resource with a volatile/empty purgeable state.
4
0
3.9k
Jan ’22
Error while converting MTLTexture to CVPixelBuffer
I am getting an error from the graphics driver while converting the EnvironmentTexture(from ARKIT.AREnvironmentProbeAnchor) to CVPixelBuffer. The EnvironmentTexture is an IMTLTexture. I am using Xamarin.iOS. This is the code that I use to convert the IMTLTexture to CVPixelBuffer. buffers[i] = new CVPixelBuffer((nint)epAnchor.EnvironmentTexture.Width, (nint)epAnchor.EnvironmentTexture.Height, CVPixelFormatType.CV32RGBA); GetEnvironmentTextureSlice(buffers[i], epAnchor.EnvironmentTexture, i); public void GetEnvironmentTextureSlice(CVPixelBuffer pixelBuffer, Metal.IMTLTexture texture, int id) { Metal.MTLRegion mtlRegion = Metal.MTLRegion.Create2D((nuint)0, 0, 256, 256); nuint bytesPerPixel = 4; nuint bytesPerRow = bytesPerPixel * (nuint)mtlRegion.Size.Width; // (nuint)pixelBuffer.BytesPerRow; nuint bytesPerImage = bytesPerRow * (nuint)mtlRegion.Size.Height; pixelBuffer.Lock(CVPixelBufferLock.None); texture.GetBytes(pixelBuffer.BaseAddress, (nuint)pixelBuffer.BytesPerRow, mtlRegion, 0); pixelBuffer.Unlock(CVPixelBufferLock.None); } The error I am getting from the driver is AGX: Texture read/write assertion failed: bytes_per_row = used_bytes_per_row I tried with different values of pixelBuffer.BytesPerRow but still getting the error. Can someone help me?
1
0
2.5k
Dec ’21
Can someone walk me through the app launch sequence at a low level?
Sorry if this is a bad question or if this is asked so much it's like a routine to copy-and-paste this sort of stuff whenever someone else asks but I've been trying to get into Xcode and Swift app development for a while now and I do it on and off in a cycle. I try to get into it and start working with Xcode directly and doing stuff the proper way but I get frustrated by the amount of stuff that seems to go over my head and try to find a different way to make my coding projects / experiments a reality. When I make a new project, there's tons of stuff going on and I feel like I'm just expected to work around it with no idea how any of it works. I guess my head works very much from the ground up, needing to know how things work down to the most basic level for me to incorporate any knowledge into my understanding of a subject. When I try to create a new project from the game template (I use game because it seems closest to my graphing experiment ideas,) there's all sorts of stuff created; AppDelegate, GameScene, ViewControler, Main.storyboard etc and when I launch all this stuff just works. I look at the dev documentation and start to figure stuff out like ok when the app launches it finds the storyboard but how? Where's the option that tells the app the name of the file to launch as the storyboard? How does the viewControler represented in the storyboard know which file represents it? Ok so the dev doc says that the first step in the app launch sequence is UIApplicationMain() but where does it actually get executed from? The app? The OS? There are arguments passed to it so that's where the app delegate comes in but where are the actual args specified? I guess what I'm looking for is the answers to "how would I create all this from scratch? How would I create this without Xcode, go from empty folder with a .app extension to minimal working 2d graphing app and how does all of it work? How does the macOS interpret and properly execute an app?" I'm used to working with building apps in Java and whatnot from scratch, building windows with methods and one main method specified for debug by the compiler / fed to the jar file to first be executed when the file is opened and stuff like that. Ever since reading the Swift guide I found at the official Swift website I've absolutely fallen in love with the language; never before have I thought a language was 'my kind of language' or whose syntax is just perfectly logical to me. I suppose one of the things I really want is to be able to use Swift like Java when it comes to apps and have everything in the code and be able to trace it for myself and work with things through objects and methods and such I hope this makes sense to someone and they can point me in the right direction and get me started reading at the right spot to click on links and branch out my reading from there. Can't wait to get into actual app development the right way instead of using hack solutions like working through Java, C, C++ or whatever and sometimes having to use the app stuff anyways and also using Swift outside of playing around in playgrounds and thinking 'I really wish I could just create an app that just compiles and launches this like the playground'
2
0
1.1k
Nov ’21
low-level graphic programming in C++
Requirements : I need to draw 2D lines, circles, boxes. Fast. That's it. I don't want to learn objC, Swift, Xcode. I'm using C++ and Jetbrains' CLion. OpenGL is deprecated (or soon to be) on Mac I don't even care about Apple (as you probably guessed), but the M1 processor is just too good. (and fanless <3) I'll be happy as long as it runs on my MacBook Air Text would be a useful feature but totally optional I won't even use sprites, or any kind of assets, sound, keyboard, mouse, IO, GUI. I need pure non-interactive visualisation of science-ish stuff. fast FPS, refreshing the visualization as fast as possible. Even if it's a pure framebuffer (an array of pixels), I'll manage. If it's a full fledged 3D accelerated graphic library (eg : openGL, Vulkan, Metal), it also works for me. "as long as it works" What kind of options are available to me with the aforementioned requirements ? use openGL anyway and cry when it will no longer works ? (meh) hack my way to Metal in C++ ? I'm fine if a suggested library isn't Object Oriented (eg : openGL) Vulkan ? I still need to open a graphic window context somehow SDL2 appears to have a some kind of Metal backend/port/whatever but all the exemples I find are in ObjC. honestly, my post feel like I'm crying for a documented c++ metal wrapper of some kind I suppose ? EDIT : I read mixed message and confusion on the Future of OpenGL on Mac. Mostly about "no longer supported" vs "Deprecated". Will OpenGL be removed and no longer works. Or it will works but won't be updated anymore ? (considering my requirements, an outdated version of OpenGL is perfectly fine to me) Thank you <3
4
0
6.7k
Oct ’21
MTLDebugCommandBuffer lockPurgeableObjects
I'm using Xcode 13 after recently updating to MacOS Monterey, and only after updating am I getting this error: [MTLDebugCommandBuffer lockPurgeableObjects]:2103: failed assertion `MTLResource 0x14a8a8cc0 (label: null), referenced in cmd buffer 0x149091400 (label: null) is in volatile or empty purgeable state at commit' I haven't changed my code at all between updating to the latest OS, and it worked perfectly before. How can I fix this? I don't think there should be any reason that I can't use a command buffer on a texture resource with a volatile/empty purgeable state.
Replies
4
Boosts
0
Views
3.9k
Activity
Jan ’22
Error while converting MTLTexture to CVPixelBuffer
I am getting an error from the graphics driver while converting the EnvironmentTexture(from ARKIT.AREnvironmentProbeAnchor) to CVPixelBuffer. The EnvironmentTexture is an IMTLTexture. I am using Xamarin.iOS. This is the code that I use to convert the IMTLTexture to CVPixelBuffer. buffers[i] = new CVPixelBuffer((nint)epAnchor.EnvironmentTexture.Width, (nint)epAnchor.EnvironmentTexture.Height, CVPixelFormatType.CV32RGBA); GetEnvironmentTextureSlice(buffers[i], epAnchor.EnvironmentTexture, i); public void GetEnvironmentTextureSlice(CVPixelBuffer pixelBuffer, Metal.IMTLTexture texture, int id) { Metal.MTLRegion mtlRegion = Metal.MTLRegion.Create2D((nuint)0, 0, 256, 256); nuint bytesPerPixel = 4; nuint bytesPerRow = bytesPerPixel * (nuint)mtlRegion.Size.Width; // (nuint)pixelBuffer.BytesPerRow; nuint bytesPerImage = bytesPerRow * (nuint)mtlRegion.Size.Height; pixelBuffer.Lock(CVPixelBufferLock.None); texture.GetBytes(pixelBuffer.BaseAddress, (nuint)pixelBuffer.BytesPerRow, mtlRegion, 0); pixelBuffer.Unlock(CVPixelBufferLock.None); } The error I am getting from the driver is AGX: Texture read/write assertion failed: bytes_per_row = used_bytes_per_row I tried with different values of pixelBuffer.BytesPerRow but still getting the error. Can someone help me?
Replies
1
Boosts
0
Views
2.5k
Activity
Dec ’21
Can someone walk me through the app launch sequence at a low level?
Sorry if this is a bad question or if this is asked so much it's like a routine to copy-and-paste this sort of stuff whenever someone else asks but I've been trying to get into Xcode and Swift app development for a while now and I do it on and off in a cycle. I try to get into it and start working with Xcode directly and doing stuff the proper way but I get frustrated by the amount of stuff that seems to go over my head and try to find a different way to make my coding projects / experiments a reality. When I make a new project, there's tons of stuff going on and I feel like I'm just expected to work around it with no idea how any of it works. I guess my head works very much from the ground up, needing to know how things work down to the most basic level for me to incorporate any knowledge into my understanding of a subject. When I try to create a new project from the game template (I use game because it seems closest to my graphing experiment ideas,) there's all sorts of stuff created; AppDelegate, GameScene, ViewControler, Main.storyboard etc and when I launch all this stuff just works. I look at the dev documentation and start to figure stuff out like ok when the app launches it finds the storyboard but how? Where's the option that tells the app the name of the file to launch as the storyboard? How does the viewControler represented in the storyboard know which file represents it? Ok so the dev doc says that the first step in the app launch sequence is UIApplicationMain() but where does it actually get executed from? The app? The OS? There are arguments passed to it so that's where the app delegate comes in but where are the actual args specified? I guess what I'm looking for is the answers to "how would I create all this from scratch? How would I create this without Xcode, go from empty folder with a .app extension to minimal working 2d graphing app and how does all of it work? How does the macOS interpret and properly execute an app?" I'm used to working with building apps in Java and whatnot from scratch, building windows with methods and one main method specified for debug by the compiler / fed to the jar file to first be executed when the file is opened and stuff like that. Ever since reading the Swift guide I found at the official Swift website I've absolutely fallen in love with the language; never before have I thought a language was 'my kind of language' or whose syntax is just perfectly logical to me. I suppose one of the things I really want is to be able to use Swift like Java when it comes to apps and have everything in the code and be able to trace it for myself and work with things through objects and methods and such I hope this makes sense to someone and they can point me in the right direction and get me started reading at the right spot to click on links and branch out my reading from there. Can't wait to get into actual app development the right way instead of using hack solutions like working through Java, C, C++ or whatever and sometimes having to use the app stuff anyways and also using Swift outside of playing around in playgrounds and thinking 'I really wish I could just create an app that just compiles and launches this like the playground'
Replies
2
Boosts
0
Views
1.1k
Activity
Nov ’21
low-level graphic programming in C++
Requirements : I need to draw 2D lines, circles, boxes. Fast. That's it. I don't want to learn objC, Swift, Xcode. I'm using C++ and Jetbrains' CLion. OpenGL is deprecated (or soon to be) on Mac I don't even care about Apple (as you probably guessed), but the M1 processor is just too good. (and fanless <3) I'll be happy as long as it runs on my MacBook Air Text would be a useful feature but totally optional I won't even use sprites, or any kind of assets, sound, keyboard, mouse, IO, GUI. I need pure non-interactive visualisation of science-ish stuff. fast FPS, refreshing the visualization as fast as possible. Even if it's a pure framebuffer (an array of pixels), I'll manage. If it's a full fledged 3D accelerated graphic library (eg : openGL, Vulkan, Metal), it also works for me. "as long as it works" What kind of options are available to me with the aforementioned requirements ? use openGL anyway and cry when it will no longer works ? (meh) hack my way to Metal in C++ ? I'm fine if a suggested library isn't Object Oriented (eg : openGL) Vulkan ? I still need to open a graphic window context somehow SDL2 appears to have a some kind of Metal backend/port/whatever but all the exemples I find are in ObjC. honestly, my post feel like I'm crying for a documented c++ metal wrapper of some kind I suppose ? EDIT : I read mixed message and confusion on the Future of OpenGL on Mac. Mostly about "no longer supported" vs "Deprecated". Will OpenGL be removed and no longer works. Or it will works but won't be updated anymore ? (considering my requirements, an outdated version of OpenGL is perfectly fine to me) Thank you <3
Replies
4
Boosts
0
Views
6.7k
Activity
Oct ’21