#include <algorithm>
#include <SDL.h>
#include <SDL_image.h>
+#include <SDL_ttf.h>
#include <stdexcept>
#include <string>
#include <GL/glew.h>
}
+InitTTF::InitTTF() {
+ if (TTF_Init() != 0) {
+ sdl_error("TTF_Init()");
+ }
+}
+
+InitTTF::~InitTTF() {
+ TTF_Quit();
+}
+
+
InitGL::InitGL(bool double_buffer, int sample_size) {
if (SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3) != 0) {
sdl_error("SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3)");
glEnable(GL_CULL_FACE);
}
+void GLContext::EnableAlphaBlending() noexcept {
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+}
+
+void GLContext::DisableAlphaBlending() noexcept {
+ glDisable(GL_BLEND);
+}
+
void GLContext::Clear() noexcept {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}