4444import com .jogamp .opengl .GL2ES2 ;
4545import com .jogamp .opengl .GL2ES3 ;
4646import com .jogamp .opengl .GL2GL3 ;
47+ import com .jogamp .opengl .GL3ES3 ;
4748import com .jogamp .opengl .GLAutoDrawable ;
4849import com .jogamp .opengl .GLCapabilities ;
4950import com .jogamp .opengl .GLCapabilitiesImmutable ;
@@ -109,6 +110,9 @@ public class PJOGL extends PGL {
109110 * multisampled renderbuffers) */
110111 protected GL2 gl2x ;
111112
113+ /** GL3ES3 interface */
114+ protected GL3ES3 gl3es3 ;
115+
112116 /** Stores exceptions that ocurred during drawing */
113117 protected Exception drawException ;
114118
@@ -233,6 +237,7 @@ protected void getGL(PGL pgl) {
233237 this .gl2 = pjogl .gl2 ;
234238 this .gl2x = pjogl .gl2x ;
235239 this .gl3 = pjogl .gl3 ;
240+ this .gl3es3 = pjogl .gl3es3 ;
236241 }
237242
238243
@@ -253,6 +258,11 @@ public void getGL(GLAutoDrawable glDrawable) {
253258 } catch (com .jogamp .opengl .GLException e ) {
254259 gl3 = null ;
255260 }
261+ try {
262+ gl3es3 = gl .getGL3ES3 ();
263+ } catch (com .jogamp .opengl .GLException e ) {
264+ gl3es3 = null ;
265+ }
256266 }
257267
258268
@@ -736,12 +746,14 @@ public void next() {
736746
737747 ARRAY_BUFFER = GL .GL_ARRAY_BUFFER ;
738748 ELEMENT_ARRAY_BUFFER = GL .GL_ELEMENT_ARRAY_BUFFER ;
749+ PIXEL_PACK_BUFFER = GL3ES3 .GL_PIXEL_PACK_BUFFER ;
739750
740751 MAX_VERTEX_ATTRIBS = GL2ES2 .GL_MAX_VERTEX_ATTRIBS ;
741752
742753 STATIC_DRAW = GL .GL_STATIC_DRAW ;
743754 DYNAMIC_DRAW = GL .GL_DYNAMIC_DRAW ;
744755 STREAM_DRAW = GL2ES2 .GL_STREAM_DRAW ;
756+ STREAM_READ = GL3ES3 .GL_STREAM_READ ;
745757
746758 BUFFER_SIZE = GL .GL_BUFFER_SIZE ;
747759 BUFFER_USAGE = GL .GL_BUFFER_USAGE ;
@@ -956,6 +968,10 @@ public void next() {
956968 MULTISAMPLE = GL .GL_MULTISAMPLE ;
957969 LINE_SMOOTH = GL .GL_LINE_SMOOTH ;
958970 POLYGON_SMOOTH = GL2GL3 .GL_POLYGON_SMOOTH ;
971+
972+ SYNC_GPU_COMMANDS_COMPLETE = GL3ES3 .GL_SYNC_GPU_COMMANDS_COMPLETE ;
973+ ALREADY_SIGNALED = GL3ES3 .GL_ALREADY_SIGNALED ;
974+ CONDITION_SATISFIED = GL3ES3 .GL_CONDITION_SATISFIED ;
959975 }
960976
961977 ///////////////////////////////////////////////////////////
@@ -1114,6 +1130,37 @@ public void unmapBuffer(int target) {
11141130
11151131 //////////////////////////////////////////////////////////////////////////////
11161132
1133+ // Synchronization
1134+
1135+ @ Override
1136+ public long fenceSync (int condition , int flags ) {
1137+ if (gl3es3 != null ) {
1138+ return gl3es3 .glFenceSync (condition , flags );
1139+ } else {
1140+ throw new RuntimeException (String .format (MISSING_GLFUNC_ERROR , "fenceSync()" ));
1141+ }
1142+ }
1143+
1144+ @ Override
1145+ public void deleteSync (long sync ) {
1146+ if (gl3es3 != null ) {
1147+ gl3es3 .glDeleteSync (sync );
1148+ } else {
1149+ throw new RuntimeException (String .format (MISSING_GLFUNC_ERROR , "deleteSync()" ));
1150+ }
1151+ }
1152+
1153+ @ Override
1154+ public int clientWaitSync (long sync , int flags , long timeout ) {
1155+ if (gl3es3 != null ) {
1156+ return gl3es3 .glClientWaitSync (sync , flags , timeout );
1157+ } else {
1158+ throw new RuntimeException (String .format (MISSING_GLFUNC_ERROR , "clientWaitSync()" ));
1159+ }
1160+ }
1161+
1162+ //////////////////////////////////////////////////////////////////////////////
1163+
11171164 // Viewport and Clipping
11181165
11191166 @ Override
@@ -1141,6 +1188,11 @@ protected void readPixelsImpl(int x, int y, int width, int height, int format, i
11411188 gl .glReadPixels (x , y , width , height , format , type , buffer );
11421189 }
11431190
1191+ @ Override
1192+ protected void readPixelsImpl (int x , int y , int width , int height , int format , int type , long offset ) {
1193+ gl .glReadPixels (x , y , width , height , format , type , 0 );
1194+ }
1195+
11441196 //////////////////////////////////////////////////////////////////////////////
11451197
11461198 // Vertices
0 commit comments