本文整理汇总了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;
}
}
示例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);
}
}
示例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;
}
}
示例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);
}
}
示例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;
}
}
示例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);
}
}
示例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;
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}