intermediate commit (glad not initializing correctly)

This commit is contained in:
fysx
2013-12-06 23:37:01 +01:00
parent ec2bf449e9
commit 2037378d6a
8 changed files with 155 additions and 19 deletions
@@ -135,6 +135,8 @@ void Graphics::setViewportSize(int width, int height)
bool Graphics::setMode(int width, int height)
{
SDL_Log ("Graphics::setMode %d,%d", width, height);
this->width = width;
this->height = height;
@@ -31,6 +31,8 @@
// C
#include <cstring>
#include <SDL.h>
namespace love
{
namespace graphics
@@ -52,8 +54,10 @@ bool OpenGL::initContext()
if (contextInitialized)
return true;
if (!gladLoadGL())
return false;
if (!gladLoadGL()) {
SDL_Log ("Initialization of OpenGL failed! Aborting!");
abort();
}
initOpenGLFunctions();
initVendor();
+28 -1
View File
@@ -28,6 +28,9 @@
#include <vector>
#include <algorithm>
#include "libraries/glad/gladfuncs.hpp"
using namespace glad;
namespace love
{
namespace window
@@ -95,6 +98,28 @@ bool Window::setWindow(int width, int height, WindowAttributes *attribs)
Uint32 sdlflags = SDL_WINDOW_OPENGL;
#ifdef __ANDROID__
f.fullscreen = true;
f.resizable = false;
if (window) {
int query_width, query_height;
SDL_GetWindowSize (window, &query_width, &query_height);
SDL_Log ("Overriding windows size to = %d,%d", query_width, query_height);
width = query_width;
height = query_height;
} else {
SDL_DisplayMode mode = {};
SDL_GetDesktopDisplayMode(f.display, &mode);
SDL_Log ("Overriding windows size to = %d,%d", mode.w, mode.h);
width = mode.w;
height = mode.h;
}
#endif
if (f.fullscreen)
{
if (f.fstype == FULLSCREEN_TYPE_DESKTOP)
@@ -105,8 +130,10 @@ bool Window::setWindow(int width, int height, WindowAttributes *attribs)
// Fullscreen window creation will bug out if no mode can be used.
SDL_DisplayMode mode = {0, width, height, 0, 0};
if (SDL_GetClosestDisplayMode(f.display, &mode, &mode) == 0)
if (SDL_GetClosestDisplayMode(f.display, &mode, &mode) == 0) {
displayError ("SDL", "Could not get closest display mode");
return false;
}
}
}