gpt4 book ai didi

c++ - 使用 glPointSize 的像素宽度 - 无效

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:11:23 24 4
gpt4 key购买 nike

我有这个丢分代码。我想增加点数。现在我使用此命令 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, b, 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.

关于c++ - 使用 glPointSize 的像素宽度 - 无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14796387/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com