[SOLVED] How to determine OpenGL or DirectX used?

I write extension to MonoGame and in my library need to determine which type of effect to load OpenGL or DirectX. These effects are compiled manually and attached as resources to the library project.

Is there any way to check type of GraphicsDevice?

Hi @Yurii_Miroshnyk, Welcome to the Forums.

Umm, usually it is determined by your project setup, if you detail what projects you are using, or your platform setup, Windows/Mac, someone may be able to assist further.

Happy Coding!

I could be more specific about the project I make.

It is an extension library for MonoGame engine. People would use the same compiled dll on many different platforms. And the only difference for the code inside this library is which shader to pass to the Effect constructor to compile. So, it would be great to know which one to choose depending on current GraphicsDevice used.

1 Like
1 Like

@willmotil, thank you. I already tried that solution before but had a fail for a some reason.
Did it again and succeeded. Everything is like in the answer you pointed.
Sorry for topic.

1 Like

No need to apologise, asking is what this place is for, however, we do encourage searching for something before posting, not that, that applied here too much.

Code on!