如何在Android中的GLSurfaceVIew中引用GLSurfaceView.Renderer

时间:2018-10-02 13:46:20

标签: android

在从图像链接获取位图的GLSurfaceview.Renderer中的loadTexture()函数之后调用时,如何引用GLSurfaceView.Rendere而不是可绘制对象,并且该图像链接会动态转换为在Renderer中设置的位图,因此如何做到这一点。

  public void loadTexture(GL10 gl, List<Bitmap> bitmapListTemp) {

        if (bitmapListTemp != null && bitmapListTemp.size() > 0) {

            Log.d("rephotocube", "call photocube");
            gl.glGenTextures(6, textureIDs, 0);

            bitmapList.addAll(bitmapListTemp);

            for (int face = 0; face < numFaces; face++)
            {
               //isloadimg = true;

                gl.glBindTexture(GLES10.GL_TEXTURE_2D, textureIDs[face]);
                gl.glTexParameterf(GLES10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST);
                gl.glTexParameterf(GLES10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);

                if (bitmapListTemp.get(face) != null)
                {
                    GLUtils.texImage2D(GLES10.GL_TEXTURE_2D, 0, bitmapList.get(face), 0);


                }else{
                    GLUtils.texImage2D(GLES10.GL_TEXTURE_2D, 0, overlapicon, 0);
                }


                setrimage(gl, bitmapList);
            }



        } else {
            gl.glGenTextures(6, textureIDs, 0);

            for (int face = 0; face < numFaces; face++) {

                gl.glBindTexture(GL10.GL_TEXTURE_2D, textureIDs[face]);
                gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST);
                gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
                GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, overlapicon, 0);

            }

        }

    }

0 个答案:

没有答案