Page Menu
Home
Wildfire Games
Search
Configure Global Search
Log In
Paste
P260
D721 after D4375
Active
Public
Actions
Authored by
Stan
on Dec 14 2021, 5:51 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Subscribers
None
std
::
unique_ptr
<
CDevice
>
CDevice
::
Create
(
SDL_Window
*
window
)
{
std
::
unique_ptr
<
CDevice
>
device
(
new
CDevice
());
if
(
window
)
{
device
->
m_Context
=
SDL_GL_CreateContext
(
window
);
if
(
!
device
->
m_Context
)
{
LOGERROR
(
"SDL_GL_CreateContext failed: '%s'"
,
SDL_GetError
());
return
nullptr
;
}
#if OS_WIN
ogl_Init
(
SDL_GL_GetProcAddress
,
wutil_GetAppHDC
());
#elif defined(SDL_VIDEO_DRIVER_X11) && !CONFIG2_GLES
ogl_Init
(
SDL_GL_GetProcAddress
,
GetX11Display
(
m_Window
));
#else
ogl_Init
(
SDL_GL_GetProcAddress
);
#endif
}
else
{
// SDL_GL_GetProcAddress is available because we called SDL_GL_LoadLibrary
#if OS_WIN
ogl_Init
(
SDL_GL_GetProcAddress
,
wutil_GetAppHDC
());
#elif defined(SDL_VIDEO_DRIVER_X11) && !CONFIG2_GLES
ogl_Init
(
SDL_GL_GetProcAddress
,
XOpenDisplay
(
NULL
));
#else
ogl_Init
(
SDL_GL_GetProcAddress
);
#endif
#if OS_WIN || defined(SDL_VIDEO_DRIVER_X11) && !CONFIG2_GLES
ogl_SetVsyncEnabled
(
true
);
}
if
((
ogl_HaveExtensions
(
0
,
"GL_ARB_vertex_program"
,
"GL_ARB_fragment_program"
,
nullptr
)
// ARB
&&
ogl_HaveExtensions
(
0
,
"GL_ARB_vertex_shader"
,
"GL_ARB_fragment_shader"
,
nullptr
))
// GLSL
||
!
ogl_HaveExtension
(
"GL_ARB_vertex_buffer_object"
)
// VBO
||
ogl_HaveExtensions
(
0
,
"GL_ARB_multitexture"
,
"GL_EXT_draw_range_elements"
,
nullptr
)
||
(
!
ogl_HaveExtension
(
"GL_EXT_framebuffer_object"
)
&&
!
ogl_HaveExtension
(
"GL_ARB_framebuffer_object"
)))
{
// It doesn't make sense to continue working here, because we're not
// able to display anything.
DEBUG_DISPLAY_FATAL_ERROR
(
L
"Your graphics card doesn't appear to be fully compatible with OpenGL shaders."
L
" The game does not support pre-shader graphics cards."
L
" You are advised to try installing newer drivers and/or upgrade your graphics card."
L
" For more information, please see http://www.wildfiregames.com/forum/index.php?showtopic=16734"
);
}
device
->
m_Name
=
GetNameImpl
();
device
->
m_Version
=
GetVersionImpl
();
device
->
m_DriverInformation
=
GetDriverInformationImpl
();
device
->
m_Extensions
=
GetExtensionsImpl
();
return
device
;
}
Event Timeline
Stan
created this paste.
Dec 14 2021, 5:51 PM
Stan
created this object with visibility "Public (No Login Required)".
Stan
edited the content of this paste.
(Show Details)
Dec 14 2021, 5:54 PM
Stan
edited the content of this paste.
(Show Details)
Log In to Comment