set gl context profile attribute to ES
This commit is contained in:
parent
f63cb2bfb2
commit
b1fb77b1c8
|
@ -66,7 +66,7 @@ public:
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
// If OpenCV were being used, a cv::Mat could be created:
|
// If OpenCV were being used, a cv::Mat could be created:
|
||||||
// frame = cv::Mat(FW, FH, CV_8UC4, pos);;
|
// frame = cv::Mat(FW, FH, CV_8UC4, pos);
|
||||||
|
|
||||||
/* Add a texture to the camera Plane for storing frame image data */
|
/* Add a texture to the camera Plane for storing frame image data */
|
||||||
camera_frame_model.texture().load(pos, configuration()["display"]["dimensions"]);
|
camera_frame_model.texture().load(pos, configuration()["display"]["dimensions"]);
|
||||||
|
|
13
src/Game.cpp
13
src/Game.cpp
|
@ -51,17 +51,20 @@ Game::Game()
|
||||||
sb::Log::log(log_message.str());
|
sb::Log::log(log_message.str());
|
||||||
glm::ivec2 window_size = configuration()["display"]["dimensions"].get<glm::ivec2>();
|
glm::ivec2 window_size = configuration()["display"]["dimensions"].get<glm::ivec2>();
|
||||||
|
|
||||||
/* Set these before creating a window (see SDL_GLattr.html). Don't ask Emscripten for a GL context version. */
|
/* Set these before creating a window (see SDL_GLattr.html). Don't ask Emscripten for a specific GL context version. */
|
||||||
#ifndef __EMSCRIPTEN__
|
#ifndef __EMSCRIPTEN__
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
|
||||||
#endif
|
#endif
|
||||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
|
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
|
||||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
|
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
|
||||||
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
|
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
|
||||||
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
|
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
|
||||||
SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1);
|
SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||||
|
/* Set the profile to ES so that desktop and web builds are both using the same profile. This should be handled by a configuration
|
||||||
|
* option in the fututre. */
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
|
||||||
|
|
||||||
/* Create a window with dimensions set in the config, centered, and flagged to be usable in OpenGL context */
|
/* Create a window with dimensions set in the config, centered, and flagged to be usable in OpenGL context */
|
||||||
_window = SDL_CreateWindow(
|
_window = SDL_CreateWindow(
|
||||||
|
@ -106,8 +109,7 @@ Game::Game()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SDL_Log("initialized SDL ttf %d.%d.%d", SDL_TTF_MAJOR_VERSION,
|
SDL_Log("initialized SDL ttf %d.%d.%d", SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_PATCHLEVEL);
|
||||||
SDL_TTF_MINOR_VERSION, SDL_TTF_PATCHLEVEL);
|
|
||||||
}
|
}
|
||||||
if ((bp_mono_font = TTF_OpenFont("BPmono.ttf", 14)) == nullptr)
|
if ((bp_mono_font = TTF_OpenFont("BPmono.ttf", 14)) == nullptr)
|
||||||
{
|
{
|
||||||
|
@ -120,8 +122,7 @@ Game::Game()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SDL_Log("initialized SDL mixer %d.%d.%d", SDL_MIXER_MAJOR_VERSION,
|
SDL_Log("initialized SDL mixer %d.%d.%d", SDL_MIXER_MAJOR_VERSION, SDL_MIXER_MINOR_VERSION, SDL_MIXER_PATCHLEVEL);
|
||||||
SDL_MIXER_MINOR_VERSION, SDL_MIXER_PATCHLEVEL);
|
|
||||||
}
|
}
|
||||||
// if (Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT,
|
// if (Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT,
|
||||||
// MIX_DEFAULT_CHANNELS, 1024) < 0)
|
// MIX_DEFAULT_CHANNELS, 1024) < 0)
|
||||||
|
|
Loading…
Reference in New Issue