Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Floating Point Textures in OpenGL ES 2.0 #2206

Closed
Brains opened this issue Jan 20, 2014 · 6 comments
Closed

Floating Point Textures in OpenGL ES 2.0 #2206

Brains opened this issue Jan 20, 2014 · 6 comments

Comments

@Brains
Copy link

Brains commented Jan 20, 2014

I am making the game based on a fluids interaction (video). It is very expensive to simulate so I have to use GPU instead of CPU. It works fine on MonoGamе for WindowsGL but I need to implement it on mobile devices.

Unfortunately, there is a problem with floating-point textures: they aren’t supported in MonoGame for Android but are heavily used in the simulation. However, in OpenTK.Graphics.ES20 there are constants like OesTextureFloat and OesTextureHalfFloat so OpenGL ES 2.0 implementation in OpenTK supports it (I hope). Also I have found that all modern devices support OES_texture_half_float and OES_texture_float extensions (OpenGL ES 2.0 Extensions on Android Devices).

Thus, I think I can implement this feature in MonoGame (while I have never worked with OpenGL, only with Direct3D). I can start from this commit Added support for all remaining SurfaceFormat values in OpenGL (thanks @KonajuGames for it).

I ask you to give me some roadmaps, ideas, notes, drafts, potential issues and so on, if you can.

@thefiddler
Copy link
Contributor

The Xamarin.Android version of OpenTK also supports these tokens, so it should be possible to enable floating-point textures on Android.

Two pitfalls to be aware of:

  • You need to check for the existence of the necessary extensions, otherwise your code will crash on devices that do not support them.
  • There are a number of API differences between the Xamarin (Android and iOS) and the community (desktop) versions of the library, which make using OpenGL ES more annoying than it should be. I'm gradually merging the changes between the Xamarin and community versions of the libraries, so this situation is going to improve over the next few weeks.

The final question is how to deal with devices that do not support the necessary extensions. Is there a MonoGame policy for handling this situation?

@KonajuGames
Copy link
Contributor

MonoGame has an internal GraphicsCapabilities class that is used to check
for support of various extensions. If an app tries to create a
floating-point texture on a device that does not support it, the call to
create the texture should throw an appropriate exception.​

@Brains
Copy link
Author

Brains commented Jan 20, 2014

Thanks to all for commentaries. I am glad there aren't serious troubles (for now).
I have started the implementation. I will come back soon.

@Jjagg
Copy link
Contributor

Jjagg commented Dec 8, 2018

Fixed in #6264.

@Jjagg Jjagg closed this as completed Dec 8, 2018
@Brains
Copy link
Author

Brains commented Dec 8, 2018

I have started the implementation. I will come back soon.

I was too optimistic. Sorry guys.
Glad somebody did it.

@Jjagg
Copy link
Contributor

Jjagg commented Dec 8, 2018

No worries, happens all the time :p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants