• Advertisement
Sign in to follow this  

Need an SDL guru

This topic is 599 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.

Thanks
 

Share this post


Link to post
Share on other sites
Advertisement

Tried this too, still no luck:


SDL_SysWMinfo sysWindow; 


SDL_VERSION(&sysWindow.version);


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