2010-04-25 00:31:27 +00:00
|
|
|
/*
|
2014-09-07 15:27:49 +00:00
|
|
|
* Copyright (C) 2011-2014 Gregory hainaut
|
2009-02-09 21:15:56 +00:00
|
|
|
* Copyright (C) 2007-2009 Gabest
|
|
|
|
* http://www.gabest.org
|
|
|
|
*
|
|
|
|
* This Program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
2010-04-25 00:31:27 +00:00
|
|
|
*
|
2009-02-09 21:15:56 +00:00
|
|
|
* This Program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2010-04-25 00:31:27 +00:00
|
|
|
*
|
2009-02-09 21:15:56 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with GNU Make; see the file COPYING. If not, write to
|
2012-09-09 18:16:11 +00:00
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA USA.
|
2009-02-09 21:15:56 +00:00
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
*
|
|
|
|
*/
|
2013-01-04 15:47:11 +00:00
|
|
|
|
|
|
|
#include "stdafx.h"
|
2013-06-16 08:43:50 +00:00
|
|
|
#include "GSWnd.h"
|
|
|
|
|
|
|
|
void GSWndGL::PopulateGlFunction()
|
|
|
|
{
|
2016-03-10 21:22:33 +00:00
|
|
|
// Load mandatory function pointer
|
2016-05-16 16:45:04 +00:00
|
|
|
#define GL_EXT_LOAD(ext) *(void**)&(ext) = GetProcAddress(#ext, false)
|
2016-03-10 21:22:33 +00:00
|
|
|
// Load extra function pointer
|
2016-05-16 16:45:04 +00:00
|
|
|
#define GL_EXT_LOAD_OPT(ext) *(void**)&(ext) = GetProcAddress(#ext, true)
|
2016-03-10 21:22:33 +00:00
|
|
|
|
2019-01-29 15:38:37 +00:00
|
|
|
#include "PFN_WND.h"
|
2017-02-17 16:44:26 +00:00
|
|
|
|
2019-01-29 15:38:37 +00:00
|
|
|
// GL1.X mess
|
|
|
|
*(void**)&(gl_BlendColor) = GetProcAddress("glBlendColor");
|
|
|
|
GL_EXT_LOAD(glBlendFuncSeparate);
|
2017-02-17 16:44:26 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
*(void**)&(gl_ActiveTexture) = GetProcAddress("glActiveTexture");
|
|
|
|
#endif
|
2017-02-22 20:31:14 +00:00
|
|
|
|
|
|
|
// Check openGL requirement as soon as possible so we can switch to another
|
|
|
|
// renderer/device
|
2017-05-11 20:35:31 +00:00
|
|
|
GLLoader::check_gl_requirements();
|
2013-06-16 08:43:50 +00:00
|
|
|
}
|
2017-07-03 18:02:16 +00:00
|
|
|
|
|
|
|
void GSWndGL::FullContextInit()
|
|
|
|
{
|
|
|
|
CreateContext(3, 3);
|
|
|
|
AttachContext();
|
|
|
|
PopulateGlFunction();
|
|
|
|
PopulateWndGlFunction();
|
|
|
|
}
|
2017-07-03 20:13:59 +00:00
|
|
|
|
|
|
|
void GSWndGL::SetVSync(int vsync)
|
|
|
|
{
|
|
|
|
if (!HasLateVsyncSupport() && vsync < 0)
|
|
|
|
m_vsync = -vsync; // Late vsync not supported, fallback to standard vsync
|
|
|
|
else
|
|
|
|
m_vsync = vsync;
|
|
|
|
|
2017-08-21 22:02:29 +00:00
|
|
|
// The WGL/GLX/EGL swap interval function must be called on the rendering
|
|
|
|
// thread or else the change won't be properly applied.
|
|
|
|
m_vsync_change_requested = true;
|
2017-07-03 20:13:59 +00:00
|
|
|
}
|