代码拉取完成,页面将自动刷新
#include"OpenglUtil.h"
#include<glad/glad.h>
#include<iostream>
#include<cstdlib>
namespace{
auto err = []()->std::ostream&{ return std::cerr;};
}
void OpenglUtil::clearError(){
int count = 0;
while(GL_NO_ERROR != glGetError()) count++;
if(count)err()<<"clear error count:" << count;
}
void OpenglUtil::checkError(const Path& file,Line line){
// Get the last error
const GLenum errorCode = glGetError();
if (errorCode != GL_NO_ERROR)
{
std::string error = "Unknown error";
std::string description = "No description";
// Decode the error code
switch (errorCode)
{
case GL_INVALID_ENUM:
{
error = "GL_INVALID_ENUM";
description = "An unacceptable value has been specified for an enumerated argument.";
break;
}
case GL_INVALID_VALUE:
{
error = "GL_INVALID_VALUE";
description = "A numeric argument is out of range.";
break;
}
case GL_INVALID_OPERATION:
{
error = "GL_INVALID_OPERATION";
description = "The specified operation is not allowed in the current state.";
break;
}
case GL_STACK_OVERFLOW:
{
error = "GL_STACK_OVERFLOW";
description = "This command would cause a stack overflow.";
break;
}
case GL_STACK_UNDERFLOW:
{
error = "GL_STACK_UNDERFLOW";
description = "This command would cause a stack underflow.";
break;
}
case GL_OUT_OF_MEMORY:
{
error = "GL_OUT_OF_MEMORY";
description = "There is not enough memory left to execute the command.";
break;
}
case GL_INVALID_FRAMEBUFFER_OPERATION:
{
error = "GL_INVALID_FRAMEBUFFER_OPERATION";
description = "The object bound to FRAMEBUFFER_BINDING is not \"framebuffer complete\".";
break;
}
}
err() << "An internal OpenGL call failed in " << file << "(" << line << ")."
<< "\nExpression:\n "
<< "\nError description:\n " << error << "\n " << description << '\n'
<< std::endl;
if(exitOnError)
std::exit(2);
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。