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


Java ShaderProgramConstants.LOCATION_INVALID属性代码示例

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


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

示例1: getUniformLocationOptional

public int getUniformLocationOptional(final String pUniformName) {
	final Integer location = this.mUniformLocations.get(pUniformName);
	if (location != null) {
		return location.intValue();
	} else {
		return ShaderProgramConstants.LOCATION_INVALID;
	}
}
 
开发者ID:mediamonks,项目名称:tilt-game-android,代码行数:8,代码来源:ShaderProgram.java

示例2: initUniformLocations

private void initUniformLocations() throws ShaderProgramLinkException {
	this.mUniformLocations.clear();

	ShaderProgram.PARAMETERS_CONTAINER[0] = 0;
	GLES20.glGetProgramiv(this.mProgramID, GLES20.GL_ACTIVE_UNIFORMS, ShaderProgram.PARAMETERS_CONTAINER, 0);
	final int numUniforms = ShaderProgram.PARAMETERS_CONTAINER[0];

	for (int i = 0; i < numUniforms; i++) {
		GLES20.glGetActiveUniform(this.mProgramID, i, ShaderProgram.NAME_CONTAINER_SIZE, ShaderProgram.LENGTH_CONTAINER, 0, ShaderProgram.SIZE_CONTAINER, 0, ShaderProgram.TYPE_CONTAINER, 0, ShaderProgram.NAME_CONTAINER, 0);

		int length = ShaderProgram.LENGTH_CONTAINER[0];

		/* Some drivers do not report the actual length here, but zero. Then the name is '\0' terminated. */
		if (length == 0) {
			while ((length < ShaderProgram.NAME_CONTAINER_SIZE) && (ShaderProgram.NAME_CONTAINER[length] != '\0')) {
				length++;
			}
		}

		String name = new String(ShaderProgram.NAME_CONTAINER, 0, length);
		int location = GLES20.glGetUniformLocation(this.mProgramID, name);

		if (location == ShaderProgramConstants.LOCATION_INVALID) {
			/* Some drivers do not report an incorrect length. Then the name is '\0' terminated. */
			length = 0;
			while (length < ShaderProgram.NAME_CONTAINER_SIZE && ShaderProgram.NAME_CONTAINER[length] != '\0') {
				length++;
			}

			name = new String(ShaderProgram.NAME_CONTAINER, 0, length);
			location = GLES20.glGetUniformLocation(this.mProgramID, name);

			if (location == ShaderProgramConstants.LOCATION_INVALID) {
				throw new ShaderProgramLinkException("Invalid location for uniform: '" + name + "'.");
			}
		}

		this.mUniformLocations.put(name, location);
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:40,代码来源:ShaderProgram.java

示例3: getAttributeLocationOptional

public int getAttributeLocationOptional(final String pAttributeName) {
	final Integer location = this.mAttributeLocations.get(pAttributeName);
	if(location != null) {
		return location.intValue();
	} else {
		return ShaderProgramConstants.LOCATION_INVALID;
	}
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:8,代码来源:ShaderProgram.java

示例4: setTextureOptional

/**
 * @param pUniformName
 * @param pTexture the index of the Texture to use. Similar to {@link android.opengl.GLES20#GL_TEXTURE0}, {@link android.opengl.GLES20#GL_TEXTURE1}, ... except that it is <b><code>0</code></b> based.
 */
public void setTextureOptional(final String pUniformName, final int pTexture) {
	final int location = this.getUniformLocationOptional(pUniformName);
	if (location != ShaderProgramConstants.LOCATION_INVALID) {
		GLES20.glUniform1i(location, pTexture);
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:10,代码来源:ShaderProgram.java

示例5: getAttributeLocationOptional

public int getAttributeLocationOptional(final String pAttributeName) {
	final Integer location = this.mAttributeLocations.get(pAttributeName);
	if (location != null) {
		return location.intValue();
	} else {
		return ShaderProgramConstants.LOCATION_INVALID;
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:8,代码来源:ShaderProgram.java

示例6: initUniformLocations

private void initUniformLocations() throws ShaderProgramLinkException {
	this.mUniformLocations.clear();

	ShaderProgram.PARAMETERS_CONTAINER[0] = 0;
	GLES20.glGetProgramiv(this.mProgramID, GLES20.GL_ACTIVE_UNIFORMS, ShaderProgram.PARAMETERS_CONTAINER, 0);
	final int numUniforms = ShaderProgram.PARAMETERS_CONTAINER[0];

	for(int i = 0; i < numUniforms; i++) {
		GLES20.glGetActiveUniform(this.mProgramID, i, ShaderProgram.NAME_CONTAINER_SIZE, ShaderProgram.LENGTH_CONTAINER, 0, ShaderProgram.SIZE_CONTAINER, 0, ShaderProgram.TYPE_CONTAINER, 0, ShaderProgram.NAME_CONTAINER, 0);

		int length = ShaderProgram.LENGTH_CONTAINER[0];

		/* Some drivers do not report the actual length here, but zero. Then the name is '\0' terminated. */
		if(length == 0) {
			while((length < ShaderProgram.NAME_CONTAINER_SIZE) && (ShaderProgram.NAME_CONTAINER[length] != '\0')) {
				length++;
			}
		}

		String name = new String(ShaderProgram.NAME_CONTAINER, 0, length);
		int location = GLES20.glGetUniformLocation(this.mProgramID, name);

		if(location == ShaderProgramConstants.LOCATION_INVALID) {
			/* Some drivers do not report an incorrect length. Then the name is '\0' terminated. */
			length = 0;
			while(length < ShaderProgram.NAME_CONTAINER_SIZE && ShaderProgram.NAME_CONTAINER[length] != '\0') {
				length++;
			}

			name = new String(ShaderProgram.NAME_CONTAINER, 0, length);
			location = GLES20.glGetUniformLocation(this.mProgramID, name);

			if(location == ShaderProgramConstants.LOCATION_INVALID) {
				throw new ShaderProgramLinkException("Invalid location for uniform: '" + name + "'.");
			}
		}

		this.mUniformLocations.put(name, location);
	}
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:40,代码来源:ShaderProgram.java

示例7: getUniformLocationOptional

public int getUniformLocationOptional(final String pUniformName) {
	final Integer location = this.mUniformLocations.get(pUniformName);
	if(location != null) {
		return location.intValue();
	} else {
		return ShaderProgramConstants.LOCATION_INVALID;
	}
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:8,代码来源:ShaderProgram.java

示例8: initAttributeLocations

/**
 * TODO Is this actually needed? As the locations of {@link org.andengine.opengl.vbo.attribute.VertexBufferObjectAttribute}s are now 'predefined'.
 */
@Deprecated
private void initAttributeLocations() {
	this.mAttributeLocations.clear();

	ShaderProgram.PARAMETERS_CONTAINER[0] = 0;
	GLES20.glGetProgramiv(this.mProgramID, GLES20.GL_ACTIVE_ATTRIBUTES, ShaderProgram.PARAMETERS_CONTAINER, 0);
	final int numAttributes = ShaderProgram.PARAMETERS_CONTAINER[0];

	for (int i = 0; i < numAttributes; i++) {
		GLES20.glGetActiveAttrib(this.mProgramID, i, ShaderProgram.NAME_CONTAINER_SIZE, ShaderProgram.LENGTH_CONTAINER, 0, ShaderProgram.SIZE_CONTAINER, 0, ShaderProgram.TYPE_CONTAINER, 0, ShaderProgram.NAME_CONTAINER, 0);

		int length = ShaderProgram.LENGTH_CONTAINER[0];

		/* Some drivers do not report the actual length here, but zero. Then the name is '\0' terminated. */
		if (length == 0) {
			while ((length < ShaderProgram.NAME_CONTAINER_SIZE) && (ShaderProgram.NAME_CONTAINER[length] != '\0')) {
				length++;
			}
		}

		String name = new String(ShaderProgram.NAME_CONTAINER, 0, length);
		int location = GLES20.glGetAttribLocation(this.mProgramID, name);

		if (location == ShaderProgramConstants.LOCATION_INVALID) {
			/* Some drivers do not report an incorrect length. Then the name is '\0' terminated. */
			length = 0;
			while (length < ShaderProgram.NAME_CONTAINER_SIZE && ShaderProgram.NAME_CONTAINER[length] != '\0') {
				length++;
			}

			name = new String(ShaderProgram.NAME_CONTAINER, 0, length);
			location = GLES20.glGetAttribLocation(this.mProgramID, name);

			if (location == ShaderProgramConstants.LOCATION_INVALID) {
				throw new ShaderProgramLinkException("Invalid location for attribute: '" + name + "'.");
			}
		}

		this.mAttributeLocations.put(name, location);
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:44,代码来源:ShaderProgram.java

示例9: setUniformOptional

public void setUniformOptional(final String pUniformName, final float[] pGLMatrix) {
	final int location = this.getUniformLocationOptional(pUniformName);
	if(location != ShaderProgramConstants.LOCATION_INVALID) {
		GLES20.glUniformMatrix4fv(this.getUniformLocationOptional(pUniformName), 1, false, pGLMatrix, 0);
	}
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:6,代码来源:ShaderProgram.java

示例10: setUniformOptional

public void setUniformOptional(final String pUniformName, final float pX) {
	final int location = this.getUniformLocationOptional(pUniformName);
	if (location != ShaderProgramConstants.LOCATION_INVALID) {
		GLES20.glUniform1f(this.getUniformLocationOptional(pUniformName), pX);
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:6,代码来源:ShaderProgram.java


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