平民程序 - linghuye's blog

天下风云出我辈,一入江湖岁月催。皇图霸业谈笑中,不胜人生一场醉。提剑跨骑挥鬼雨,白骨如山鸟惊飞。尘事如潮人如水,只笑江湖几人回。

随笔 - 221, 文章 - 0, 评论 - 680, 引用 - 0
数据加载中……

glDrawBuffers和GL_TEXTURE_RECTANGLE_NV对渲染概念的扩展

1.建立并进入一个PBuffer Context,依次使用glDrawBuffer切换到其中的各辅助Draw Buffer(GL_AUXn),清除其颜色和深度缓冲区.
2.使用glDrawBuffersATI设置目标为一个Draw Buffer数组,作图,则数组中所有Draw Buffer都将反映作图指令.
3.切回主窗口Context,使用wglBindTexImageARB将PBuffer中的某个Draw Buffer绑定到当前纹理,作图.

Note:
1. NV_texture_rectangle extension adds a new texture target that supports 2D textures without requiring power-of-two dimensions.
   glEnable(GL_TEXTURE_RECTANGLE_NV);
   glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
2.使用glWindowPos2dARB直接设置当前窗口象素坐标系下的位置,避过当前变换矩阵的影响.
3.使用ARB_transpose_matrix,使得程序能传递/接收常规的C/C++下的行主存储矩阵数组,
   glLoadTransposeMatrixARB,glMultTransposeMatrixARB,
   TRANSPOSE_MODELVIEW_MATRIX_ARB 
   TRANSPOSE_PROJECTION_MATRIX_ARB 
   TRANSPOSE_TEXTURE_MATRIX_ARB 
   TRANSPOSE_COLOR_MATRIX_ARB, 隶属1.3标准
4.使用glBlendColorEXT定义一个常量颜色值,然后在glBlendFunc中使用如下factor,使得所定义的颜色作为factor参与Blend运算公式. 
   CONSTANT_COLOR_EXT
   ONE_MINUS_CONSTANT_COLOR_EXT
   CONSTANT_ALPHA_EXT     
   ONE_MINUS_CONSTANT_ALPHA_EXT
5.GL_MIRRORED_REPEAT_ARB 镜像反复的纹理wrap模式
6.glMultiDrawArraysEXT:
   These functions behave identically to the standard OpenGL 1.1 functions glDrawArrays() and glDrawElements() except they handle multiple lists of vertices in one call. Their main purpose is to allow one function call to render more than one primitive such as triangle strip, triangle fan,etc.
7.使用 glBlendFuncSeparateEXT(enum sfactorRGB, enum dfactorRGB,  enum sfactorAlpha, enum dfactorAlpha);
   依然根据Blend方程但分开计算颜色中的RGB部分和Alpha部分.
8.ARB_texture_non_power_of_two是个很有意思很强很好用的扩展,它既没添加新函数,也没添加新模式,如果从驱动程序中能得到该扩展,则表明所有纹理操作支持非2次方大小模式.
9.SGIS_generate_mipmap,  glTexParameteri(GL_TEXTURE_2D, GENERATE_MIPMAP_SGIS, GL_TRUE)
   This extension defines a mechanism by which OpenGL can derive the entire set of mipmap arrays when provided with only the base level array.  Automatic mipmap generation is particularly useful when texture images are being provided as a video stream.
10.ARB_multisample,使用wglChoosePixelFormatARB建立支持WGL_SAMPLE_BUFFERS_ARB的Context,在需要进行多重采样抗锯齿的地方使用glEnable(GL_MULTISAMPLE_ARB).
int iAttributes[] =
{
     WGL_DRAW_TO_WINDOW_ARB,GL_TRUE,
     WGL_SUPPORT_OPENGL_ARB,GL_TRUE,
     WGL_ACCELERATION_ARB,WGL_FULL_ACCELERATION_ARB,
     WGL_COLOR_BITS_ARB,24,
     WGL_ALPHA_BITS_ARB,8,
     WGL_DEPTH_BITS_ARB,16,
     WGL_STENCIL_BITS_ARB,0,
     WGL_DOUBLE_BUFFER_ARB,GL_TRUE,
     WGL_SAMPLE_BUFFERS_ARB,GL_TRUE,
     WGL_SAMPLES_ARB,4,
     0,0
 };

11. The buffer region extension is a mechanism that allows an area of
    an OpenGL window to be saved in off-screen memory for quick
    restores.  The off-screen memory can either be frame buffer memory
    or system memory.
   HANDLE wglCreateBufferRegionARB(HDC hDC, int iLayerPlane, UINT uType)
   VOID wglDeleteBufferRegionARB(HANDLE hRegion)
    BOOL wglSaveBufferRegionARB(HANDLE hRegion, int x, int y, int width, int height)
    BOOL wglRestoreBufferRegionARB(HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc)

12.使用纹理传送浮点数组缓冲给Shader
      float *data1 = new float[kImageWidth * kImageHeight * 3];
      glEnable(GL_TEXTURE_RECTANGLE_ARB);
      glBindTexture(GL_TEXTURE_RECTANGLE_ARB, textures[0]);
 glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA32F_ARB, kImageWidth, kImageHeight, 0, GL_RGB, GL_FLOAT, data1);
 glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
 glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

13.使用glVertexBlendARB指定顶点受到几个变换矩阵的影响.使用glEnable(GL_WEIGHT_SUM_UNITY_ARB);指定权重之和为1.使用glEnable(GL_VERTEX_BLEND_ARB);激活顶点混合模式.使用glWeightPointerARB(3, GL_FLOAT, 0, Weights);glEnableClientState(GL_WEIGHT_ARRAY_ARB);绑定每个顶点的权重值(以vector形式表达,未知),使用型如:glMatrixMode(GL_MODELVIEW0_ARB);进入每个矩阵模式,并设置变换矩阵.

意随心走,无拘无束,自由的Opengl.

Reference:
http://oss.sgi.com/projects/ogl-sample/registry/index.html

posted on 2005-09-25 21:34 linghuye 阅读(2994) 评论(2)  编辑 收藏 引用 所属分类: 3D图形学研究

评论

# Hey, good to find someone who ageres with me. GMTA.  回复  更多评论   

Hey, good to find someone who ageres with me. GMTA.
2011-05-23 07:05 | Makailee
只有注册用户登录后才能发表评论。