当前位置: 首页>>代码示例>>Java>>正文


Java GLUtils.texSubImage2D方法代码示例

本文整理汇总了Java中android.opengl.GLUtils.texSubImage2D方法的典型用法代码示例。如果您正苦于以下问题:Java GLUtils.texSubImage2D方法的具体用法?Java GLUtils.texSubImage2D怎么用?Java GLUtils.texSubImage2D使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.opengl.GLUtils的用法示例。


在下文中一共展示了GLUtils.texSubImage2D方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadTexture

import android.opengl.GLUtils; //导入方法依赖的package包/类
public static int loadTexture(final Bitmap img, final int usedTexId, boolean recyled) {
if(img == null)
	return NO_TEXTURE; 
      int textures[] = new int[1];
      if (usedTexId == NO_TEXTURE) {
          GLES20.glGenTextures(1, textures, 0);
          GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textures[0]);
          GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                  GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
          GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                  GLES20.GL_TEXTURE_MIN_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);

          GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, img, 0);
      } else {
          GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, usedTexId);
          GLUtils.texSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, img);
          textures[0] = usedTexId;
      }
      if(recyled)
      	img.recycle();
      return textures[0];
  }
 
开发者ID:smartbeng,项目名称:PaoMovie,代码行数:27,代码来源:OpenGLUtils.java

示例2: loadTexture

import android.opengl.GLUtils; //导入方法依赖的package包/类
public static int loadTexture(final Bitmap img, final int usedTexId, final boolean recycle) {
    int textures[] = new int[1];
    if (usedTexId == NO_TEXTURE) {
        GLES20.glGenTextures(1, textures, 0);
        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textures[0]);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                GLES20.GL_TEXTURE_MIN_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);

        GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, img, 0);
    } else {
        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, usedTexId);
        GLUtils.texSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, img);
        textures[0] = usedTexId;
    }
    if (recycle) {
        img.recycle();
    }
    return textures[0];
}
 
开发者ID:vipycm,项目名称:mao-android,代码行数:26,代码来源:OpenGlUtils.java

示例3: loadTexture

import android.opengl.GLUtils; //导入方法依赖的package包/类
public static int loadTexture(final Bitmap img, final int usedTexId, boolean recyled) {
    if(img == null)
        return NO_TEXTURE;
    int textures[] = new int[1];
    if (usedTexId == NO_TEXTURE) {
        GLES20.glGenTextures(1, textures, 0);
        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textures[0]);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                GLES20.GL_TEXTURE_MIN_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);

        GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, img, 0);
    } else {
        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, usedTexId);
        GLUtils.texSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, img);
        textures[0] = usedTexId;
    }
    if(recyled)
        img.recycle();
    return textures[0];
}
 
开发者ID:TobiasLee,项目名称:FilterPlayer,代码行数:27,代码来源:OpenGlUtils.java

示例4: loadTexture

import android.opengl.GLUtils; //导入方法依赖的package包/类
public static int loadTexture(Bitmap img, int usedTexId, boolean recycle) {
    int[] textures = new int[1];
    if(usedTexId == -1) {
        GLES20.glGenTextures(1, textures, 0);
        GLES20.glBindTexture(3553, textures[0]);
        GLES20.glTexParameterf(3553, 10240, 9729.0F);
        GLES20.glTexParameterf(3553, 10241, 9729.0F);
        GLES20.glTexParameterf(3553, 10242, 33071.0F);
        GLES20.glTexParameterf(3553, 10243, 33071.0F);
        GLUtils.texImage2D(3553, 0, img, 0);
    } else {
        GLES20.glBindTexture(3553, usedTexId);
        GLUtils.texSubImage2D(3553, 0, 0, 0, img);
        textures[0] = usedTexId;
    }

    if(recycle) {
        img.recycle();
    }

    return textures[0];
}
 
开发者ID:0kai,项目名称:FilterCamera,代码行数:23,代码来源:OpenGlUtils.java

示例5: loadTexture

import android.opengl.GLUtils; //导入方法依赖的package包/类
public static int loadTexture(final Bitmap img, final int usedTexId, final boolean recycle) {
    int textures[] = new int[1];
    if (usedTexId == NO_TEXTURE) {
        GLES20.glGenTextures(1, textures, 0);
        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textures[0]);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                GLES20.GL_TEXTURE_MIN_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);

        GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, img, 0);
    } else {
        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, usedTexId);
        GLUtils.texSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, img);
        textures[0] = usedTexId;
    }
    if (recycle) {
        img.recycle();
    }
    
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
    return textures[0];
}
 
开发者ID:lzmlsfe,项目名称:19porn,代码行数:28,代码来源:OpenGlUtils.java

示例6: loadTexture

import android.opengl.GLUtils; //导入方法依赖的package包/类
public static int loadTexture(Bitmap paramBitmap, int paramInt, boolean paramBoolean)
{
    int[] arrayOfInt = new int[1];
    if (paramInt == -1)
    {
        GLES20.glGenTextures(1, arrayOfInt, 0);
        GLES20.glBindTexture(3553, arrayOfInt[0]);
        GLES20.glTexParameterf(3553, 10240, 9729.0F);

        GLES20.glTexParameterf(3553, 10241, 9729.0F);

        GLES20.glTexParameterf(3553, 10242, 33071.0F);

        GLES20.glTexParameterf(3553, 10243, 33071.0F);

        GLUtils.texImage2D(3553, 0, paramBitmap, 0);
    }
    else
    {
        GLES20.glBindTexture(3553, paramInt);
        GLUtils.texSubImage2D(3553, 0, 0, 0, paramBitmap);
        arrayOfInt[0] = paramInt;
    }
    if (paramBoolean) {
        paramBitmap.recycle();
    }
    return arrayOfInt[0];
}
 
开发者ID:zhangyaqiang,项目名称:Fatigue-Detection,代码行数:29,代码来源:OpenGlUtils.java

示例7: loadTextureWithOldTexId

import android.opengl.GLUtils; //导入方法依赖的package包/类
public static int loadTextureWithOldTexId(final Bitmap img, final int usedTexId) {
    int textures[] = new int[1];
    if (usedTexId == GLEtc.NO_TEXTURE) {
        return getTextureFromBitmap(img,null);
    } else {
        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, usedTexId);
        GLUtils.texSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, img);
        textures[0] = usedTexId;
    }
    return textures[0];
}
 
开发者ID:zhangyaqiang,项目名称:Fatigue-Detection,代码行数:12,代码来源:TextureUtils.java

示例8: texSubImage2D

import android.opengl.GLUtils; //导入方法依赖的package包/类
@Override
public void texSubImage2D(BasicTexture texture, int xOffset, int yOffset, Bitmap bitmap,
                          int format, int type) {
    GLES20.glBindTexture(GL_TARGET, texture.getId());
    checkError();
    GLUtils.texSubImage2D(GL_TARGET, 0, xOffset, yOffset, bitmap, format, type);
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:8,代码来源:GLES20Canvas.java

示例9: texSubImage2D

import android.opengl.GLUtils; //导入方法依赖的package包/类
@Override
public void texSubImage2D(BasicTexture texture, int xOffset, int yOffset, Bitmap bitmap,
                          int format, int type) {
    int target = texture.getTarget();
    GLES20.glBindTexture(target, texture.getId());
    checkError();
    GLUtils.texSubImage2D(target, 0, xOffset, yOffset, bitmap, format, type);
}
 
开发者ID:ChillingVan,项目名称:android-openGL-canvas,代码行数:9,代码来源:GLES20Canvas.java

示例10: loadTexture

import android.opengl.GLUtils; //导入方法依赖的package包/类
public static int loadTexture(final @NonNull Bitmap image, final int usedTexId, final boolean recycle)
{
	if(image == null)
		throw new NullPointerException("loadTexture can't be used with a null Bitmap");
	if(image.isRecycled())
		throw new IllegalArgumentException("bitmap is recycled");

	int textures[] = new int[1];
	if(usedTexId == NO_TEXTURE)
	{
		GLES20.glGenTextures(1, textures, 0);
		GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textures[0]);
		GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
		GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_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);

		GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, image, 0);
	}
	else
	{
		GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, usedTexId);
		GLUtils.texSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, image);
		textures[0] = usedTexId;
	}
	if(recycle)
		image.recycle();
	
	return textures[0];
}
 
开发者ID:KAlO2,项目名称:PerfectShow,代码行数:31,代码来源:OpenGLUtils.java

示例11: loadTexture2

import android.opengl.GLUtils; //导入方法依赖的package包/类
public static int loadTexture2(final Bitmap bitmap) {
		final int[] textureHandle = new int[1];

		glGenTextures(1, textureHandle, 0);

		if (textureHandle[0] != 0) {
			// Bind to the texture in OpenGL
			glBindTexture(GL_TEXTURE_2D, textureHandle[0]);

			// Set filtering
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

			// Load the bitmap into the bound texture.
			GLUtils.texSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bitmap);

//			Buffer byteBuffer = ByteBuffer.allocate(bitmap.getByteCount());
//			bitmap.copyPixelsToBuffer(byteBuffer);
//			glTexImage2D(GL_TEXTURE_2D, 0, GLES20.GL_RGB, bitmap.getWidth(), bitmap.getHeight(),
//					0, GLES20.GL_RGB, GLES20.GL_UNSIGNED_BYTE, byteBuffer);

			// Recycle the bitmap, since its data has been loaded into OpenGL.
			bitmap.recycle();
		} else {
			throw new RuntimeException("Error loading texture.");
		}

		return textureHandle[0];
	}
 
开发者ID:rohanoid5,项目名称:Muzesto,代码行数:32,代码来源:TextureHelper.java

示例12: texSubImage2D

import android.opengl.GLUtils; //导入方法依赖的package包/类
@Override
public void texSubImage2D(BasicTexture texture, int xOffset, int yOffset, Bitmap bitmap,
        int format, int type) {
    int target = texture.getTarget();
    GLES20.glBindTexture(target, texture.getId());
    checkError();
    GLUtils.texSubImage2D(target, 0, xOffset, yOffset, bitmap, format, type);
}
 
开发者ID:Mr-lin930819,项目名称:SimplOS,代码行数:9,代码来源:GLES20Canvas.java

示例13: replace

import android.opengl.GLUtils; //导入方法依赖的package包/类
void replace() throws TextureException
{
	if(mCompressedTexture != null)
	{
		mCompressedTexture.replace();
		setWidth(mCompressedTexture.getWidth());
		setHeight(mCompressedTexture.getHeight());
		setTextureId(mCompressedTexture.getTextureId());
		setUniformHandle(mCompressedTexture.getUniformHandle());
		return;
	}
	
	if (mBitmap == null && (mByteBuffer == null || mByteBuffer.limit() == 0))
		throw new TextureException("Texture could not be replaced because there is no Bitmap or ByteBuffer set.");

	GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureId);

	if (mBitmap != null)
	{
		int bitmapFormat = mBitmap.getConfig() == Config.ARGB_8888 ? GLES20.GL_RGBA : GLES20.GL_RGB;
		if(mBitmap.getWidth() != mWidth || mBitmap.getHeight() != mHeight)
			throw new TextureException("Texture could not be updated because the texture size is different from the original.");
		if(bitmapFormat != mBitmapFormat)
			throw new TextureException("Texture could not be updated because the bitmap format is different from the original");
		
		GLUtils.texSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, mBitmap, mBitmapFormat, GLES20.GL_UNSIGNED_BYTE);
	} else if(mByteBuffer != null) {
		if (mWidth == 0 || mHeight == 0 || mBitmapFormat == 0)
			throw new TextureException(
					"Could not update ByteBuffer texture. One or more of the following properties haven't been set: width, height or bitmap format");
		GLES20.glTexSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, mWidth, mHeight, mBitmapFormat, GLES20.GL_UNSIGNED_BYTE, mByteBuffer);
	}

	if (mMipmap)
		GLES20.glGenerateMipmap(GLES20.GL_TEXTURE_2D);

	GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
}
 
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:39,代码来源:ASingleTexture.java

示例14: setFrameRate

import android.opengl.GLUtils; //导入方法依赖的package包/类
public void setFrameRate(int fps) {
    mBitmap.eraseColor(0x00000000);

    String text = createFpsText(fps);
    mCanvas.drawText(text, mBitmapWidth / 2, mBitmapHeight - mTextPaint.descent(), mTextPaint);

    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextures[0]);
    GLUtils.texSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, mBitmap);
}
 
开发者ID:ReallyVasiliy,项目名称:wear3D,代码行数:10,代码来源:FrameRateComponent.java

示例15: setupTextures

import android.opengl.GLUtils; //导入方法依赖的package包/类
private void setupTextures(TextureAtlas atlas) {
    int[] names = new int[1];
    glGenTextures(1, names, 0);
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, names[0]);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    GLUtils.texImage2D(GL_TEXTURE_2D, 0, Bitmap.createBitmap(atlas.getWidth(), atlas.getHeight(),
            Bitmap.Config.ARGB_8888), 0);

    List<TextureAtlas.Region> regions = atlas.getRegions();
    textureCoordsCacheArray = new float[regions.size() * 8];
    final int k = 8;
    float atlasWidth = atlas.getWidth();
    float atlasHeight = atlas.getHeight();
    for (int i = 0; i < regions.size(); i++) {
        TextureAtlas.Region r = regions.get(i);
        GLUtils.texSubImage2D(GL_TEXTURE_2D, 0, r.x, r.y, r.bitmap);
        float x0 = r.x / atlasWidth;
        float y0 = r.y / atlasHeight;
        float x1 = x0 + r.bitmap.getWidth() / atlasWidth;
        float y1 = y0 + r.bitmap.getHeight() / atlasHeight;
        List<Float> coords = Arrays.asList(x0, y0, x0, y1, x1, y1, x1, y0);
        if (r.cwRotated) {
            Collections.rotate(coords, 2);
        }
        for (int j = 0; j < coords.size(); j++) {
            textureCoordsCacheArray[i * k + j] = coords.get(j);
        }
    }
}
 
开发者ID:shchurov,项目名称:ParticleView,代码行数:34,代码来源:ParticleRenderer.java


注:本文中的android.opengl.GLUtils.texSubImage2D方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。