OpenGL 程式設計/參考/glColor
外觀
- 更改下一個要繪製的物件的顏色
- 繪製 7 個點和 3 種不同的顏色
- 從 x 中點 y .5+ 開始,移動到 x .6+ y .5+
- 顯示即使重新啟動新的 gl 部分,顏色也會保持不變
- 顯示即使迴圈重新開始,顏色也會保持不變
- 在 基本測試應用程式 程式中用此替換 display 函式,以檢視結果
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_POINTS);
glVertex3f(0.0,0.5,0.0);//drawn white or default color first loop and green all other loops
glColor3f(1.0,0.5,0.0);//set red 100% green 50% blue 0%
glVertex3f(0.1,0.5,0.0);//drawn orange
glVertex3f(0.2,0.5,0.0);//drawn orange
glColor3f(1.0,0.0,0.0);//set red 100% green 0% blue 0%
glVertex3f(0.3,0.5,0.0);//drawn red
glEnd();
glBegin(GL_POINTS);
glVertex3f(0.4,0.5,0.0);//drawn red
glColor3f(0.0,1.0,0.0);//set red 0% green 100% blue 0%
glVertex3f(0.5,0.5,0.0);//drawn green
glVertex3f(0.6,0.5,0.0);//drawn green
glEnd();
glutSwapBuffers();
}
- WINGDIAPI void APIENTRY glColor3b (GLbyte red, GLbyte green, GLbyte blue);
- WINGDIAPI void APIENTRY glColor3bv (const GLbyte *v);
- WINGDIAPI void APIENTRY glColor3d (GLdouble red, GLdouble green, GLdouble blue);
- WINGDIAPI void APIENTRY glColor3dv (const GLdouble *v);
- WINGDIAPI void APIENTRY glColor3f (GLfloat red, GLfloat green, GLfloat blue);
- WINGDIAPI void APIENTRY glColor3fv (const GLfloat *v);
- WINGDIAPI void APIENTRY glColor3i (GLint red, GLint green, GLint blue);
- WINGDIAPI void APIENTRY glColor3iv (const GLint *v);
- WINGDIAPI void APIENTRY glColor3s (GLshort red, GLshort green, GLshort blue);
- WINGDIAPI void APIENTRY glColor3sv (const GLshort *v);
- WINGDIAPI void APIENTRY glColor3ub (GLubyte red, GLubyte green, GLubyte blue);
- WINGDIAPI void APIENTRY glColor3ubv (const GLubyte *v);
- WINGDIAPI void APIENTRY glColor3ui (GLuint red, GLuint green, GLuint blue);
- WINGDIAPI void APIENTRY glColor3uiv (const GLuint *v);
- WINGDIAPI void APIENTRY glColor3us (GLushort red, GLushort green, GLushort blue);
- WINGDIAPI void APIENTRY glColor3usv (const GLushort *v);
- WINGDIAPI void APIENTRY glColor4b (GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
- WINGDIAPI void APIENTRY glColor4bv (const GLbyte *v);
- WINGDIAPI void APIENTRY glColor4d (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
- WINGDIAPI void APIENTRY glColor4dv (const GLdouble *v);
- WINGDIAPI void APIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- WINGDIAPI void APIENTRY glColor4fv (const GLfloat *v);
- WINGDIAPI void APIENTRY glColor4i (GLint red, GLint green, GLint blue, GLint alpha);
- WINGDIAPI void APIENTRY glColor4iv (const GLint *v);
- WINGDIAPI void APIENTRY glColor4s (GLshort red, GLshort green, GLshort blue, GLshort alpha);
- WINGDIAPI void APIENTRY glColor4sv (const GLshort *v);
- WINGDIAPI void APIENTRY glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
- WINGDIAPI void APIENTRY glColor4ubv (const GLubyte *v);
- WINGDIAPI void APIENTRY glColor4ui (GLuint red, GLuint green, GLuint blue, GLuint alpha);
- WINGDIAPI void APIENTRY glColor4uiv (const GLuint *v);
- WINGDIAPI void APIENTRY glColor4us (GLushort red, GLushort green, GLushort blue, GLushort alpha);
- WINGDIAPI void APIENTRY glColor4usv (const GLushort *v);
- WINGDIAPI void APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- WINGDIAPI void APIENTRY glColorMaterial (GLenum face, GLenum mode);
- WINGDIAPI void APIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
