Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 元素问题_Iphone_Opengl Es - Fatal编程技术网

Iphone 元素问题

Iphone 元素问题,iphone,opengl-es,Iphone,Opengl Es,这将以红色显示: VertexColorSet(&colors[vertexCounter], 1.0f, 0.0f, 0.0f, 1.0f); 这将显示黑色: VertexColorSet(&colors[vertexCounter], 0.9f, 0.0f, 0.0f, 1.0f); 为什么它是黑色的?它不应该只是一个较深的红色阴影吗 glEnableClientState(GL_COLOR_ARRAY); glColor4f(1.0f, 1.0f, 1.0f,

这将以红色显示:

VertexColorSet(&colors[vertexCounter], 1.0f, 0.0f, 0.0f, 1.0f);
这将显示黑色:

VertexColorSet(&colors[vertexCounter], 0.9f, 0.0f, 0.0f, 1.0f);
为什么它是黑色的?它不应该只是一个较深的红色阴影吗

    glEnableClientState(GL_COLOR_ARRAY);
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);

glVertexPointer(2, GL_FLOAT, 0, vertexes);
glColorPointer(4, GL_FLOAT, 0, colors);
glDrawElements(GL_TRIANGLES, 3*indexesPerButton*totalButtons, GL_UNSIGNED_SHORT, indexes);

//glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
    glDisableClientState(GL_COLOR_ARRAY);

是的,它是黑色的,因为我用了int而不是float

谢谢,我试过了,但你得等几天才能接受答案。