本文整理汇总了Java中com.jogamp.opengl.util.texture.Texture.getImageWidth方法的典型用法代码示例。如果您正苦于以下问题:Java Texture.getImageWidth方法的具体用法?Java Texture.getImageWidth怎么用?Java Texture.getImageWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.opengl.util.texture.Texture
的用法示例。
在下文中一共展示了Texture.getImageWidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateBackground
import com.jogamp.opengl.util.texture.Texture; //导入方法依赖的package包/类
private void updateBackground(ICentralBody centralBody)
{
Texture mapTexture = textureCache.load(centralBody.getTexture());
int mapTextureWidth = mapTexture.getImageWidth();
int mapTextureHeight = mapTexture.getImageHeight();
getParameters().setImageSize(mapTextureWidth, mapTextureHeight);
}
示例2: draw
import com.jogamp.opengl.util.texture.Texture; //导入方法依赖的package包/类
@Override
public void draw()
{
GL2 gl = getGL();
MapViewParameters area = getParameters();
if (isDone()) {
return;
}
if (!running()) {
start();
}
long currentTime = System.currentTimeMillis();
if (currentTime >= stopTime) {
stop();
done();
return;
}
// System.out.println("start=" + startTime + " current=" + currentTime + " stop=" + stopTime + " elapsed=" + (currentTime - startTime) + " todo=" + (stopTime - currentTime));
int currentFrameIndex = (int) ((currentTime - startTime) / durationPerFrame);
int realCurrentFrameIndex = Math.min(currentFrameIndex, frames.size() - 1);
MaruMapResources currentFrameRes = frames.get(realCurrentFrameIndex);
Texture currentFrame = getTextureCache().get(currentFrameRes);
if ((width == 0) && (height == 0))
{
// use the default image size when no other was specified
width = currentFrame.getImageWidth();
height = currentFrame.getImageHeight();
}
int scaledWidth = area.getScaledSize(width);
int scaledHeight = area.getScaledSize(height);
int scaledWidthHalf = scaledWidth / 2;
int scaledHeightHalf = scaledHeight / 2;
gl.glColor3f(1.0f, 1.0f, 1.0f);
GLUtils.drawTexture(gl, currentFrame, posX - scaledWidthHalf, area.clientAreaHeight - posY - scaledHeightHalf, scaledWidth, scaledHeight);
}