@@ -61,11 +61,12 @@ public static void drawViewLayers(float[][] vertices, int[] textures, float[] al
6161 *
6262 * dstColor = src.rgb * X + dest.rgb * Y;
6363 */
64+ glBlendEquation (GL_FUNC_ADD );
6465 glBlendFuncSeparate (
6566 GL_ONE ,
6667 GL_ONE_MINUS_SRC_ALPHA ,
6768 GL_ONE ,
68- GL_ONE_MINUS_SRC_ALPHA
69+ GL_ONE
6970 );
7071
7172
@@ -78,31 +79,28 @@ public static void drawViewLayers(float[][] vertices, int[] textures, float[] al
7879 for (int i = 0 ; i < vertices .length ; i ++) {
7980 bufferRect .put (vertices [i ]);
8081 bufferRect .position (0 );
81-
8282 glBindTexture (GL_TEXTURE_2D , textures [i ]);
8383
8484 glVertexAttribPointer (program .position , 2 , GL_FLOAT , false , 0 , bufferRect );
8585 glVertexAttribPointer (program .uv , 2 , GL_FLOAT , false , 0 , bufferUV );
86-
87- glUniform1iv (program .params , new int []{});
88-
8986 glUniform1i (program .texture , GL_TEXTURE_2D );
90- glDrawArrays (GL_TRIANGLE_STRIP , 0 , 4 );
91- glFinish ();
87+
88+ /**
89+ * @TODO: Need better implement for fix dark border + alpha, with low gpu cost
90+ * MODE 0 = FILL
91+ * MODE 1 = "ANTILIAZING""
92+ */
93+ for (int x = 0 ; x < 2 ; x ++) {
94+ glUniform1iv (program .params , new int []{
95+ x , Math .round (alphas [i ] * 255 )
96+ });
97+ glDrawArrays (GL_TRIANGLE_STRIP , 0 , 4 );
98+ }
9299 }
93100
94101 program .unbind ();
95102 glBindTexture (GL_TEXTURE_2D , 0 );
96- }
97-
98-
99- private static FloatBuffer allocateVertices (float [][] vectors ) {
100- FloatBuffer vertx = BufferUtils .createFloatBuffer (vectors .length *vectors [0 ].length );
101- vertx .position (0 );
102- for (int i = 0 ; i < vectors .length ; i ++)
103- vertx .put (vectors [i ]);
104- vertx .position (0 );
105- return vertx ;
103+ glDisable (GL_BLEND );
106104 }
107105
108106 public static void drawTexture (float x , float y , float width , float height , GLProgram program , int texture ){
0 commit comments