GLMmodel 顶点中的 -431602080.000000 值是什么意思? [英] What does -431602080.000000 value in GLMmodel vertex means?

查看:27
本文介绍了GLMmodel 顶点中的 -431602080.000000 值是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 GLMmodel 对象,以便在 C++ 程序中表示 Google Sketch Up 模型.这些对象有一个成员(顶点),其中包含对象所有顶点的列表,如下所示:[顶点 1 的 GLfloat x 分量,顶点 1 的 GLfloat y 分量,顶点 1 的 GLfloat z 分量,GLfloat x 分量顶点 2...].当我读取所有这些值时,除了前三个(第一个顶点的坐标)都是三个 -431602080.000000 之外,我得到了所有这些值的小数字.这在我的程序中没有意义.我用谷歌搜索过,发现这个值经常出现在 C++ 程序中,但我不知道它是什么意思.有什么想法吗?

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?

推荐答案

是的,这是一个神奇的价值".当您使用调试器查看变量时,使用十六进制视图,您将看到 0xcdcdcdcd.这不是偶然值,而是 Microsoft CRT 的调试分配器使用的值.其中之一,可能是其他.它初始化您使用 malloc 或 new 分配的任何内存为此值.当然,对于 float 或 double 类型的变量并不是很清楚,对于 int 和 string 更容易,对于指针尤其有用.假设您使用的是 MS CRT,调试分配器魔术值此处记录.

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.

这篇关于GLMmodel 顶点中的 -431602080.000000 值是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆