[SOLVED] Android project returning System.NotSupportedException when trying to run

I am trying to port a game I am working on over to Android, and am gettting the following error when running the project:

System.NotSupportedException: Vertex buffers are write-only on OpenGL ES platforms

The code that is causing the problem is:


It’s part of some code that I found online that calculates a models bounding boxes.

Does anyone have any ideas how I can resolve this problem? Is there an alternate solution to calculating the bounding box that does not require reading the Vertex data (Note, I am pretty new to Monogame and 3D, so if explaining an alternate option, please go easy on the terminology :slightly_smiling: ).


That is correct. OpenGL ES 2.0 is designed to be a write-only API. Reading back from the GPU and calculating bounds from the vertex buffer data at runtime is generally not recommended on any platform. This is the ideal situation for the content build pipeline and indeed a bounding sphere is calculated for ModelMesh in the standard model processor (ModelMesh.BoundingSphere).

Thanks for the reply. Unfortunately the Bounding sphere doesn’t meet my needs.

I will have to look into what it takes to build a custom pipeline importer which can calculate the bounding box at import time.


Solved this by writing a custom pipeline processor as suggested!


I’m currently facing the same issue of trying to implement a BoundingBox for the meshes of a model rather than a BoundingSphere. Any chance you would be so kind as to share your solution as I’m also quite new to MonoGame and 3D. Thanks in advance! :slight_smile:

Hi @tkingston,

This wasn’t too complicated. I found some tutorials online for creating a custom pipeline processor and used that to create a basic processor that just calculated the boundingbox for the model. It’s basically the same boundingbox code you have right now, but moved to a different place.

This was a useful page in figuring out how to write a processor:

FYI… you only need a processor and don’t need to write a custom importer, since you’re not changing the way the model is parsed. The custom processor just uses the model that’s already imported and creates the bounding box which is then set on the model tag for extracting in your game.