本文整理匯總了Java中org.oscim.backend.GL20類的典型用法代碼示例。如果您正苦於以下問題:Java GL20類的具體用法?Java GL20怎麽用?Java GL20使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
GL20類屬於org.oscim.backend包,在下文中一共展示了GL20類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setUp
import org.oscim.backend.GL20; //導入依賴的package包/類
@Before
public void setUp() throws Exception {
indicator = new RouteLocationIndicator(new TestMap());
mockGL20 = Mockito.mock(GL20.class);
layerRendererTestHelper = new LayerRendererTestHelper(indicator.getRenderer());
LayerRendererTestHelper.init(mockGL20);
}
示例2: uploadToTexture
import org.oscim.backend.GL20; //導入依賴的package包/類
@Override
public void uploadToTexture(boolean replace) {
Gdx.gl.glTexImage2D(GL20.TEXTURE_2D, 0, pixmap.getGLInternalFormat(),
pixmap.getWidth(), pixmap.getHeight(), 0,
pixmap.getGLFormat(), pixmap.getGLType(),
pixmap.getPixels());
if (disposable) {
pixmap.dispose();
}
}
示例3: render
import org.oscim.backend.GL20; //導入依賴的package包/類
@Override
public void render(GLViewport v) {
GLState.useProgram(shader);
GLState.blend(true);
GLState.test(false, false);
GL.glBindBuffer(GL20.GL_ARRAY_BUFFER, 0);
FloatBuffer mVertices;
final float[] mVerticesData = {
-0.4f, 0.0f, 0.0f,
-0.9f, 0.7f, 0.0f,
1.0f, 0.0f, 0.0f,
-0.9f, -0.7f, 0.0f,
};
mVertices = ByteBuffer.allocateDirect(mVerticesData.length * 4)
.order(ByteOrder.nativeOrder()).asFloatBuffer();
mVertices.clear();
mVertices.put(mVerticesData);
mVertices.flip();
GL.glVertexAttribPointer(vertexPosition, 3, GL20.GL_FLOAT, false, 0, mVertices);
GLState.enableVertexArrays(vertexPosition, -1);
GL.glUniform1f(rotation, degrees);
float scaleValue = SCALE_FACTOR * v.pos.getZoomLevel();
if (scaleValue > MAX_SCALE) {
scaleValue = MAX_SCALE;
} else if (scaleValue < MIN_SCALE) {
scaleValue = MIN_SCALE;
}
GL.glUniform1f(scale, scaleValue);
double x = indicatorPosition.x - v.pos.x;
double y = indicatorPosition.y - v.pos.y;
double tileScale = Tile.SIZE * v.pos.scale;
v.mvp.setTransScale((float) (x * tileScale), (float) (y * tileScale), 1);
v.mvp.multiplyMM(v.viewproj, v.mvp);
v.mvp.setAsUniform(matrixPosition);
if (visible > 1) {
GL.glDrawArrays(GL20.GL_TRIANGLE_FAN, 0, 4);
}
}
示例4: init
import org.oscim.backend.GL20; //導入依賴的package包/類
public static void init(GL20 gl) {
LayerRenderer.init(gl);
}
示例5: render
import org.oscim.backend.GL20; //導入依賴的package包/類
@Override
public void render(GLViewport v) {
GLState.useProgram(mShaderProgram);
GLState.blend(true);
GLState.test(false, false);
GLState.enableVertexArrays(hVertexPosition, -1);
MapRenderer.bindQuadVertexVBO(hVertexPosition, true);
float radius = CIRCLE_SIZE;
animate(true);
boolean viewShed = false;
if (!mLocationIsVisible /* || pos.zoomLevel < SHOW_ACCURACY_ZOOM */) {
//animate(true);
} else {
if (v.pos.zoomLevel >= SHOW_ACCURACY_ZOOM)
radius = (float) (mRadius * v.pos.scale);
viewShed = true;
//animate(false);
}
GL.glUniform1f(hScale, radius);
double x = mIndicatorPosition.x - v.pos.x;
double y = mIndicatorPosition.y - v.pos.y;
double tileScale = Tile.SIZE * v.pos.scale;
v.mvp.setTransScale((float) (x * tileScale), (float) (y * tileScale), 1);
v.mvp.multiplyMM(v.viewproj, v.mvp);
v.mvp.setAsUniform(hMatrixPosition);
if (!viewShed) {
float phase = Math.abs(animPhase() - 0.5f) * 2;
//phase = Interpolation.fade.apply(phase);
phase = Interpolation.swing.apply(phase);
GL.glUniform1f(hPhase, 0.8f + phase * 0.2f);
} else {
GL.glUniform1f(hPhase, 1);
}
if (viewShed && mLocationIsVisible) {
float rotation = mCompass.getRotation() - 90;
GL.glUniform2f(hDirection,
(float) Math.cos(Math.toRadians(rotation)),
(float) Math.sin(Math.toRadians(rotation)));
} else {
GL.glUniform2f(hDirection, 0, 0);
}
GL.glDrawArrays(GL20.GL_TRIANGLE_STRIP, 0, 4);
}