SFML community forums
Bindings - other languages => DotNet => Topic started by: Chris12 on November 11, 2012, 11:50:42 pm
-
Hi there. Got SFML working with OpenTK.
I understand that me messing with the openGL context will disturb SFML in its functionality.
Thats why one should use PushGLStates / PopGLStates.
I read the tutorial and the documentation, but somehow it's still not 100% clear to me.
I have a few questions.
1.) Should I enclose my code with Push/PopGlStates, or should I enclode the SFML drawing code with it?
Is there even a difference?
2.) When should ResetGlStates be used? Can it replace the above functions?
3.) Is this the correct way to make openTK aware of SFML: ?
static void Main
(string[] args
) { RenderWindow
= new RenderWindow
(new SFML
.Window.VideoMode(800,
450),
"Title", SFML
.Window.Styles.Close); var wi
= OpenTK
.Platform.Utilities.CreateWindowsWindowInfo(RenderWindow
.SystemHandle); var ctx
= new OpenTK
.Graphics.GraphicsContext(OpenTK
.Graphics.GraphicsMode.Default, wi
); ctx
.MakeCurrent(wi
); ctx
.LoadAll(); ... }
Isn't there a way to get the GlContext from the "RenderWindow" class directly??
-
1. I would keep SFML's state as the default, which means surrounding your Tk graphics calls with a push/pop.
2. Never used it, but as you should always push/pop you'll probably never need it
-
1.) Should I enclose my code with Push/PopGlStates, or should I enclode the SFML drawing code with it?
Is there even a difference?
2.) When should ResetGlStates be used? Can it replace the above functions?
Everything is explained in the API documentation. If SFML.Net's doc is not up-to-date/complete, look at SFML's doc.
Isn't there a way to get the GlContext from the "RenderWindow" class directly??
No. But in C++ (with WGL/GLX/AGL) there's a function to get the current context. I don't know if you can access this kind of function in .Net, and if you can make something useful of the returned low-level context.