我可以使用OpenGL进行离屏渲染? [英] Can I use OpenGL for off-screen rendering?

查看:186
本文介绍了我可以使用OpenGL进行离屏渲染?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想尝试做一个简单的程序,需要一个3D模型,渲染成一个图像。有没有什么办法,我可以使用OpenGL渲染图像,并把它变成一个保存了图像,而不是显示图像的变量?我不希望看到我使我只是想救它。有没有什么办法可以用OpenGL做到这一点?

I want to try to make a simple program that takes a 3D model and renders it into an image. Is there any way I can use OpenGL to render an image and put it into a variable that holds an image rather than displaying an image? I don't want to see what I'm rendering I just want to save it. Is there any way to do this with OpenGL?

推荐答案

是的,你可以做到这一点。你要做的就是创建一个帧缓冲对象(FBO)通过纹理的支持。一旦你创建一个和借鉴它,你可以下载纹理主存储器和保存它就像你的任何位图。

Yes, you can do that. What you want to do is create a frame buffer object (FBO) backed by a texture. Once you create one and draw to it, you can download the texture to main memory and save it just like you would any bitmap.

这篇关于我可以使用OpenGL进行离屏渲染?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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