Jump to content
  • Advertisement
Sign in to follow this  

Need an SDL guru

This topic is 831 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all


I am using SDL2 and I need to get the current window and context to pass to opencl.


I tried:


//get the GL rendering context
HGLRC hGLRC = wglGetCurrentContext();
//get the device context
HDC hDC = wglGetCurrentDC();
Doesnt work, visual studio says cant read memory.
I then tried:
gContext = SDL_GL_GetCurrentContext();
gWindow = SDL_GL_GetCurrentWindow();
Causes opencl to bug out.
Any help with this would be greatly appreciated.


Share this post

Link to post
Share on other sites

Tried this too, still no luck:

SDL_SysWMinfo sysWindow; 


SDL_bool f = SDL_GetWindowWMInfo(gWindow, &sysWindow);
printf("SDL_Init failed: %s\n", SDL_GetError());

hDC = sysWindow.info.win.hdc;
hGLRC = sysWindow.info.win.window;
Edited by BadEggGames

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!