Post

Replies

Boosts

Views

Activity

Reply to glDrawPixels equalent for Metal API
lets say I have a picture in a pixel buffer(RGBA). just wanna display it on the screen as raw data. in OpenGL i can just draw it directly on the screen by calling glDrawPixels. So my question is: can I do it the "same way" in Metal OR do I have to draw it on a texture and display it by drawing to triangles(to make a quad)? the last way is not a such good idea for my engine :(
Mar ’24
Reply to glDrawPixels equalent for Metal API
Yes, it is very important that the routine is fast. I calculate the image first (streaming data, like a video decoder) and than need the fastest way to "flip" it on the screen. I found this: [https://stackoverflow.com/questions/64267791/present-a-pixel-buffer-to-a-mtkview) Is this the fastest way, or is the solution with the texture better? I'm very interested in this tricks, but please provide C++ code.
Mar ’24
Reply to glDrawPixels equalent for Metal API
OK, I'm going to use func copy(from: any MTLBuffer, sourceOffset: Int, sourceBytesPerRow: Int, sourceBytesPerImage: Int, sourceSize: MTLSize, to: any MTLTexture, destinationSlice: Int, destinationLevel: Int, destinationOrigin: MTLOrigin) @Graphics and Games Engineer: how not to copy my data in the MTLBuffer every frame?
Mar ’24