package Ġorg . n atives cript . canvas . extensions Ċ Ċ import Ġandroid . opengl . GLES 3 0 Ċ import Ġandroid . os . Build Ċ import Ġandroidx . annotation . Requires Api Ċ import Ġorg . n atives cript . canvas . Constants Ċ import Ġorg . n atives cript . canvas . TN SC an vas Ċ import Ġjava . util . concurrent . Count DownLatch Ċ import Ġjava . util . concurrent . TimeUnit Ċ Ċ /** Ċ Ġ* ĠCreated Ġby Ġtr ini wiz Ġon Ġ 5 / 1 / 2 0 Ċ Ġ*/ Ċ @ Requires Api ( api Ġ= ĠBuild . VERSION _ CODES . J EL LY _ BE AN _ MR 2 ) Ċ class ĠO ES _ vertex _ array _ object ( var Ġcanvas : ĠT N SC an vas ) Ġ{ Ċ ĉ var ĠV ERT EX _ ARRAY _ BINDING _ OES Ġ= ĠConstants . GL _ VERTEX _ ARRAY _ BINDING _ OES Ċ ĉ fun Ġcreate VertexArray OES (): ĠInt Ġ{ Ċĉ ĉ val Ġarray Ġ= ĠInt Array ( 1 ) Ċĉ ĉ val Ġlock Ġ= ĠCount DownLatch ( 1 ) Ċĉ ĉ canvas . queue Event ( Runnable Ġ{ Ċĉĉ ĉ GLES 3 0 . gl Gen Vertex Arrays ( 1 , Ġarray , Ġ 0 ) Ċĉĉ ĉ lock . count Down () Ċĉ ĉ }) Ċĉ ĉ try Ġ{ Ċĉĉ ĉ lock . await ( 2 , ĠTimeUnit . SECONDS ) Ċĉ ĉ } Ġcatch Ġ( ignored : ĠInterruptedException ) Ġ{ Ċĉ ĉ } Ċĉ ĉ return Ġarray [ 0 ] Ċ ĉ } ĊĊ ĉ fun Ġdelete VertexArray OES ( array Object : ĠInt ) Ġ{ Ċĉ ĉ val Ġarray Ġ= Ġint ArrayOf ( array Object ) Ċĉ ĉ val Ġlock Ġ= ĠCount DownLatch ( 1 ) Ċĉ ĉ canvas . queue Event ( Runnable Ġ{ Ċĉĉ ĉ GLES 3 0 . gl Delete Vertex Arrays ( 1 , Ġarray , Ġ 0 ) Ċĉĉ ĉ lock . count Down () Ċĉ ĉ }) Ċĉ ĉ try Ġ{ Ċĉĉ ĉ lock . await ( 2 , ĠTimeUnit . SECONDS ) Ċĉ ĉ } Ġcatch Ġ( ignored : ĠInterruptedException ) Ġ{ Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ fun Ġis VertexArray OES ( array Object : ĠInt ): ĠBoolean Ġ{ Ċĉ ĉ val Ġvalue Ġ= ĠBoolean Array ( 1 ) Ċĉ ĉ val Ġlock Ġ= ĠCount DownLatch ( 1 ) Ċĉ ĉ canvas . queue Event ( Runnable Ġ{ Ċĉĉ ĉ value [ 0 ] Ġ= ĠGLES 3 0 . gl Is VertexArray ( array Object ) Ċĉĉ ĉ lock . count Down () Ċĉ ĉ }) Ċĉ ĉ try Ġ{ Ċĉĉ ĉ lock . await ( 2 , ĠTimeUnit . SECONDS ) Ċĉ ĉ } Ġcatch Ġ( ignored : ĠInterruptedException ) Ġ{ Ċĉ ĉ } Ċĉ ĉ return Ġvalue [ 0 ] Ċ ĉ } ĊĊ ĉ fun Ġbind VertexArray OES ( array Object : ĠInt ) Ġ{ Ċĉ ĉ val Ġarray Ġ= Ġint ArrayOf ( array Object ) Ċĉ ĉ val Ġlock Ġ= ĠCount DownLatch ( 1 ) Ċĉ ĉ canvas . queue Event ( Runnable Ġ{ Ċĉĉ ĉ GLES 3 0 . glBind VertexArray ( array Object ) Ċĉĉ ĉ lock . count Down () Ċĉ ĉ }) Ċĉ ĉ try Ġ{ Ċĉĉ ĉ lock . await ( 2 , ĠTimeUnit . SECONDS ) Ċĉ ĉ } Ġcatch Ġ( ignored : ĠInterruptedException ) Ġ{ Ċĉ ĉ } Ċ ĉ } Ċ } Ċ