我有这个代码用于丢弃点数.我想增加点大小.现在我使用这个命令glPointSize但没有任何反应.点大小是默认值.它没有增加.
如何增加我的磅值?
如何增加我的磅值?
glBegin(GL_POINTS); glColor3f (a,b,c); glPointSize(20.0f); glVertex2i(px,py); glEnd();
解决方法
glPointSize(20.0f);必须放在glBegin()之前,否则它不会有任何影响.像这样做:
glPointSize(20.0f); glBegin(GL_POINTS); glColor3f (a,c); glVertex2i(px,py); glEnd();
在OpenGL documentation中,您可以读到:
Only a subset of GL commands can be used between glBegin and glEnd. The commands are glVertex,glColor,glIndex,glNormal,glTexCoord,glEvalCoord,glEvalPoint,glArrayElement,glMaterial,and glEdgeFlag. Also,it is acceptable to use glCallList or glCallLists to execute display lists that include only the preceding commands. If any other GL command is executed between glBegin and glEnd,the error flag is set and the command is ignored.