Offscreen Rendering and Multisampling With OpenGL
来源:互联网 发布:c语言else语句格式 编辑:程序博客网 时间:2024/04/29 01:54
It has been for a while since my last post. I was enjoying with my senior project, “Accelerating Map Rendering with GPU”. In this project, my friend and I modified Mapnik, an opensource map rendering, to utilize Nvidia’s Path Rendering. Path Rendering is an OpenGL extension provided by Nvidia for vector graphic rendering. Nvidia claims that its extensions aims to reduce overhead from traditional APIs when using them to draw vector graphics. In the end, we are able to make the map production 30-60% faster. Our implementation can be found on https://github.com/ake-koomsin/mapnik_nvpr
There are two important things that we had to achieve in order to use Path Rendering extension for map rendering, offscreen rendering and multisampling. Offscreen rendering is important because we don’t want the renderer to show the intermediate result. Multisampling is for producing a quality map.
I think offscreen rendering combining with multisampling is an important piece of knowledge. It is also hard to find a complete refernce about these two. Therefore, I think it is worth writing about it.
Offscreen Rendering
Offscreen rendering is a technique that are commonly found in game development. Sometimes, there are situations that you want to generate a texture at runtime.
To set up offscreen rendering, you have to create your own “Framebuffer Object (FBO)”. Actually, OpenGL has its own default FBO. A result stored in the default FBO will be shown onto the screen while the result stored in our own FBO will be not. The code below demonstrates how to set up our own FBO.
Setting our own FBO for offscreen renderingIt is straightforward. First, we create a FBO. After that, we create render buffers and textures and attach them to our FBO.
Multisampling
By default, OpenGL does not care about antialiasing. As a result, the output contains stair-like artifacts which degrade visual quality. We have to enable multisampling by the code below.
Enabling multisamplingCombining Offscreen Rendering and Multisampling Together
It turns out that to combine them together, we need additional set up which are multisample framebuffer storage and multisample texture. The code below demonstrates how to do.
Setting up FBO with MultisamplingRetrieving the result
After offscreen rendering, you may want to display the result onto the screen. When you are using multisampling FBO, you are not able to use the result stored in the texture directly. You have to do “Blitting” which transfer the result from one FBO to another. The code below shows how to do.
BlittingI hope these snippets are a useful reference.
http://ake.in.th/2013/04/02/offscreening-and-multisampling-with-opengl/
- Offscreen Rendering and Multisampling With OpenGL
- offscreen rendering
- ShaderX3: Advanced Rendering with DirectX and OpenGL
- Offscreen WebKit Rendering
- 《ShaderX3-Advanced Rendering with DirectX and OpenGL book+code》下载
- pbuffer vs fbo in egl offscreen rendering
- nv sdk: transparency with multisampling笔记
- Real-Time 3D Rendering with DirectX and HLSL
- Android OpenGL ES 离屏渲染(offscreen render)
- OpenGL Rendering Pipeline
- OpenGL Rendering Pipeline
- OpenGL Rendering Pipeline
- 罗大柚OpenGL ES教程系列LessonFour(Part X):rendering multiple objects with different texture
- Stellarium:Compile with MSVC2012 and Qt5 (OpenGL)
- OpenGL LIGHTING AND ENVIRONMENT MAPPING WITH GLSL
- Rendering with Vertex Lighting
- rails layout and rendering
- Accelerated rendering and compositing
- 如何在myeclipse中打开系统下文件位置
- lintcode: Reverse Linked List
- 有人向我反馈了一个bug
- Android-BaseLine框架初识之网络请求(一)
- Setting up CocoaPods master repo
- Offscreen Rendering and Multisampling With OpenGL
- 一个四位数的9倍仍然是四位数,但是数字次序相反,编程求此四位数
- 技术实战:基于 MHA 方式实现 MySQL 的高可用
- TCP、UDP、IP 协议分析
- JDK和Tomcat官网下载,包含各个历史版本
- studio so库和jar包冲突
- 简述c#之sealed 修饰符
- 关于匿名函数构造器的继承问题
- sqoop常用命令