本文整理汇总了Java中org.oscim.renderer.GLState.test方法的典型用法代码示例。如果您正苦于以下问题:Java GLState.test方法的具体用法?Java GLState.test怎么用?Java GLState.test使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.oscim.renderer.GLState
的用法示例。
在下文中一共展示了GLState.test方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import org.oscim.renderer.GLState; //导入方法依赖的package包/类
@Override
public synchronized void render(MapPosition pos, Matrices m) {
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, layers.vbo.id);
GLState.test(false, false);
float scale = (float) (mMapPosition.scale / pos.scale);
if (layers.baseLayers != null) {
setMatrix(pos, m, true);
for (Layer l = layers.baseLayers; l != null;) {
if (l.type == Layer.POLYGON) {
l = PolygonRenderer.draw(pos, l, m, true, 1, false);
} else {
float div = scale * (float) (pos.scale / (1 << pos.zoomLevel));
l = LineRenderer.draw(layers, l, pos, m, div, 0);
}
}
}
setMatrix(pos, m, false);
for (Layer l = layers.textureLayers; l != null;)
l = TextureRenderer.draw(l, scale, m);
}
示例2: render
import org.oscim.renderer.GLState; //导入方法依赖的package包/类
@Override
public synchronized void render(MapPosition pos, Matrices m) {
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, layers.vbo.id);
GLState.test(false, false);
float scale = (float) (mMapPosition.scale / pos.scale);
setMatrix(pos, m, true);
if (layers.baseLayers != null) {
for (Layer l = layers.baseLayers; l != null;) {
if (l.type == Layer.POLYGON) {
l = PolygonRenderer.draw(pos, l, m, true, 1, false);
} else {
float div = scale * (float) (pos.scale / (1 << pos.zoomLevel));
l = LineRenderer.draw(layers, l, pos, m, div, 0);
}
}
}
setMatrix(pos, m, false);
for (Layer l = layers.textureLayers; l != null;)
l = TextureRenderer.draw(l, scale, m);
}
示例3: render
import org.oscim.renderer.GLState; //导入方法依赖的package包/类
@Override
public void render(GLViewport v) {
GLState.useProgram(mShaderProgram);
GLState.blend(true);
GLState.test(false, false);
GLState.enableVertexArrays(hVertexPosition, -1);
MapRenderer.bindQuadVertexVBO(hVertexPosition);
if (mRunAnim) {
float alpha = 1f - animPhase();
if (alpha > mAlpha || alpha < 0.01f) {
mAlpha = 0f;
animate(false);
} else {
mAlpha = alpha;
}
}
v.mvp.setTransScale(0f, 0f, 1);
// use v.viewproj to honor rotation ant tilt, or v.proj otherwise
v.mvp.multiplyMM(v.proj, v.mvp);
v.mvp.setAsUniform(hMatrixPosition);
gl.uniform1f(hScale, mScale);
GLUtils.setColor(hColor, mColor, mAlpha);
gl.drawArrays(GL.TRIANGLE_STRIP, 0, 4);
}
示例4: drawOver
import org.oscim.renderer.GLState; //导入方法依赖的package包/类
/**
* Clear stencilbuffer for a tile region by drawing
* a quad with func 'always' and op 'zero'. Using 'color'
* and 'alpha' to fake a fade effect.
*/
public static void drawOver(GLMatrix mvp, int color, float alpha) {
/* TODO true could be avoided when same shader and vbo */
setShader(polyShader, mvp, true);
if (color == 0) {
gl.colorMask(false, false, false, false);
} else {
GLUtils.setColor(polyShader.uColor, color, alpha);
GLState.blend(true);
}
// TODO always pass stencil test: <-- only if not proxy?
//GL.stencilFunc(GL20.ALWAYS, 0x00, 0x00);
gl.stencilFunc(GL.EQUAL, CLIP_BIT, CLIP_BIT);
/* write to all bits */
gl.stencilMask(0xFF);
// FIXME uneeded probably
GLState.test(false, true);
/* zero out area to draw to */
gl.stencilOp(GL.KEEP, GL.KEEP, GL.ZERO);
gl.drawArrays(GL.TRIANGLE_STRIP, 0, 4);
if (color == 0)
gl.colorMask(true, true, true, true);
}
示例5: draw
import org.oscim.renderer.GLState; //导入方法依赖的package包/类
public static RenderBucket draw(RenderBucket b, GLViewport v, float scale) {
GLState.test(false, false);
GLState.blend(true);
shader.useProgram();
TextureBucket tb = (TextureBucket) b;
gl.uniform1f(shader.uScale, tb.fixed ? 1 / scale : 1);
v.proj.setAsUniform(shader.uProj);
v.mvp.setAsUniform(shader.uMV);
MapRenderer.bindQuadIndicesVBO();
for (TextureItem t = tb.textures; t != null; t = t.next) {
gl.uniform2f(shader.uTexSize,
1f / (t.width * COORD_SCALE),
1f / (t.height * COORD_SCALE));
t.bind();
/* draw up to maxVertices in each iteration */
for (int i = 0; i < t.indices; i += MAX_INDICES) {
/* to.offset * (24(shorts) * 2(short-bytes)
* / 6(indices) == 8) */
int off = (t.offset + i) * 8 + tb.vertexOffset;
int numIndices = t.indices - i;
if (numIndices > MAX_INDICES)
numIndices = MAX_INDICES;
tb.render(off, numIndices);
}
}
return b.next;
}
示例6: render
import org.oscim.renderer.GLState; //导入方法依赖的package包/类
@Override
public synchronized void render(GLViewport v) {
GLState.test(false, false);
//Debug.draw(pos, layers);
buckets.vbo.bind();
float scale = (float) (v.pos.scale / mMapPosition.scale);
setMatrix(v, false);
for (RenderBucket l = buckets.get(); l != null;)
l = TextureBucket.Renderer.draw(l, v, scale);
}
示例7: render
import org.oscim.renderer.GLState; //导入方法依赖的package包/类
@Override
public void render(GLViewport v) {
// Use the program object
GLState.useProgram(mProgramObject);
GLState.blend(true);
GLState.test(false, false);
// unbind previously bound VBOs
gl.bindBuffer(GL.ARRAY_BUFFER, 0);
// Load the vertex data
//mVertices.position(0);
gl.vertexAttribPointer(hVertexPosition, 3, GL.FLOAT, false, 0, mVertices);
//mVertices.position(2);
//GL.vertexAttribPointer(hVertexPosition, 2, GL20.FLOAT, false, 4, mVertices);
GLState.enableVertexArrays(hVertexPosition, -1);
/* apply view and projection matrices */
// set mvp (tmp) matrix relative to mMapPosition
// i.e. fixed on the map
float ratio = 1f / mMap.getWidth();
v.mvp.setScale(ratio, ratio, 1);
v.mvp.multiplyLhs(v.proj);
v.mvp.setAsUniform(hMatrixPosition);
// Draw the triangle
gl.drawArrays(GL.TRIANGLE_STRIP, 0, 4);
GLUtils.checkGlError("...");
}
示例8: render
import org.oscim.renderer.GLState; //导入方法依赖的package包/类
@Override
public void render(MapPosition pos, Matrices m) {
// Use the program object
GLState.useProgram(mProgramObject);
GLState.blend(true);
GLState.test(false, false);
// unbind previously bound VBOs
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);
// Load the vertex data
//mVertices.position(0);
GLES20.glVertexAttribPointer(hVertexPosition, 3, GLES20.GL_FLOAT, false, 0, mVertices);
//mVertices.position(2);
//GLES20.glVertexAttribPointer(hVertexPosition, 2, GLES20.GL_FLOAT, false, 4, mVertices);
GLState.enableVertexArrays(hVertexPosition, -1);
/* apply view and projection matrices */
// set mvp (tmp) matrix relative to mMapPosition
// i.e. fixed on the map
float ratio = 1f / mMapView.getWidth();
m.mvp.setScale(ratio, ratio, 1);
m.mvp.multiplyLhs(m.proj);
m.mvp.setAsUniform(hMatrixPosition);
// Draw the triangle
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
GlUtils.checkGlError("...");
}
示例9: debugDraw
import org.oscim.renderer.GLState; //导入方法依赖的package包/类
static void debugDraw(Matrix4 m, float[] coords, int color) {
GLState.test(false, false);
if (mDebugFill == null) {
mDebugFill = ByteBuffer.allocateDirect(32).order(ByteOrder.nativeOrder())
.asFloatBuffer();
mDebugFill.put(coords);
}
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);
mDebugFill.position(0);
GLState.useProgram(polygonProgram[0]);
GLES20.glEnableVertexAttribArray(hPolygonVertexPosition[0]);
glVertexAttribPointer(hPolygonVertexPosition[0], 2, GLES20.GL_FLOAT,
false, 0, mDebugFill);
m.setAsUniform(hPolygonMatrix[0]);
if (color == 0)
glUniform4fv(hPolygonColor[0], 1, debugFillColor, 0);
else
glUniform4fv(hPolygonColor[0], 1, debugFillColor2, 0);
glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
GlUtils.checkGlError("draw debug");
}
示例10: render
import org.oscim.renderer.GLState; //导入方法依赖的package包/类
@Override
public void render(GLViewport v) {
GLState.useProgram(mShaderProgram);
GLState.blend(true);
GLState.test(false, false);
GLState.enableVertexArrays(hVertexPosition, -1);
MapRenderer.bindQuadVertexVBO(hVertexPosition);
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);
gl.uniform1f(hScale, mScale);
if (mLocationIsVisible) {
animate(false);
gl.uniform1f(hPhase, 1);
float rotation = mBearing - 90;
if (rotation > 180)
rotation -= 360;
else if (rotation < -180)
rotation += 360;
gl.uniform2f(hDirection,
(float) Math.cos(Math.toRadians(rotation)),
(float) Math.sin(Math.toRadians(rotation)));
} else {
animate(true);
float phase = Math.abs(animPhase() - 0.5f) * 2;
phase = Interpolation.swing.apply(phase);
gl.uniform1f(hPhase, 0.8f + phase * 0.2f);
gl.uniform2f(hDirection, 0, 0);
}
// Pointer type
gl.uniform1f(hType, 0);
gl.drawArrays(GL.TRIANGLE_STRIP, 0, 4);
}
示例11: render
import org.oscim.renderer.GLState; //导入方法依赖的package包/类
@Override
public synchronized void render(final GLViewport v) {
GLState.test(false, false);
//Debug.draw(pos, layers);
buckets.vbo.bind();
final float scale = (float) (v.pos.scale / mMapPosition.scale);
setMatrix(v, false);
for (RenderBucket l = buckets.get(); l != null;) {
l = TextureBucket.Renderer.draw(l, v, scale);
}
}
示例12: render
import org.oscim.renderer.GLState; //导入方法依赖的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);
}
}
示例13: drawStencilRegion
import org.oscim.renderer.GLState; //导入方法依赖的package包/类
/**
* Draw a tile filling rectangle to set stencil- and depth buffer
* appropriately
*
* @param first in the first run the clip region is set based on
* depth buffer and depth buffer is updated
*/
static void drawStencilRegion(int clipMode) {
//log.debug("draw stencil {}", clipMode);
mCount = 0;
mClear = false;
/* disable drawing to color buffer */
gl.colorMask(false, false, false, false);
/* write to all stencil bits */
gl.stencilMask(0xFF);
/* Draw clip-region into depth and stencil buffer.
* This is used for tile line and polygon buckets.
*
* Together with depth test (GL20.LESS) this ensures to
* only draw where no other tile has drawn yet. */
if (clipMode == CLIP_DEPTH) {
/* tests GL20.LESS/GL20.ALWAYS and */
/* write tile region to depth buffer */
GLState.test(true, true);
gl.depthMask(true);
} else {
GLState.test(false, true);
}
/* always pass stencil test and set clip bit */
gl.stencilFunc(GL.ALWAYS, CLIP_BIT, 0x00);
/* set clip bit (0x80) for draw region */
gl.stencilOp(GL.KEEP, GL.KEEP, GL.REPLACE);
/* draw a quad for the tile region */
gl.drawArrays(GL.TRIANGLE_STRIP, 0, 4);
if (clipMode == CLIP_DEPTH) {
/* dont modify depth buffer */
gl.depthMask(false);
GLState.test(false, true);
}
gl.stencilFunc(GL.EQUAL, CLIP_BIT, CLIP_BIT);
}
示例14: render
import org.oscim.renderer.GLState; //导入方法依赖的package包/类
@Override
public void render(GLViewport v) {
if (instances.size == 0)
return;
// GLUtils.checkGlError(">" + TAG);
gl.depthMask(true);
if (v.pos.zoomLevel < 17)
gl.clear(GL.DEPTH_BUFFER_BIT);
gl.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, 0);
// set state that is expected after modelBatch.end();
// modelBatch keeps track of its own state
GLState.enableVertexArrays(-1, -1);
GLState.bindTex2D(-1);
GLState.useProgram(-1);
GLState.test(false, false);
GLState.blend(false);
// GL.cullFace(GL20.BACK);
// GL.frontFace(GL20.CW);
cam.update(v);
long time = System.currentTimeMillis();
int cnt = 0;
int rnd = 0;
Viewport p = mMap.viewport();
p.getMapExtents(mBox, 10);
float scale = (float) (cam.mMapPosition.scale / v.pos.scale);
float dx =
(float) (cam.mMapPosition.x - v.pos.x)
* (Tile.SIZE << cam.mMapPosition.zoomLevel);
float dy =
(float) (cam.mMapPosition.y - v.pos.y)
* (Tile.SIZE << cam.mMapPosition.zoomLevel);
for (int i = 0; i < 8; i += 2) {
mBox[i] *= scale;
mBox[i] -= dx;
mBox[i + 1] *= scale;
mBox[i + 1] -= dy;
}
synchronized (this) {
modelBatch.begin(cam);
cnt = instances.size;
for (SharedModel instance : instances) {
instance.transform.getTranslation(tempVector);
tempVector.scl(0.9f, 0.9f, 1);
if (!GeometryUtils.pointInPoly(tempVector.x, tempVector.y, mBox, 8, 0))
continue;
modelBatch.render(instance);
rnd++;
}
modelBatch.end();
}
log.debug(">>> " + (System.currentTimeMillis() - time) + " " + cnt + "/" + rnd);
// GLUtils.checkGlError("<" + TAG);
gl.depthMask(false);
gl.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, 0);
gl.bindBuffer(GL.ARRAY_BUFFER, 0);
// GLState.bindTex2D(-1);
// GLState.useProgram(-1);
}
示例15: render
import org.oscim.renderer.GLState; //导入方法依赖的package包/类
/**
* Render all 'layers'
*/
@Override
public synchronized void render(MapPosition curPos, Matrices m) {
MapPosition pos = mMapPosition;
float div = FastMath.pow(pos.zoomLevel - curPos.zoomLevel);
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, layers.vbo.id);
GLState.test(false, false);
GLState.blend(true);
int simple = (curPos.tilt < 1 ? 1 : 0);
if (layers.baseLayers != null) {
setMatrix(curPos, m, true);
for (Layer l = layers.baseLayers; l != null;) {
switch (l.type) {
case Layer.POLYGON:
l = PolygonRenderer.draw(curPos, l, m, true, 1, false);
break;
case Layer.LINE:
l = LineRenderer.draw(layers, l, curPos, m, div, simple);
break;
case Layer.TEXLINE:
l = LineTexRenderer.draw(layers, l, curPos, m, div);
break;
}
}
}
if (layers.textureLayers != null) {
setMatrix(curPos, m, false);
float scale = (float) (pos.scale / curPos.scale);
for (Layer l = layers.textureLayers; l != null;) {
switch (l.type) {
case Layer.BITMAP:
l = BitmapRenderer.draw(l, m, 1, 1);
break;
// case Layer.SYMBOL:
// l = BitmapRenderer.draw(l, 1, m);
// break;
default:
l = TextureRenderer.draw(l, scale, m);
}
}
}
}