2013年3月10日 星期日

OpenGL Blend


glBlendFunc — specify pixel arithmetic
  • void glBlendFunc(GLenum sfactor, GLenum dfactor);
  • void glBlendFunci(GLuint buf, GLenum sfactor, GLenum dfactor);
Parameters
  1. buf
    • For glBlendFunci, specifies the index of the draw buffer for which to set the blend function.
  2. sfactor
    • Specifies how the red, green, blue, and alpha source blending factors are computed. The initial value is GL_ONE.
  3. dfactor
    • Specifies how the red, green, blue, and alpha destination blending factors are computed. The initial value is GL_ZERO. The following symbolic constants are accepted: 
      • GL_ZERO, GL_ONE
      • GL_SRC_COLOR
      • GL_ONE_MINUS_SRC_COLOR
      • GL_DST_COLOR
      • GL_ONE_MINUS_DST_COLOR
      • GL_SRC_ALPHA
      • GL_ONE_MINUS_SRC_ALPHA
      • GL_DST_ALPHA
      • GL_ONE_MINUS_DST_ALPHA
      • GL_CONSTANT_COLOR
      • GL_ONE_MINUS_CONSTANT_COLOR
      • GL_CONSTANT_ALPHA
      • GL_ONE_MINUS_CONSTANT_ALPHA

Qt5 + OpenGL


前幾天發現在Qt5裡,所有的fixed function pipeline都不能編譯了。稍微google了一下,才發現,原來Qt5所有precompile的安裝包,都是用ANGLE layer來實作OpenGL ES2,也就是你要寫的是OpenGL ES2,而不是OpenGL。所以一些fixed function pipeline的function,例如glBegin/glEnd都不能用了。

2013年3月3日 星期日

在Qt中,使用系統預設的圖示

QStyle定義了一些系統視窗相關的風格,像是圖示和gui的樣式。 qApp->style()->standardIcon(QStyle::SP_MediaVolumeMuted)
另外,也可以用 
QStyleFactory::keys();列出可以建立的style,例如"Windows", "WindowsXP", "WindowsVista", "Fusion"
QStyleFactory::create(QString style);
建立特殊的style,例如"Windows", "WindowsXP", "WindowsVista", "Fusion" 詳細清單