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 :(
Post
Replies
Boosts
Views
Activity
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.
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?
I am using
newBufferWithBytesNoCopy(...) now, but I get an Access Violation :(
the pointer I pass is 6404804 so it is aligned
ideas?
sorry :)
I'm using
posix_memalign() now and it works perfectly,
thx