What does ofGetGLProgrammableRenderer() return?

Hi folks,

The documentation says that the above function returns ofPtr. While going through the source for ofVbo i see the following statement ambigious:

 supportVAOs = ofGetGLProgrammableRenderer()

By the supportVAOs is a boolean and initialized to true.

Any explanation ?

Thanks

hi @sajjad, ofGetGLProgrammableRenderer() indeed returns an ofPtr.

i’m not sure the line you’re mentioning is still present in the current master, but let me try to explain what’s happening:

Since the ofPtr is a typedef’ed shared_ptr, you’ll get a shared_ptr no matter what. If the renderer’s not programmable, the shared_ptr will be empty (it will point to NULL).

the boolean comparison is possible since a shared_ptr, when implicitly cast to bool, will return FALSE if the shared_ptr is pointing to NULL and TRUE in all other cases.

So really, with this line, you’re asking whether a programmable renderer is being used. The implication being, that VAOs are only available if the current renderer is programmable.