Android Opengl ES dark pixels on the edge of objects

I would like to pay attention to the following photos

Original image first

alt text

then how it is displayed on the screen

alt text

as you can see on the original, everything is beautiful and yellow, the edges have a little transparency to look smooth.

but when rendering, some darkened pixels appear.

To avoid the usual answer, I get

I use

gl.glTexImage2D(GL10.GL_TEXTURE_2D, level, GL10.GL_RGBA, width, height, 0, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, pixelBuffer);

not a glutil tool

also

gl.glEnable(GL10.GL_BLEND);
gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);

Does anyone have a solution for this?

thank

Jason


Edit

I did digging. in the original image, my background is already the same color as the coin, and I use an alpha mask. I also checked when I load a bitmap, it seems that all bitmaps that have alpha 0 are automatically set to 0,0,0,0. this can be a problem.


. , , - 0,0,0,0 , . Bitmap ?

// Load up, and flip the texture:
            Bitmap temp = BitmapFactory.decodeResource(context.getResources(), resource, opts);
            Bitmap bmp = Bitmap.createBitmap(temp, 0, 0, temp.getWidth(), temp.getHeight(), flip, true);
            temp.recycle();
+3
2

? , , -? , ? , ( ), .

EDIT: . RGB , "" (0,0,0,0), , . , , , .

+2

, , -. gl.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA);

. .

+1

Source: https://habr.com/ru/post/1777595/


All Articles