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);