Create and manage OpenGL rendering contexts for use in macOS, and perform operations on drawable objects.

Posts under OpenGL tag

46 Posts

Post

Replies

Boosts

Views

Activity

Application freezes on glTexImage2D
My application freezes on a call to glTexImage2D, this is the stack trace I get from the lldb: thread #3 frame #0: 0x00000001bb04d9b4 libsystem_kernel.dylib`mach_msg_trap + 8 frame #1: 0x00000001bb04dd60 libsystem_kernel.dylib`mach_msg + 76 frame #2: 0x00000001bdb28dd0 IOKit`io_connect_method + 440 frame #3: 0x00000001bdb28bec IOKit`IOConnectCallMethod + 236 frame #4: 0x00000001d5b1b970 IOGPU`IOGPUResourceCreate + 224 frame #5: 0x00000001d5b159f8 IOGPU`-[IOGPUMetalResource initWithDevice:remoteStorageResource:options:args:argsSize:] + 476 frame #6: 0x00000001d5b18ab8 IOGPU`-[IOGPUMetalTexture initWithBuffer:descriptor:sysMemOffset:sysMemRowBytes:vidMemSize:vidMemRowBytes:args:argsSize:isStrideTexture:] + 616 frame #7: 0x00000001d5b1925c IOGPU`-[IOGPUMetalTexture initWithPrimaryBuffer:heapIndex:bufferIndex:bufferOffset:length:descriptor:sysMemRowBytes:vidMemSize:vidMemRowBytes:args:argsSize:] + 96 frame #8: 0x000000021c45bc10 AGXMetal13_3`___lldb_unnamed_symbol4663$$AGXMetal13_3 + 468 frame #9: 0x0000000133953aa8 AppleMetalOpenGLRenderer`GLDTextureRec::loadObj() + 3156 frame #10: 0x000000013398a960 AppleMetalOpenGLRenderer`gldModifyTexSubImage + 160 frame #11: 0x000000021bd9a7e8 GLEngine`glTexImage2D_Exec + 1944 frame #12: 0x000000021bd7b8d0 libGL.dylib`glTexImage2D + 80 My questions are: how could a call to glTexImage2D freezes and cause the thread stuck forever? Why and how to solve it? Thank you in advance, and looking forward to any suggestions
4
0
2.1k
Dec ’21
Metal performance lower than openGL when using MSAA,why
I have an multiple render-backend application on MacOS,so I can compare the performance between Metal and OpenGL about OffscreenRender. I found that, when I do not use MSAA,metal perform better.But when I open MSAA,especially at Large-texture,such as 3840x1920, metal seems slower. Then I simplify the render-pass, no draw call, seems it's the clear of texture was the difference of Metal and OpenGL, I'm not sure. in OpenGL,I use glClearBufferfv; in Metal, I set colorAttachments.loadAction=MTLLoadActionClear(I tried enalbe or disable tripple-buffering); Then I close the clear-action both on OpenGL and Metal,render-pass time of openGL reduce about 3ms ,Metal reduce about 8ms, Is that mean Metal take more time to clear texture? How can I resolve with such problem? (because I need clear-action) @Apple Device: Mac-mini-2018 Xcode: Xcode13.0 Here is the metal instrument screen-shot(idle of GPU seems too long,about 50ms):
0
1
1.1k
Nov ’21
Can someone explain this to me ?
I am running a program and I want to render and display a 3D bunny. Therefore we use pyrender and trimesh. In my university class they showed a trick so that the rendering is running on a side thread so that we can still interact with the window and change things. This works for everyone but not for me. Here is my code. bunny = trimesh.load("/bun_zipper.ply") mesh = pyrender.Mesh.from_trimesh(bunny) scene = pyrender.Scene(ambient_light=[.5, .5, .5], bg_color=[0, 0, 0]) node = pyrender.Node(name="Node", mesh=mesh) scene.add_node((node)) v = pyrender.Viewer(scene,run_in_thread=True) the problem is here the run_in_thread=True. Without this argument it works fine for me but with that argument I get the following error message: 2021-10-26 10:03:53.756 Python[89940:3624072] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/0m/8zgbz49j2032wtvwfxv6rw2r0000gn/T/org.python.python.savedState 2021-10-26 10:03:53.765 Python[89940:3624072] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!' *** First throw call stack: ( 0 CoreFoundation 0x00007fff2067e1db __exceptionPreprocess + 242 1 libobjc.A.dylib 0x00007fff203b7d92 objc_exception_throw + 48 2 CoreFoundation 0x00007fff206a68e6 -[NSException raise] + 9 3 AppKit 0x00007fff22e35eb2 -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 321 4 AppKit 0x00007fff22e20aa2 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1296 5 AppKit 0x00007fff22e2058b -[NSWindow initWithContentRect:styleMask:backing:defer:] + 42 6 libffi.dylib 0x00007fff2daec8f5 ffi_call_unix64 + 85 7 ??? 0x0000700002521400 0x0 + 123145341244416 ) libc++abi: terminating with uncaught exception of type NSException
0
0
1k
Oct ’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.3k
Oct ’21
openGL iPad game on M1 with 11.3
Previously on 11.2.3 I was able to run my OpenGL game targeting my M1 Mac mini as an iPad game. After updating to macOS 11.3 I am now getting an error in Metal. Is this expected moving forward and a sign that we need to focus on porting to Metal sooner rather than later? -[_MTLFunctionInternal baseObject]: unrecognized selector sent to instance 0x13046dab0 Crashing on: glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, nullptr); Thanks, Steven Behnke
4
0
3.1k
Aug ’21
[IOS 14] EXC_BAD_ACCESS CRASH FROM COM.APPLE.ARKIT.ARDISPLAYLINK
Steps to reproduce: Download and open the attached "ARKitTest" project Build and deploy the project to iOS Reproduced with:2018.4.31f1, 2019.4.20f1, 2020.2.4f1, 2021.1.0b5, 2021.2.0a4 Reproducible with iPhone 12 Pro (iOS 14.2.1) [Bug] iOS app crashes after some time (EXC_BAD_ACCESS) · Issue #716 · Unity-Technologies/arfoundation-samples (github.com) https://github.com/Unity-Technologies/arfoundation-samples/issues/716 Unity Issue Tracker - [iOS 14] EXC_BAD_ACCESS crash from com.apple.arkit.ardisplaylink (unity3d.com) https://issuetracker.unity3d.com/issues/ios-14-exc-bad-access-crash-from-com-dot-apple-dot-arkit-dot-ardisplaylink
0
0
1.2k
Jul ’21
Application freezes on glTexImage2D
My application freezes on a call to glTexImage2D, this is the stack trace I get from the lldb: thread #3 frame #0: 0x00000001bb04d9b4 libsystem_kernel.dylib`mach_msg_trap + 8 frame #1: 0x00000001bb04dd60 libsystem_kernel.dylib`mach_msg + 76 frame #2: 0x00000001bdb28dd0 IOKit`io_connect_method + 440 frame #3: 0x00000001bdb28bec IOKit`IOConnectCallMethod + 236 frame #4: 0x00000001d5b1b970 IOGPU`IOGPUResourceCreate + 224 frame #5: 0x00000001d5b159f8 IOGPU`-[IOGPUMetalResource initWithDevice:remoteStorageResource:options:args:argsSize:] + 476 frame #6: 0x00000001d5b18ab8 IOGPU`-[IOGPUMetalTexture initWithBuffer:descriptor:sysMemOffset:sysMemRowBytes:vidMemSize:vidMemRowBytes:args:argsSize:isStrideTexture:] + 616 frame #7: 0x00000001d5b1925c IOGPU`-[IOGPUMetalTexture initWithPrimaryBuffer:heapIndex:bufferIndex:bufferOffset:length:descriptor:sysMemRowBytes:vidMemSize:vidMemRowBytes:args:argsSize:] + 96 frame #8: 0x000000021c45bc10 AGXMetal13_3`___lldb_unnamed_symbol4663$$AGXMetal13_3 + 468 frame #9: 0x0000000133953aa8 AppleMetalOpenGLRenderer`GLDTextureRec::loadObj() + 3156 frame #10: 0x000000013398a960 AppleMetalOpenGLRenderer`gldModifyTexSubImage + 160 frame #11: 0x000000021bd9a7e8 GLEngine`glTexImage2D_Exec + 1944 frame #12: 0x000000021bd7b8d0 libGL.dylib`glTexImage2D + 80 My questions are: how could a call to glTexImage2D freezes and cause the thread stuck forever? Why and how to solve it? Thank you in advance, and looking forward to any suggestions
Replies
4
Boosts
0
Views
2.1k
Activity
Dec ’21
Metal performance lower than openGL when using MSAA,why
I have an multiple render-backend application on MacOS,so I can compare the performance between Metal and OpenGL about OffscreenRender. I found that, when I do not use MSAA,metal perform better.But when I open MSAA,especially at Large-texture,such as 3840x1920, metal seems slower. Then I simplify the render-pass, no draw call, seems it's the clear of texture was the difference of Metal and OpenGL, I'm not sure. in OpenGL,I use glClearBufferfv; in Metal, I set colorAttachments.loadAction=MTLLoadActionClear(I tried enalbe or disable tripple-buffering); Then I close the clear-action both on OpenGL and Metal,render-pass time of openGL reduce about 3ms ,Metal reduce about 8ms, Is that mean Metal take more time to clear texture? How can I resolve with such problem? (because I need clear-action) @Apple Device: Mac-mini-2018 Xcode: Xcode13.0 Here is the metal instrument screen-shot(idle of GPU seems too long,about 50ms):
Replies
0
Boosts
1
Views
1.1k
Activity
Nov ’21
Can someone explain this to me ?
I am running a program and I want to render and display a 3D bunny. Therefore we use pyrender and trimesh. In my university class they showed a trick so that the rendering is running on a side thread so that we can still interact with the window and change things. This works for everyone but not for me. Here is my code. bunny = trimesh.load("/bun_zipper.ply") mesh = pyrender.Mesh.from_trimesh(bunny) scene = pyrender.Scene(ambient_light=[.5, .5, .5], bg_color=[0, 0, 0]) node = pyrender.Node(name="Node", mesh=mesh) scene.add_node((node)) v = pyrender.Viewer(scene,run_in_thread=True) the problem is here the run_in_thread=True. Without this argument it works fine for me but with that argument I get the following error message: 2021-10-26 10:03:53.756 Python[89940:3624072] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/0m/8zgbz49j2032wtvwfxv6rw2r0000gn/T/org.python.python.savedState 2021-10-26 10:03:53.765 Python[89940:3624072] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!' *** First throw call stack: ( 0 CoreFoundation 0x00007fff2067e1db __exceptionPreprocess + 242 1 libobjc.A.dylib 0x00007fff203b7d92 objc_exception_throw + 48 2 CoreFoundation 0x00007fff206a68e6 -[NSException raise] + 9 3 AppKit 0x00007fff22e35eb2 -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 321 4 AppKit 0x00007fff22e20aa2 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1296 5 AppKit 0x00007fff22e2058b -[NSWindow initWithContentRect:styleMask:backing:defer:] + 42 6 libffi.dylib 0x00007fff2daec8f5 ffi_call_unix64 + 85 7 ??? 0x0000700002521400 0x0 + 123145341244416 ) libc++abi: terminating with uncaught exception of type NSException
Replies
0
Boosts
0
Views
1k
Activity
Oct ’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.3k
Activity
Oct ’21
openGL iPad game on M1 with 11.3
Previously on 11.2.3 I was able to run my OpenGL game targeting my M1 Mac mini as an iPad game. After updating to macOS 11.3 I am now getting an error in Metal. Is this expected moving forward and a sign that we need to focus on porting to Metal sooner rather than later? -[_MTLFunctionInternal baseObject]: unrecognized selector sent to instance 0x13046dab0 Crashing on: glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, nullptr); Thanks, Steven Behnke
Replies
4
Boosts
0
Views
3.1k
Activity
Aug ’21
[IOS 14] EXC_BAD_ACCESS CRASH FROM COM.APPLE.ARKIT.ARDISPLAYLINK
Steps to reproduce: Download and open the attached "ARKitTest" project Build and deploy the project to iOS Reproduced with:2018.4.31f1, 2019.4.20f1, 2020.2.4f1, 2021.1.0b5, 2021.2.0a4 Reproducible with iPhone 12 Pro (iOS 14.2.1) [Bug] iOS app crashes after some time (EXC_BAD_ACCESS) · Issue #716 · Unity-Technologies/arfoundation-samples (github.com) https://github.com/Unity-Technologies/arfoundation-samples/issues/716 Unity Issue Tracker - [iOS 14] EXC_BAD_ACCESS crash from com.apple.arkit.ardisplaylink (unity3d.com) https://issuetracker.unity3d.com/issues/ios-14-exc-bad-access-crash-from-com-dot-apple-dot-arkit-dot-ardisplaylink
Replies
0
Boosts
0
Views
1.2k
Activity
Jul ’21