如何在不使用glDrawPixels的情况下将缓冲区对象渲染/绘制到帧缓冲区 [英] How to render/draw buffer object to framebuffer without glDrawPixels

查看:254
本文介绍了如何在不使用glDrawPixels的情况下将缓冲区对象渲染/绘制到帧缓冲区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据opengl规范4.0,不推荐使用glDrawPixels.

According to opengl spec 4.0 glDrawPixels is deprecated.

对于cuda互操作性,似乎最好使用"opengl缓冲对象". (一种替代方法可能是纹理或表面,但是它们具有缓存/并发问题,因此无法用于我的cuda内核.)

For cuda interoperability it seems best to use "opengl buffer objects". (An alternative could be textures or surfaces but these have caching/concurrency issues and are therefore unusable for my cuda kernel).

我只是想创建一个使用此映射的opengl缓冲区对象的cuda内核,并将其用作像素数组"或一块保存像素的内存,然后取消映射缓冲区.

I simply want to create a cuda kernel which uses this mapped opengl buffer object and uses it as a "pixel array" or a piece of memory holding pixels, later the buffer is unmapped.

然后,我希望opengl程序将缓冲区对象绘制到帧缓冲区.我想使用不被弃用的opengl api.

I then want the opengl program to draw the buffer object to the framebuffer. I would like to use an opengl api which is not deprecated.

还有什么其他方法/api将缓冲区对象绘制到帧缓冲区? (也不能使用渲染缓冲区,因为它们可能与cuda数组/缓存问题相同,因此排除了帧缓冲区对象/扩展名?!?).

What other ways/apis are there to draw a buffer object to the frame buffer ? (Also render buffers cannot be used since they probably have same issue as cuda arrays/caching issues, so this rules out framebuffer object/extension ?!?).

现在已不推荐使用glDrawPixels,opengl 4.0中是否存在间隙/缺失功能?还是有其他选择?

Is there a gap/missing functionality in opengl 4.0 now that glDrawPixels is deprecated ? Or is there an alternative ?

推荐答案

glDrawPixels已从GL 3.2及更高版本中删除(未弃用.弃用"表示可用于,但在未来").已将其删除,因为通常这不是将像素数据绘制到屏幕上的快速方法.

glDrawPixels has been removed from GL 3.2 and above (it is not deprecated. Deprecated means "available but to be removed in the future"). It was removed because it's generally not a fast way to draw pixel data to the screen.

您最好的选择是使用 glTexSubImage2D glBlitFramebuffer 从纹理中对其进行着色.

Your best bet is to use glTexSubImage2D to upload it to a texture, then draw that to the screen. Or blit it from the texture with glBlitFramebuffer.

这篇关于如何在不使用glDrawPixels的情况下将缓冲区对象渲染/绘制到帧缓冲区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆