How to distinct window creation from driver initialization
Posted: Fri Apr 06, 2012 2:31 pm
Hi,
When trying to load ogl driver as plugin, I modified the source so that the window creation got separated from gl context initialization. As hybrid showed interest in this peculiar feature, I intend to do sthg cleaner for windows/linux/ogl/directX (would eventually need help for osx). I intend to propose a first patch without any change for the user.
What are the advantages of such a feature ?
-you could create the device first, ask for avaible video modes and only then creates your window.
-in a future, irrlicht could handle several window
- I read that having several contexts could help for threading ? http://irrlicht.sourceforge.net/forum/v ... 8&start=60 I have no idea about that
-in the future makes it easier to add a new driver.
I have a few questions about the best way to do things. Right now I have a IRenderWindow (to which I have deported windowing functions such as setWindowCaption, isMinimized() etc...) from which inherits CRenderWindowWin32/CRenderWindowLinux etc...
Here are the two possibilities I have in mind (maybe you have another):
-each driver could specialize inherits IRenderWindow . For example we could have COpenGLRenderWindowWin32() inheriting from CRenderWindowWin32
-the other solution would be to add a IVideoContext to inherit from COpenGLVideoContext and then in Device, you would have a core::map <window,context>.
I lack yet (I hope I will have soon) a vision of how intertwined windows and contexts are. For example could you switch contexts within a same window ? seems ok with opengl, but harder with directX ?
When trying to load ogl driver as plugin, I modified the source so that the window creation got separated from gl context initialization. As hybrid showed interest in this peculiar feature, I intend to do sthg cleaner for windows/linux/ogl/directX (would eventually need help for osx). I intend to propose a first patch without any change for the user.
What are the advantages of such a feature ?
-you could create the device first, ask for avaible video modes and only then creates your window.
-in a future, irrlicht could handle several window
- I read that having several contexts could help for threading ? http://irrlicht.sourceforge.net/forum/v ... 8&start=60 I have no idea about that
-in the future makes it easier to add a new driver.
I have a few questions about the best way to do things. Right now I have a IRenderWindow (to which I have deported windowing functions such as setWindowCaption, isMinimized() etc...) from which inherits CRenderWindowWin32/CRenderWindowLinux etc...
Here are the two possibilities I have in mind (maybe you have another):
-each driver could specialize inherits IRenderWindow . For example we could have COpenGLRenderWindowWin32() inheriting from CRenderWindowWin32
-the other solution would be to add a IVideoContext to inherit from COpenGLVideoContext and then in Device, you would have a core::map <window,context>.
I lack yet (I hope I will have soon) a vision of how intertwined windows and contexts are. For example could you switch contexts within a same window ? seems ok with opengl, but harder with directX ?