本文整理汇总了C++中StateWriter::writeInt方法的典型用法代码示例。如果您正苦于以下问题:C++ StateWriter::writeInt方法的具体用法?C++ StateWriter::writeInt怎么用?C++ StateWriter::writeInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StateWriter
的用法示例。
在下文中一共展示了StateWriter::writeInt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: enumToString
void
dumpEnum(StateWriter &writer, GLenum pname)
{
const char *s = enumToString(pname);
if (s) {
writer.writeString(s);
} else {
writer.writeInt(pname);
}
}
示例2: switch
void
dumpBoolean(StateWriter &writer, GLboolean value)
{
switch (value) {
case GL_FALSE:
writer.writeString("GL_FALSE");
break;
case GL_TRUE:
writer.writeString("GL_TRUE");
break;
default:
writer.writeInt(static_cast<GLint>(value));
break;
}
}
示例3: assert
static void
dumpAttrib(StateWriter &writer,
const AttribDesc &desc,
const GLbyte *data)
{
assert(desc);
if (desc.numRows > 1) {
writer.beginArray();
}
for (GLint row = 0; row < desc.numRows; ++row) {
if (desc.numCols > 1) {
writer.beginArray();
}
for (GLint col = 0; col < desc.numCols; ++col) {
union {
const GLbyte *rawvalue;
const GLfloat *fvalue;
const GLdouble *dvalue;
const GLint *ivalue;
const GLuint *uivalue;
const GLint64 *i64value;
const GLuint64 *ui64value;
} u;
u.rawvalue = data + row*desc.rowStride + col*desc.colStride;
switch (desc.elemType) {
case GL_FLOAT:
writer.writeFloat(*u.fvalue);
break;
case GL_DOUBLE:
writer.writeFloat(*u.dvalue);
break;
case GL_INT:
writer.writeInt(*u.ivalue);
break;
case GL_UNSIGNED_INT:
writer.writeInt(*u.uivalue);
break;
case GL_INT64_ARB:
writer.writeInt(*u.i64value);
break;
case GL_UNSIGNED_INT64_ARB:
writer.writeInt(*u.ui64value);
break;
case GL_BOOL:
writer.writeBool(*u.uivalue);
break;
default:
assert(0);
writer.writeNull();
break;
}
}
if (desc.numCols > 1) {
writer.endArray();
}
}
if (desc.numRows > 1) {
writer.endArray();
}
}