本文整理汇总了Java中android.opengl.GLES20.glActiveTexture方法的典型用法代码示例。如果您正苦于以下问题:Java GLES20.glActiveTexture方法的具体用法?Java GLES20.glActiveTexture怎么用?Java GLES20.glActiveTexture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.opengl.GLES20
的用法示例。
在下文中一共展示了GLES20.glActiveTexture方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bindShaderValues
import android.opengl.GLES20; //导入方法依赖的package包/类
@Override
protected void bindShaderValues() {
mRenderVertices.position(0);
GLES20.glVertexAttribPointer(mPositionHandle, 2, GLES20.GL_FLOAT, false,
8, mRenderVertices);
GLES20.glEnableVertexAttribArray(mPositionHandle);
mTextureVertices[mCurrentRotation].position(0);
GLES20.glVertexAttribPointer(mTextureCoordHandle, 2, GLES20.GL_FLOAT, false,
8, mTextureVertices[mCurrentRotation]);
GLES20.glEnableVertexAttribArray(mTextureCoordHandle);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, mTextureIn);
GLES20.glUniform1i(mTextureHandle, 0);
mSurfaceTexture.getTransformMatrix(mMatrix);
GLES20.glUniformMatrix4fv(mMatrixHandle, 1, false, mMatrix, 0);
}
示例2: prepareTexture
import android.opengl.GLES20; //导入方法依赖的package包/类
private void prepareTexture(BasicTexture texture, int program, ShaderParameter[] params) {
deleteRecycledResources();
GLES20.glUseProgram(program);
checkError();
GLES20.glDisable(GLES20.GL_BLEND);
checkError();
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
checkError();
texture.onBind(this);
GLES20.glBindTexture(GL_TARGET, texture.getId());
checkError();
GLES20.glUniform1i(params[INDEX_TEXTURE_SAMPLER].handle, 0);
checkError();
GLES20.glUniform1f(params[INDEX_ALPHA].handle, 1);
checkError();
}
示例3: onDraw
import android.opengl.GLES20; //导入方法依赖的package包/类
public void onDraw(final int textureId, final FloatBuffer cubeBuffer, final FloatBuffer textureBuffer) {
GLES20.glUseProgram(mGLProgId);
runPendingOnDrawTasks();
if (!mIsInitialized) {
return;
}
cubeBuffer.position(0);
GLES20.glVertexAttribPointer(mGLAttribPosition, 2, GLES20.GL_FLOAT, false, 0, cubeBuffer);
GLES20.glEnableVertexAttribArray(mGLAttribPosition);
textureBuffer.position(0);
GLES20.glVertexAttribPointer(mGLAttribTextureCoordinate, 2, GLES20.GL_FLOAT, false, 0,
textureBuffer);
GLES20.glEnableVertexAttribArray(mGLAttribTextureCoordinate);
if (textureId != OpenGlUtils.NO_TEXTURE) {
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureId);
GLES20.glUniform1i(mGLUniformTexture, 0);
}
onDrawArraysPre();
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
GLES20.glDisableVertexAttribArray(mGLAttribPosition);
GLES20.glDisableVertexAttribArray(mGLAttribTextureCoordinate);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
}
示例4: d
import android.opengl.GLES20; //导入方法依赖的package包/类
@CallSuper
protected void d(int paramInt)
{
super.d(paramInt);
for (int i = 0; i < 8; i++) {
if (this.bu[i] != -1)
{
GLES20.glActiveTexture(bs[i]);
GLES20.glBindTexture(3553, this.bu[i]);
GLES20.glUniform1i(this.bt[i], 3 + i);
}
}
}
示例5: onDrawArraysAfter
import android.opengl.GLES20; //导入方法依赖的package包/类
protected void onDrawArraysAfter(){
for(int i = 0; i < inputTextureHandles.length
&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
示例6: draw
import android.opengl.GLES20; //导入方法依赖的package包/类
/**
* draw specific texture with specific texture matrix
* @param tex_id texture ID
* @param tex_matrix texture matrix、if this is null, the last one use(we don't check size of this array and needs at least 16 of float)
*/
public void draw(final int tex_id, final float[] tex_matrix) {
GLES20.glUseProgram(hProgram);
if (tex_matrix != null)
GLES20.glUniformMatrix4fv(muTexMatrixLoc, 1, false, tex_matrix, 0);
GLES20.glUniformMatrix4fv(muMVPMatrixLoc, 1, false, mMvpMatrix, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, tex_id);
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, VERTEX_NUM);
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, 0);
GLES20.glUseProgram(0);
}
示例7: onDrawArraysAfter
import android.opengl.GLES20; //导入方法依赖的package包/类
protected void onDrawArraysAfter(){
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
示例8: onDrawArraysPre
import android.opengl.GLES20; //导入方法依赖的package包/类
protected void onDrawArraysPre(){
for(int i = 0; i < inputTextureHandles.length
&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);
GLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));
}
}
示例9: onDrawArraysPre
import android.opengl.GLES20; //导入方法依赖的package包/类
protected void onDrawArraysPre(){
for(int i = 0; i < inputTextureHandles.length
&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);
GLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));
}
}
示例10: drawTex
import android.opengl.GLES20; //导入方法依赖的package包/类
private void drawTex(int tex, boolean isOES, int fbo)
{
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fbo);
if(fbo == 0)
GLES20.glViewport(0, 0, mView.getWidth(), mView.getHeight());
else
GLES20.glViewport(0, 0, mFBOWidth, mFBOHeight);
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
if(isOES) {
GLES20.glUseProgram(progOES);
GLES20.glVertexAttribPointer(vPosOES, 2, GLES20.GL_FLOAT, false, 4*2, vert);
GLES20.glVertexAttribPointer(vTCOES, 2, GLES20.GL_FLOAT, false, 4*2, texOES);
} else {
GLES20.glUseProgram(prog2D);
GLES20.glVertexAttribPointer(vPos2D, 2, GLES20.GL_FLOAT, false, 4*2, vert);
GLES20.glVertexAttribPointer(vTC2D, 2, GLES20.GL_FLOAT, false, 4*2, tex2D);
}
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
if(isOES) {
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, tex);
GLES20.glUniform1i(GLES20.glGetUniformLocation(progOES, "sTexture"), 0);
} else {
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, tex);
GLES20.glUniform1i(GLES20.glGetUniformLocation(prog2D, "sTexture"), 0);
}
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
GLES20.glFlush();
}
示例11: onDrawArraysAfter
import android.opengl.GLES20; //导入方法依赖的package包/类
protected void onDrawArraysAfter(){
for(int i = 0; i < inputTextureHandles.length
&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0+i);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
示例12: onDrawArraysAfter
import android.opengl.GLES20; //导入方法依赖的package包/类
protected void onDrawArraysAfter(){
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
if (mMaskGrey1TextureId != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE4);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
示例13: setSize
import android.opengl.GLES20; //导入方法依赖的package包/类
/**
* (Re)allocate texture. Will do nothing if the requested size equals the current size. An
* EGLContext must be bound on the current thread when calling this function. Must be called at
* least once before using the framebuffer. May be called multiple times to change size.
*/
public void setSize(int width, int height) {
if (width == 0 || height == 0) {
throw new IllegalArgumentException("Invalid size: " + width + "x" + height);
}
if (width == this.width && height == this.height) {
return;
}
this.width = width;
this.height = height;
// Allocate texture.
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureId);
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, pixelFormat, width, height, 0, pixelFormat,
GLES20.GL_UNSIGNED_BYTE, null);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GlUtil.checkNoGLES2Error("GlTextureFrameBuffer setSize");
// Attach the texture to the framebuffer as color attachment.
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, frameBufferId);
GLES20.glFramebufferTexture2D(
GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, textureId, 0);
// Check that the framebuffer is in a good state.
final int status = GLES20.glCheckFramebufferStatus(GLES20.GL_FRAMEBUFFER);
if (status != GLES20.GL_FRAMEBUFFER_COMPLETE) {
throw new IllegalStateException("Framebuffer not complete, status: " + status);
}
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
}
示例14: createExternalTextures
import android.opengl.GLES20; //导入方法依赖的package包/类
public static void createExternalTextures(int cantidad, int[] texturesId, int position) {
GLES20.glGenTextures(cantidad, texturesId, position);
for (int i = 0; i < cantidad; i++) {
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + position + i);
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, texturesId[position + i]);
GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MIN_FILTER,
GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MAG_FILTER,
GLES20.GL_LINEAR);
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_WRAP_S,
GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_WRAP_T,
GLES20.GL_CLAMP_TO_EDGE);
}
}
示例15: onDrawArraysPre
import android.opengl.GLES20; //导入方法依赖的package包/类
protected void onDrawArraysPre(){
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);
}
if (mMaskGrey1TextureId != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE4);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMaskGrey1TextureId);
GLES20.glUniform1i(mMaskGrey1UniformLocation, 4);
}
}