Fireworks Engine  v2.0
Lightweight Sandbox Game Engine using OpenGL for additional Customisation and Quick Prototyping
glassert.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <iostream>
4 
5 // GLEW
6 #include <GL/glew.h>
7 
8 namespace fireworks {
9 
10  #if ((_WIN32) || (_WIN64)) // This OS Macro isn't working why?
11  #define ASSERT(x) if (!(x)) __debugbreak(); // Break the debugger from executing
13  #else
14  #define ASSERT(x) if (!(x)) // For other platforms we don't trigger any debug functions we just record the assertion failure and report it
15  #endif
16  #define GLCall(x) GLClearError();\
18  (x);\
19  ASSERT(GLLogCall(#x, __FILE__, __LINE__))
20 
22  static void GLClearError()
23  {
24  while (glGetError() != GL_NO_ERROR);
25  }
26 
32  static bool GLLogCall(const char* functionName, const char* file, int line)
33  {
34  while (GLenum error = glGetError())
35  {
36  std::cerr << "OpenGL::ERROR:: " << error << "[Function : " << functionName << ", File : " << file << ", at Line : " << line << "]" << std::endl;
37  return false;
38  }
39  return true;
40  }
41 }
Definition: audioclip.cpp:3