本文整理汇总了Java中com.badlogic.gdx.graphics.Texture.bind方法的典型用法代码示例。如果您正苦于以下问题:Java Texture.bind方法的具体用法?Java Texture.bind怎么用?Java Texture.bind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.graphics.Texture
的用法示例。
在下文中一共展示了Texture.bind方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: progress
import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
public void progress(float cx, float cy, float r, float thickness, float amt, Color c, Texture lookup) {
//start and end angles
float start = 0f;
float end = amt * 360f;
lookup.bind();
renderer.begin(cam.combined, GL20.GL_TRIANGLE_STRIP);
Gdx.gl.glEnable(GL20.GL_BLEND);
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
int segs = (int)(24 * Math.cbrt(r));
end += 90f;
start += 90f;
float halfThick = thickness/2f;
float step = 360f / segs;
for (float angle=start; angle<(end+step); angle+=step) {
float tc = 0.5f;
if (angle==start)
tc = 0f;
else if (angle>=end)
tc = 1f;
float fx = MathUtils.cosDeg(angle);
float fy = MathUtils.sinDeg(angle);
float z = 0f;
renderer.color(c.r, c.g, c.b, c.a);
renderer.texCoord(tc, 1f);
renderer.vertex(cx + fx * (r + halfThick), cy + fy * (r + halfThick), z);
renderer.color(c.r, c.g, c.b, c.a);
renderer.texCoord(tc, 0f);
renderer.vertex(cx + fx * (r + -halfThick), cy + fy * (r + -halfThick), z);
}
renderer.end();
}
示例2: progress
import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
public void progress(float cx, float cy, float r, float thickness, float amt, Color c, Texture lookup) {
//start and end angles
float start = 0f;
float end = amt * 360f;
lookup.bind();
renderer.begin(cam.combined, GL20.GL_TRIANGLE_STRIP);
Gdx.gl.glEnable(GL20.GL_BLEND);
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
int segs = (int)(24 * Math.cbrt(r));
end += 90f;
start += 90f;
float halfThick = thickness/2f;
float step = 360f / segs;
for (float angle=start; angle<(end+step); angle+=step) {
float tc = 0.5f;
if (angle==start)
tc = 0f;
else if (angle>=end)
tc = 1f;
float fx = MathUtils.cosDeg(angle);
float fy = MathUtils.sinDeg(angle);
float z = 0f;
//renderer.
renderer.color(c.r, c.g, c.b, c.a);
renderer.texCoord(tc, 1f);
renderer.vertex(cx + fx * (r + halfThick), cy + fy * (r + halfThick), z);
renderer.color(c.r, c.g, c.b, c.a);
renderer.texCoord(tc, 0f);
renderer.vertex(cx + fx * (r + -halfThick), cy + fy * (r + -halfThick), z);
}
renderer.end();
}
示例3: setTextureAnisotropy
import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
/**
* Applies the given anisotropic level to the texture. Returns the anisotropy value that was applied,
* based on device's maximum capability. Note that this call binds the texture.
*
* @param texture The texture to apply anisotropy to.
* @param anisotropy The anisotropic level to apply. (Will be reduced if device capability is less.
* @return The anisotropic level that was applied, or -1.0 if anisotropy is not supported by the device.
*/
public static float setTextureAnisotropy (Texture texture, float anisotropy) {
if (!checkComplete)
isSupported();
if (anisotropySupported) {
texture.bind();
float valueApplied = Math.min(maxAnisotropySupported, anisotropy);
Gdx.gl20.glTexParameterf(GL20.GL_TEXTURE_2D, GL20.GL_TEXTURE_MAX_ANISOTROPY_EXT, valueApplied);
return valueApplied;
} else {
return -1f;
}
}