We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2815 - Unable to create GL context for external window
Summary: Unable to create GL context for external window
Status: ASSIGNED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 2.0.4
Hardware: x86_64 Windows 7
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-11 10:54 UTC by David Pickering
Modified: 2017-08-14 01:08 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Pickering 2014-12-11 10:54:46 UTC
hello

i appear to be unable to call SDL_GL_CreateContext() [SDL_Video.c:2882] on a window that was created/acquired with SDL_CreateWindowFrom() [SDL_Video.c:1308]. 

this appears to be because the flags variable for the external window (that is checked in SDL_GL_CreateContext()) does not contain the SDL_WINDOW_OPENGL flag.

error message received: "The specified window isn't an OpenGL window".

many thanks
Comment 1 Philipp Wiesemann 2014-12-12 19:27:29 UTC
In some cases the hint SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT [1] needs to be configured before using SDL_CreateWindowFrom().

[1] https://wiki.libsdl.org/SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT
Comment 2 sage 2016-07-15 01:36:49 UTC
hello

  i have face the same problem too. i work with MFC, can't use SDL_CreateWindow to  
create a window with SDL_WINDOW_OPENGL, so can't set the hint  SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT , int the end , i can't use SDL_GL_CreateContext().

many thanks
Comment 3 Sam Lantinga 2017-08-14 01:08:57 UTC
We've discussed adding a new API for this, and we could also create a hint that would affect the existing API. I'm inclined toward the latter since it would allow people to affect how the SDL window will be created in more flexible ways over time.