Texture doesn't draw

后端 未结 2 1354
没有蜡笔的小新
没有蜡笔的小新 2021-01-26 14:41

I want to draw a image to the screen, but what I get is the black square but without the texture on it. The image path is correct and loaded, because the rect have the correct s

2条回答
  •  迷失自我
    2021-01-26 15:26

    I found the problem: before the next lines were posted in the MyGLRenderer before constructing the Texture class, but now I have add them between glBindTexture() and texImage2D in Texture class:

        GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
        GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
    
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
    

提交回复
热议问题