OpenGL函数及参数

http://msdn.microsoft.com/en-us/library/windows/desktop/dd368826(v=vs.85).aspx 
PIXELFORMATDESCRIPTOR structure

此结构体在wingdi.h中。

PIXELFORMATDESCRIPTOR结构体描述了绘制曲面的像素格式。 

typedef struct tagPIXELFORMATDESCRIPTOR {
  WORD  nSize;
  WORD  nVersion;
  DWORD dwFlags;
  BYTE  iPixelType;
  BYTE  cColorBits;
  BYTE  cRedBits;
  BYTE  cRedShift;
  BYTE  cGreenBits;
  BYTE  cGreenShift;
  BYTE  cBlueBits;
  BYTE  cBlueShift;
  BYTE  cAlphaBits;
  BYTE  cAlphaShift;
  BYTE  cAccumBits;
  BYTE  cAccumRedBits;
  BYTE  cAccumGreenBits;
  BYTE  cAccumBlueBits;
  BYTE  cAccumAlphaBits;
  BYTE  cDepthBits;
  BYTE  cStencilBits;
  BYTE  cAuxBuffers;
  BYTE  iLayerType;
  BYTE  bReserved;
  DWORD dwLayerMask;
  DWORD dwVisibleMask;
  DWORD dwDamageMask;

} PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR;

 

nSize

指定此数据结构的大小。使用sizeof(PIXELFORMATDESCRIPTOR)  设置此值 


nVersion 
指定此数据结构的版本。此值应该为1。

 dwFlags

用于指定像素buffer属性的一系列标志。这些属性大多数不是互斥的。你可以组合使用她们,但要注意例外。下面是一些被定义的标志常量: 

PFD_DRAW_TO_WINDOW 此buffer可画到窗体上
PFD_DRAW_TO_BITMAP 此buffer可画到内存bitmap上
PFD_SUPPORT_GDI 此标志与PFD_DOUBLEBUFFER 是互斥的
PFD_SUPPORT_OPENGL 此buffer支持用OpenGL绘图
PFD_GENERIC_ACCELERATED 像素格式支持设备驱动加速。
PFD_NEED_PALETTE 略。现在没有程序会使用调色版
PFD_NEED_SYSTEM_PALETTE 略。现在没有程序会使用调色版
PFD_DOUBLEBUFFER 此buffer是双缓冲。此标志与PFD_SUPPORT_GDI互斥。
PFD_STEREO 此buffer用于立体显示,像3D电影那样
PFD_SWAP_LAYER_BUFFERS 指明设备在此像素格式下,是否能交换独立的层平面。这些层平面包含在双缓冲区overlay中或underlay plane中。否则所有的层平面一起被交换。当设置此标志时,wglSwapLayerBuffers被支持。/td>
 

iPixelType

指定像素数据类型。下面是定义好的类型。
PFD_TYPE_RGBA   RGBA像素,每个像素由四部分组成:红、绿、蓝和透明度。
PFD_TYPE_COLORINDEX 颜色索引。每个像素使用颜色索引值。
cColorBits
指定每一个颜色buffer中颜色位平面的数量。对于RGAB像素类型,它的数量为颜色缓冲区的大小,颜色buffer的大小不包含alpha位平面。对于颜色索引,它的大小为颜色索引缓冲区的大小。
cRedBits
指定在每个RGBA颜色缓冲区中红色位平面的数量
cRedShift
Specifies the shift count for red bitplanes in each RGBA color buffer.
cGreenBits
Specifies the number of green bitplanes in each RGBA color buffer.
cGreenShift
Specifies the shift count for green bitplanes in each RGBA color buffer.
cBlueBits
Specifies the number of blue bitplanes in each RGBA color buffer.
cBlueShift
Specifies the shift count for blue bitplanes in each RGBA color buffer.
cAlphaBits
Specifies the number of alpha bitplanes in each RGBA color buffer. Alpha bitplanes are not supported.
cAlphaShift
Specifies the shift count for alpha bitplanes in each RGBA color buffer. Alpha bitplanes are not supported.
cAccumBits
Specifies the total number of bitplanes in the accumulation buffer.
cAccumRedBits
Specifies the number of red bitplanes in the accumulation buffer.
cAccumGreenBits
Specifies the number of green bitplanes in the accumulation buffer.
cAccumBlueBits
Specifies the number of blue bitplanes in the accumulation buffer.
cAccumAlphaBits
Specifies the number of alpha bitplanes in the accumulation buffer.
cDepthBits
Specifies the depth of the depth (z-axis) buffer.
cStencilBits
Specifies the depth of the stencil buffer.
cAuxBuffers
Specifies the number of auxiliary buffers. Auxiliary buffers are not supported.
iLayerType
Ignored. Earlier implementations of OpenGL used this member, but it is no longer used.
bReserved
Specifies the number of overlay and underlay planes. Bits 0 through 3 specify up to 15 overlay planes and bits 4 through 7 specify up to 15 underlay planes.
dwLayerMask
Ignored. Earlier implementations of OpenGL used this member, but it is no longer used.
dwVisibleMask
Specifies the transparent color or index of an underlay plane. When the pixel type is RGBA, dwVisibleMask is a transparent RGB color value. When the pixel type is color index, it is a transparent index value.
dwDamageMask

Ignored. Earlier implementations of OpenGL used this member, but it is no longer used. 

 

void glShadeModel ( GLenum mode);
设置着色模式。参数mode可以是GL_SMOOTH(默认值)或GL_FLAT。采用恒定着色时(即GL_FLAT),使用图元中某个顶点的颜色来渲染整个图元。

在使用光滑着色时(即GL_SMOOTH),独立的处理图元中各个顶点的颜色。对于线段图元,线段上各点的颜色将根据两个顶点的颜色通过插值得到。对于多边形图元,多边形内部区域的颜色将根据所有顶点的颜色插值得到。 

 

In double buffered contexts the glDrawBuffer and the glReadBuffer are both defaulting to GL_BACK.

posted @ 2012-06-07 09:59  thinkpore  阅读(719)  评论(0)    收藏  举报