Is it faster to define a vertex structure by .x .y .z members insteadof [3] array?---Gernotint main(int argc, char** argv) {printf("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, ''g'', 64, "ba", 46, 10);}________________________________________Looking for a good game? Do it yourself!GLBasic - you can do www.GLBasic.com 解决方案Not if you use constants for indexing into the array. But .x .y .z might bemore readable.Niels Dybdahl Not if you use constants for indexing into the array. But .x .y .z might be more readable. Niels DybdahlUse the arrays. It allows you to apply transformations using matrixoperations. There shouldn''t be much difference of performance betweenindexing through constants and member access.Catalinint blah[3];struct Blah{int x;int y;int z;} blah;Only difference I can fathom:The implementation may *not* put padding between array elements, while it*may* put padding between structure elements.(And before some-one says it... YES I do realize that there wouldn''t bepadding between "int"s in anyway! :-P)-JKop 这篇关于a [3}慢于a.x; a.z; a.z的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-06 13:37