What does -431602080.000000 value in GLMmodel vertex means?

我与影子孤独终老i 提交于 2019-12-11 18:19:39

问题


I use a GLMmodel object in order to represent a Google Sketch Up model in a C++ program. These objects have a member (vertices) that contains a list of all the vertices of the object in a way like this: [GLfloat x component of vertex 1, GLfloat y component of vertex 1, GLfloat z component of vertex 1, GLfloat x component of vertex 2...]. When I read all these values I get small numbers for all of them except for the first three ones (the coordinates of the first vertex) which are all three -431602080.000000. This doesn't make sense in my program. I've googled it and I've found this value appears frequently in C++ programs but I don't know what does it mean. Any ideas?


回答1:


Yes, this is a "magic value". When you look at the variable with the debugger, using hex view, you'll see 0xcdcdcdcd. That's not an accidental value, that is a value used by the Microsoft CRT's debug allocator. For one, possibly others. Which initializes any memory you allocate with malloc or new to this value. It isn't that clear with variables of type float or double of course, easier with ints and strings and especially useful with pointers. Assuming you are using the MS CRT, debug allocator magic values are documented here.

You forgot to initialize the value. That's a bug in your code.



来源:https://stackoverflow.com/questions/10155491/what-does-431602080-000000-value-in-glmmodel-vertex-means

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!