我认为这很简单,但我不能让它工作.
我只是想将std :: wstring转换为int.
到目前为止,我尝试了两种方法.
第一种是使用带有"atoi"的"C"方法,如下所示:
int ConvertedInteger = atoi(OrigWString.c_str());
Run Code Online (Sandbox Code Playgroud)
但是,VC++ 2013告诉我:
错误,类型"const wchar_t*"的参数与"const char_t*"类型的参数不兼容
所以我的第二种方法是使用Google搜索:
std::wistringstream win(L"10");
int ConvertedInteger;
if (win >> ConvertedInteger && win.eof())
{
// The eof ensures all stream was processed and
// prevents acccepting "10abc" as valid ints.
}
Run Code Online (Sandbox Code Playgroud)
但VC++ 2013告诉我这个:
"错误:不允许不完整的类型."
我在这做错了什么?
有没有更好的方法将std :: wstring转换为int并返回?
感谢您的时间.
所以Oculus Rift SDK接受使用glFramebufferTexture函数创建的帧缓冲纹理ID .
例:
[...]
GLuint l_FBOId;
glGenFramebuffers(1, &l_FBOId);
glBindFramebuffer(GL_FRAMEBUFFER, l_FBOId);
// The texture we're going to render to...
GLuint l_TextureId;
glGenTextures(1, &l_TextureId);
// "Bind" the newly created texture : all future texture functions will modify this texture...
glBindTexture(GL_TEXTURE_2D, l_TextureId);
// Give an empty image to OpenGL (the last "0")
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, l_TextureSize.w, l_TextureSize.h, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
// Linear filtering...
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
// Create Depth Buffer...
GLuint l_DepthBufferId;
glGenRenderbuffers(1, &l_DepthBufferId);
glBindRenderbuffer(GL_RENDERBUFFER, …Run Code Online (Sandbox Code Playgroud)