Texture doesn't draw

后端 未结 2 1888
轻奢々
轻奢々 2021-01-26 15:00

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:27

    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);
    

提交回复
热议问题