GL_FIXED、GL_FLOAT

来源:互联网 发布:java线程停止 编辑:程序博客网 时间:2024/06/01 23:28

When I look at the documentation it looks likeGL_FIXED is a fixed point16:16 format.That means that the 16 upper bits of a GLfixedrepresents the integer part and the fraction is the lower 16bits

To convert this to a float simply divide the number by65536:

const float scale = 1.0f / 65536.0f;GLfloat vertices[] = {        point.x * scale               , (point.y + size.height) * scale,        (point.x + size.width) * scale, (point.y + size.height) * scale,        point.x * scale               , point.y * scale,        (point.x + size.width) * scale, point.y * scale};glVertexPointer(2, GL_FLOAT, 0, vertices);

If you're vertex coordinates etc is also inGL_FIXEDformat you'll have to scale them as well.

0 0
原创粉丝点击