@@ -911,7 +911,7 @@ public void drawTexture(int target, int id,
911911 }
912912 }
913913
914-
914+ int texGeoVBO ;
915915 protected void drawTexture2D (int id , int texW , int texH , int scrW , int scrH ,
916916 int texX0 , int texY0 , int texX1 , int texY1 ,
917917 int scrX0 , int scrY0 , int scrX1 , int scrY1 ) {
@@ -927,6 +927,11 @@ protected void drawTexture2D(int id, int texW, int texH, int scrW, int scrH,
927927 }
928928 loadedTex2DShader = true ;
929929 tex2DShaderContext = glContext ;
930+
931+ genBuffers (1 , intBuffer );
932+ texGeoVBO = intBuffer .get (0 );
933+ bindBuffer (ARRAY_BUFFER , texGeoVBO );
934+ bufferData (ARRAY_BUFFER , 16 * SIZEOF_FLOAT , null , STATIC_DRAW );
930935 }
931936
932937 if (texData == null ) {
@@ -989,16 +994,27 @@ protected void drawTexture2D(int id, int texW, int texH, int scrW, int scrH,
989994 }
990995 bindTexture (TEXTURE_2D , id );
991996
992- bindBuffer (ARRAY_BUFFER , 0 ); // Making sure that no VBO is bound at this point.
993-
994997 texData .position (0 );
995- vertexAttribPointer (tex2DVertLoc , 2 , FLOAT , false , 4 * SIZEOF_FLOAT ,
996- texData );
997- texData .position (2 );
998- vertexAttribPointer (tex2DTCoordLoc , 2 , FLOAT , false , 4 * SIZEOF_FLOAT ,
999- texData );
998+ bindBuffer (PGL .ARRAY_BUFFER , texGeoVBO );
999+ bufferData (PGL .ARRAY_BUFFER , 16 * SIZEOF_FLOAT , texData , PGL .STATIC_DRAW );
1000+
1001+ pg .report ("HERE 1" );
1002+ vertexAttribPointer (tex2DVertLoc , 2 , FLOAT , false , 4 * SIZEOF_FLOAT , 0 );
1003+ vertexAttribPointer (tex2DTCoordLoc , 2 , FLOAT , false , 4 * SIZEOF_FLOAT , 2 * SIZEOF_FLOAT );
1004+
1005+
1006+ // texData.position(0);
1007+ // vertexAttribPointer(tex2DVertLoc, 2, FLOAT, false, 4 * SIZEOF_FLOAT,
1008+ // texData);
1009+ // texData.position(2);
1010+ // vertexAttribPointer(tex2DTCoordLoc, 2, FLOAT, false, 4 * SIZEOF_FLOAT,
1011+ // texData);
1012+ // pg.report("HERE 2");
10001013
10011014 drawArrays (TRIANGLE_STRIP , 0 , 4 );
1015+ pg .report ("HERE 3" );
1016+
1017+ bindBuffer (ARRAY_BUFFER , 0 ); // Making sure that no VBO is bound at this point.
10021018
10031019 bindTexture (TEXTURE_2D , 0 );
10041020 if (enabledTex ) {
@@ -1039,6 +1055,11 @@ protected void drawTextureRect(int id, int texW, int texH, int scrW, int scrH,
10391055 }
10401056 loadedTexRectShader = true ;
10411057 texRectShaderContext = glContext ;
1058+
1059+ genBuffers (1 , intBuffer );
1060+ texGeoVBO = intBuffer .get (0 );
1061+ bindBuffer (ARRAY_BUFFER , texGeoVBO );
1062+ bufferData (ARRAY_BUFFER , 16 * SIZEOF_FLOAT , null , STATIC_DRAW );
10421063 }
10431064
10441065 if (texData == null ) {
@@ -1101,17 +1122,26 @@ protected void drawTextureRect(int id, int texW, int texH, int scrW, int scrH,
11011122 }
11021123 bindTexture (TEXTURE_RECTANGLE , id );
11031124
1104- bindBuffer (ARRAY_BUFFER , 0 ); // Making sure that no VBO is bound at this point.
1105-
11061125 texData .position (0 );
1107- vertexAttribPointer (texRectVertLoc , 2 , FLOAT , false , 4 * SIZEOF_FLOAT ,
1108- texData );
1109- texData .position (2 );
1110- vertexAttribPointer (texRectTCoordLoc , 2 , FLOAT , false , 4 * SIZEOF_FLOAT ,
1111- texData );
1126+ bindBuffer (PGL .ARRAY_BUFFER , texGeoVBO );
1127+ bufferData (PGL .ARRAY_BUFFER , 16 * SIZEOF_FLOAT , texData , PGL .STATIC_DRAW );
1128+
1129+ pg .report ("HERE 1" );
1130+ vertexAttribPointer (texRectVertLoc , 2 , FLOAT , false , 4 * SIZEOF_FLOAT , 0 );
1131+ vertexAttribPointer (texRectTCoordLoc , 2 , FLOAT , false , 4 * SIZEOF_FLOAT , 2 * SIZEOF_FLOAT );
1132+
1133+
1134+ // texData.position(0);
1135+ // vertexAttribPointer(texRectVertLoc, 2, FLOAT, false, 4 * SIZEOF_FLOAT,
1136+ // texData);
1137+ // texData.position(2);
1138+ // vertexAttribPointer(texRectTCoordLoc, 2, FLOAT, false, 4 * SIZEOF_FLOAT,
1139+ // texData);
11121140
11131141 drawArrays (TRIANGLE_STRIP , 0 , 4 );
11141142
1143+ bindBuffer (ARRAY_BUFFER , 0 ); // Making sure that no VBO is bound at this point.
1144+
11151145 bindTexture (TEXTURE_RECTANGLE , 0 );
11161146 if (enabledTex ) {
11171147 disableTexturing (TEXTURE_RECTANGLE );
@@ -2391,12 +2421,12 @@ public void readPixels(int x, int y, int width, int height, int format, int type
23912421 public abstract void vertexAttrib3fv (int index , FloatBuffer values );
23922422 public abstract void vertexAttri4fv (int index , FloatBuffer values );
23932423 public abstract void vertexAttribPointer (int index , int size , int type , boolean normalized , int stride , int offset );
2394- public abstract void vertexAttribPointer (int index , int size , int type , boolean normalized , int stride , Buffer data );
2424+ // public abstract void vertexAttribPointer(int index, int size, int type, boolean normalized, int stride, Buffer data);
23952425 public abstract void enableVertexAttribArray (int index );
23962426 public abstract void disableVertexAttribArray (int index );
23972427 public abstract void drawArrays (int mode , int first , int count );
23982428 public abstract void drawElements (int mode , int count , int type , int offset );
2399- public abstract void drawElements (int mode , int count , int type , Buffer indices );
2429+ // public abstract void drawElements(int mode, int count, int type, Buffer indices);
24002430
24012431 //////////////////////////////////////////////////////////////////////////////
24022432
0 commit comments