Sign in to follow this  

when vertex array object not supported

Recommended Posts

I have fallen into a marsh dealig with mobiles don't support vao,the only solution i can think of is using if else whenever draw, like this

 

if(vao is supported)
{

    glBindVertexArray(vao);

    glDraw..........;

}

else

{

    glBindBuffer(....);

    glVertexAttribPointer(.....);

    glEnableVertexAttribArray(.....);

    glDraw..........;

}

 

But it's tedious and inefficient, is there better way? thx

Share this post


Link to post
Share on other sites

Yes, if it isn't supported by hardware you will need to do something different. 

 

Consider supporting only devices with GLES 2.0 and hardware capabilities present.

 

Alternatively, provide a path just like you described above.  Depending on how much you stress the system you may need to provide reduced quality in that situation, which will increase the effort required.  In that case you will need to decide if the cost of supporting it will be recovered by additional sales, reviews, and such.

Share this post


Link to post
Share on other sites

Yes, if it isn't supported by hardware you will need to do something different. 

 

Consider supporting only devices with GLES 2.0 and hardware capabilities present.

 

Alternatively, provide a path just like you described above.  Depending on how much you stress the system you may need to provide reduced quality in that situation, which will increase the effort required.  In that case you will need to decide if the cost of supporting it will be recovered by additional sales, reviews, and such.

good advice, thanks.

Share this post


Link to post
Share on other sites

I ran into this same problem (also mobile) and essentially I have the same solution as you do. I don't know how inefficient it is (it's only checking a flag after all) but I don't see a great way to avoid that performance-wise. I abstracted much of my rendering away so I have vertex array object objects (a class). From my code I treat it just as if it was a vertex array object but it hides all this away. If the device has VAO support then it uses it, if not then it uses the older style but it all looks the same to the calling code. Because it looks the same to the calling code the code can be written as if it is just using vertex array objects even if it isn't and that simplifies things greatly, I don't have if VAO_supported/else scattered everywhere in my code for rendering, only in this one class.

 

To get that to work though required abstracting everything else too which was a lot of work. I had to hide almost all of the OpenGL stuff too.

Share this post


Link to post
Share on other sites
You'll find this is true of all -- or nearly all -- of the enumerated features.

Either it is supported and you can use it, or it isn't supported and you need a work around. That work around may be not supporting those devices.

Share this post


Link to post
Share on other sites

VAO are just one of the features that you would have to worry about doing this for on mobile. In your intentions are to support a wide variety of platforms, then there is no escaping checking for functionality and using them if available, much better than assuming they are there and your app blow up in their absence. In addition, since you are using GL/ES or whatever flavor of it, then I highly recommend checking for features before using it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this