微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

c – 使用glPointSize的像素宽度 – 没有效果

我有这个代码用于丢弃点数.我想增加点大小.现在我使用这个命令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.

原文地址:https://www.jb51.cc/c/117509.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐