`
izuoyan
  • 浏览: 8933859 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

OpenGL 中的 Render To Texture

阅读更多

很多人问过在OpenGL中如何做RenderToTexture。在这里总结一下
早期的OpenGL里没有显式的支持RTT(Render To Te texture) 。 但是glCopyTexImage 可以从frameBuffer 读取纹理到texture中的函数,可以把framebuffer里的东西拷贝到纹理。不过这个函数相比D3D的RenderTarget还是有很大的区别的。但是加上多个Buffer (GL_FROMT , GL_BACK GL_AUXn等) 基本可以达到D3D 的RT的功能。不过性能和方便程度上还不如D3D。
于是就有了PBuffer这个东西。PBuffer这个东西我没用过,不做介绍。但是基本上是他可以创建一个Offscreen的RC。。。ATI在Linux下有ATI_PBuffer。。。不过NV没有。所以我没用。
再后来就是FBO , Frame Buffer Object。 FrameBufferObject可以有16个Attachment。可以连接各种个对象。这个个对象可以是纹理,可以是RenderBuffer(就是一个内部是哟功能的buffer)。 他们分别连接到16个颜色缓冲区(就是普通的RenderTarget)也可以是DepthBuffer。 很方便。你要做RTT的时候,申请一个fBO。 然后把一个纹理连接到FBO的COLOR ATTACHMENT上。绘制就可以绘制到纹理上。DepthBuffer一样处理。很是方便的。
在这里还不得不介绍一下PBO,PBO的目的是在显存中快速传输数据。 它可以很快把一个FrameBuffer和Texture中的数据进行对拷。同时也可以把一个Pixel的数据当做一个Vertex BufferObject来用。所以我们可以把FrameBuffer读回到FBO中。把FBO当个纹理数据用(RTT),也可以当作VBO来用。这就是R2VB。

以下提供一个FBO Class下载地址:
http://sourceforge.net/project/showfiles.php?group_id=104004&package_id=158526
同时FBO的官方文档请到www.opengl.org下载

本人渲染器中也有对FBO的完全封装。等完善后会公布代码。

分享到:
评论

相关推荐

    Render to Texture

    OpenGL渲染到纹理的实现,并有用户交互

    015_render_to_texture.zip_linux opengl_opengl texture_render to

    render_to_texture using opengl

    projective_texture_mapping

    Projective texture mapping refers both to the way texture coordinates are assigned to vertices, and the way they are computed during rasterization of primitives. We usually think of texture mapping as...

    OpenGL Data Visualization Cookbook

    About This Book, Get acquainted with a set of fundamental OpenGL primitives and concepts that enable users to create stunning visuals of arbitrarily complex 2D and 3D datasets for many common ...

    OpenGL ES 3.0 Programming Guide, 2nd Edition

    They carefully introduce OpenGL ES 3.0 features such as shadow mapping, instancing, multiple render targets, uniform buffer objects, texture compression, program binaries, and transform feedback. ...

    Android代码-java-obj-to-opengl

    The result object will contain all the necessary data for render of the 3d model with OpenGL ES on for example Android. Resulting file will contain float buffers with Vertices, Normals and Texture ...

    使用FBO,渲染到纹理

    testing Frame Buffer Object (FBO) for "Render To Texture" 使用opengl的帧缓冲区对象,执行渲染到纹理操作,调试的老外写的例子 测试可用,非常适合入门学习研究

    OpenGL Shading Language, Second Edition

    Introduction to the OpenGL Shading Language Section 2.2. Why Write Shaders? Section 2.3. OpenGL Programmable Processors Section 2.4. Language Overview Section 2.5. System Overview Section 2.6. Key ...

    OpenGL development cookbook

    For reflective objects, such as mirrors and dynamic reflections, render-to-texture functionality using FBO and dynamic cube mapping are detailed. In addition to graphics, image processing techniques ...

    opengl渲染到纹理技术

    opengl渲染到纹理技术,RendertoaTexture很好的例子

    RenderTexTure

    工程是通过VS2010写的,在MFC(C++)的基础上添加了OpenGL纹理贴图 ,里面包含了从初始化各种OpenGL环境开始,到读取一张图片,到得到图片的数据开始转换,再到渲染到窗口的全过程,这是我从项目纹理贴图部分提取出来...

    阿里云API精选手册 Version 1(高清)pdf

    The OpenGL graphics libraries offer programmers the ability to construct and render remarkably realistic 3-D scenes that can incorporate multiple lighting sources, various types of perspective, and ...

    Android代码-AndroidViewToGLRendering

    It uses OpenGL ES 2.0 to render Android's View in real time How to use Init GLSurfaceView as usual Create a subclass of ViewToGLRenderer and set it to the GLSurfaceView instance Extend the View...

    terrain engine

    Used OpenGL for this one, employing the OGLC skeleton to avoid most of the opengl-win32 business. You can move through ... use 'w' to switch to wire-frame and 'd' to render without the detail texture.

    OpenPy:python中的OpenGL批处理渲染

    OpenPy的python中的OpenGL批处理渲染使成为首先要绘制东西,需要一个Render2D实例,Window已经有一个实例,所以 然后调用render.DrawQuad(position,size,color),在这种情况下,position和size是glm.vec2 ,...

    gl33lessons:OpenGL 3.3+ 课程

    课程清单(进行中)为不久的将来计划的课程主题在不久的将来,计划考虑以下主题,顺序和内容可能会在工作过程中发生变化: 渲染到多个纹理( MRT - multi render targets ) 纹理字体( texture fonts ) 伪凹凸( ...

    SDL2_Tutorials

    43_render_to_texture 44_frame_independent_movement 45_timer_callbacks 46_multithreading 47_semaphores 48_atomic_operations 49_mutexes_and_conditions 50_SDL_and_opengl_2 51_SDL_and_modern_opengl 52_...

    Qt5 Data Visualization 3D官方教程配套示例代码

    - Surfaces with non-straight rows and columns do not always render properly. - Q3DLight class (and Light3D QML item) are currently not usable for anything. - Changing most of Q3DScene properties ...

    Deferred Shading延迟渲染.zip

    Exercise 9:Deferred Shading的实现 要求: 1.在练习8的基础上,实现Deferred Shading算法; 考察目的: ...2.通过FrameBufferObject实现render-to-texture技术; 3.实现multiple-render-targets技术;

    OpenSceneGraph三维渲染引擎设计与实践

    7.2.3 渲染到纹理(render to texture) 181 7.2.4 范例:将场景渲染到纹理 183 7.3 视景器 186 7.3.1 视景器的主要工作 186 7.3.2 单视景器与多视景器 188 7.3.3 范例:投影墙显示 191 7.3.4 范例:多视景器...

Global site tag (gtag.js) - Google Analytics