mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 06:08:35 +00:00
HPL1: add opengl header and debug utilities
This commit is contained in:
parent
25972424dd
commit
0e7414cfdb
@ -5,6 +5,7 @@ MODULE_OBJS := \
|
||||
detection.o \
|
||||
string.o \
|
||||
debug.o \
|
||||
opengl.o \
|
||||
engine/ai/AI.o \
|
||||
engine/ai/AINodeContainer.o \
|
||||
engine/ai/AINodeGenerator.o \
|
||||
|
43
engines/hpl1/opengl.cpp
Normal file
43
engines/hpl1/opengl.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "hpl1/opengl.h"
|
||||
#include "hpl1/debug.h"
|
||||
|
||||
namespace Hpl1 {
|
||||
static const char* getErrorString(const GLenum code) {
|
||||
switch (code) {
|
||||
case GL_INVALID_ENUM:
|
||||
return "invalid enum";
|
||||
case GL_INVALID_VALUE:
|
||||
return "invalid value";
|
||||
case GL_INVALID_OPERATION:
|
||||
return "invalid operation";
|
||||
}
|
||||
return "unrecognized error";
|
||||
}
|
||||
|
||||
void checkOGLErrors(const char *function, const int line) {
|
||||
GLenum code;
|
||||
while((code = glGetError()) != GL_NO_ERROR)
|
||||
logError(kDebugOpenGL, "Opengl error: \'%s\' in function %s - %d", getErrorString(code), function, line);
|
||||
}
|
||||
}
|
37
engines/hpl1/opengl.h
Normal file
37
engines/hpl1/opengl.h
Normal file
@ -0,0 +1,37 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HPL1_OPENGL_H
|
||||
#define HPL1_OPENGL_H
|
||||
|
||||
#define USE_OPENGL
|
||||
#define USE_GLAD
|
||||
#include "graphics/opengl/system_headers.h"
|
||||
#include "graphics/opengl/context.h"
|
||||
|
||||
namespace Hpl1 {
|
||||
void checkOGLErrors(const char *function, int line);
|
||||
}
|
||||
|
||||
#define GL_CHECK(x) {::Hpl1::checkOGLErrors(__func__, __LINE__); x;}
|
||||
#define GL_CHECK_FN() GL_CHECK()
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user