diff --git a/demo/browser_webcam_test/browser_webcam_test.cpp b/demo/browser_webcam_test/browser_webcam_test.cpp index 23f15e0..a6a0978 100644 --- a/demo/browser_webcam_test/browser_webcam_test.cpp +++ b/demo/browser_webcam_test/browser_webcam_test.cpp @@ -66,7 +66,7 @@ public: std::cout << std::endl; // 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 */ camera_frame_model.texture().load(pos, configuration()["display"]["dimensions"]); diff --git a/src/Game.cpp b/src/Game.cpp index 86b2aa8..b160a76 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -51,17 +51,20 @@ Game::Game() sb::Log::log(log_message.str()); glm::ivec2 window_size = configuration()["display"]["dimensions"].get(); - /* 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__ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); #endif SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_GREEN_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_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 */ _window = SDL_CreateWindow( @@ -106,8 +109,7 @@ Game::Game() } else { - SDL_Log("initialized SDL ttf %d.%d.%d", SDL_TTF_MAJOR_VERSION, - SDL_TTF_MINOR_VERSION, SDL_TTF_PATCHLEVEL); + SDL_Log("initialized SDL ttf %d.%d.%d", SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_PATCHLEVEL); } if ((bp_mono_font = TTF_OpenFont("BPmono.ttf", 14)) == nullptr) { @@ -120,8 +122,7 @@ Game::Game() } else { - SDL_Log("initialized SDL mixer %d.%d.%d", SDL_MIXER_MAJOR_VERSION, - SDL_MIXER_MINOR_VERSION, SDL_MIXER_PATCHLEVEL); + SDL_Log("initialized SDL mixer %d.%d.%d", SDL_MIXER_MAJOR_VERSION, SDL_MIXER_MINOR_VERSION, SDL_MIXER_PATCHLEVEL); } // if (Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, // MIX_DEFAULT_CHANNELS, 1024) < 0)