本文整理汇总了Java中org.oscim.renderer.GLState类的典型用法代码示例。如果您正苦于以下问题:Java GLState类的具体用法?Java GLState怎么用?Java GLState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GLState类属于org.oscim.renderer包,在下文中一共展示了GLState类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: draw
import org.oscim.renderer.GLState; //导入依赖的package包/类
public static RenderBucket draw(RenderBucket l, GLViewport v) {
GLState.blend(true);
Shader s = shader;
s.set(v);
for (; l != null && l.type == HAIRLINE; l = l.next) {
HairLineBucket ll = (HairLineBucket) l;
GLUtils.setColor(s.uColor, ll.line.color, 1);
gl.vertexAttribPointer(s.aPos, 2, GL.SHORT,
false, 0, ll.vertexOffset);
gl.drawElements(GL.LINES,
ll.numIndices,
GL.UNSIGNED_SHORT,
ll.indiceOffset);
}
//GL.lineWidth(1);
return l;
}
开发者ID:opensciencemap,项目名称:vtm,代码行数:25,代码来源:HairLineBucket.java
示例2: initTexture
import org.oscim.renderer.GLState; //导入依赖的package包/类
protected void initTexture(TextureItem t) {
GLState.bindTex2D(t.id);
gl.texParameterf(GL.TEXTURE_2D, GL.TEXTURE_MIN_FILTER,
GL.LINEAR);
gl.texParameterf(GL.TEXTURE_2D, GL.TEXTURE_MAG_FILTER,
GL.LINEAR);
if (t.repeat) {
gl.texParameterf(GL.TEXTURE_2D, GL.TEXTURE_WRAP_S,
GL.REPEAT);
gl.texParameterf(GL.TEXTURE_2D, GL.TEXTURE_WRAP_T,
GL.REPEAT);
} else {
gl.texParameterf(GL.TEXTURE_2D, GL.TEXTURE_WRAP_S,
GL.CLAMP_TO_EDGE);
gl.texParameterf(GL.TEXTURE_2D, GL.TEXTURE_WRAP_T,
GL.CLAMP_TO_EDGE);
}
}
开发者ID:opensciencemap,项目名称:vtm,代码行数:21,代码来源:TextureItem.java
示例3: setColor
import org.oscim.renderer.GLState; //导入依赖的package包/类
static void setColor(AreaStyle a, Shader s, MapPosition pos) {
float fade = a.getFade(pos.scale);
float blend = a.getBlend(pos.scale);
if (fade < 1.0f) {
GLState.blend(true);
GLUtils.setColor(s.uColor, a.color, fade);
} else if (blend > 0.0f) {
if (blend == 1.0f)
GLUtils.setColor(s.uColor, a.blendColor, 1);
else
GLUtils.setColorBlend(s.uColor, a.color,
a.blendColor, blend);
} else {
/* test if color contains alpha */
GLState.blend((a.color & OPAQUE) != OPAQUE);
GLUtils.setColor(s.uColor, a.color, 1);
}
}
开发者ID:opensciencemap,项目名称:vtm,代码行数:20,代码来源:MeshBucket.java
示例4: 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);
}
开发者ID:opensciencemap,项目名称:vtm-android,代码行数:27,代码来源:TextRenderLayer.java
示例5: 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);
}
开发者ID:opensciencemap,项目名称:vtm-android,代码行数:27,代码来源:TextRenderLayer.java
示例6: 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);
}
开发者ID:andreynovikov,项目名称:trekarta,代码行数:30,代码来源:CrosshairLayer.java
示例7: set
import org.oscim.renderer.GLState; //导入依赖的package包/类
public void set(GLViewport v) {
useProgram();
GLState.enableVertexArrays(aPos, -1);
v.mvp.setAsUniform(uMVP);
gl.uniform2f(uScreen, v.getWidth() / 2, v.getHeight() / 2);
gl.uniform1f(uWidth, 1.5f);
gl.lineWidth(2);
}
开发者ID:opensciencemap,项目名称:vtm,代码行数:11,代码来源:HairLineBucket.java
示例8: setShader
import org.oscim.renderer.GLState; //导入依赖的package包/类
private static Shader setShader(Shader shader, GLMatrix mvp, boolean first) {
if (shader.useProgram() || first) {
GLState.enableVertexArrays(shader.aPos, -1);
gl.vertexAttribPointer(shader.aPos, 2,
GL.SHORT, false, 0, 0);
mvp.setAsUniform(shader.uMVP);
}
return shader;
}
开发者ID:opensciencemap,项目名称:vtm,代码行数:12,代码来源:PolygonBucket.java
示例9: 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);
}
开发者ID:opensciencemap,项目名称:vtm,代码行数:36,代码来源:PolygonBucket.java
示例10: bind
import org.oscim.renderer.GLState; //导入依赖的package包/类
/**
* Bind Texture for rendering
* [on GL-Thread]
*/
public void bind() {
if (loaded)
GLState.bindTex2D(id);
else
upload();
}
开发者ID:opensciencemap,项目名称:vtm,代码行数:11,代码来源:TextureItem.java
示例11: uploadTexture
import org.oscim.renderer.GLState; //导入依赖的package包/类
private void uploadTexture(TextureItem t) {
if (t.bitmap == null)
throw new RuntimeException("Missing bitmap for texture");
if (t.id < 0) {
int[] textureIds = GLUtils.glGenTextures(1);
t.id = textureIds[0];
initTexture(t);
if (dbg)
log.debug("fill:" + getFill()
+ " count:" + mTexCnt
+ " new texture " + t.id);
mTexCnt++;
t.bitmap.uploadToTexture(false);
} else {
GLState.bindTex2D(t.id);
/* use faster subimage upload */
t.bitmap.uploadToTexture(true);
}
if (dbg)
GLUtils.checkGlError(TextureItem.class.getName());
if (mUseBitmapPool)
releaseBitmap(t);
}
开发者ID:opensciencemap,项目名称:vtm,代码行数:33,代码来源:TextureItem.java
示例12: init
import org.oscim.renderer.GLState; //导入依赖的package包/类
public static void init() {
shader = new Shader("linetex_layer");
int[] vboIds = GLUtils.glGenBuffers(1);
mVertexFlipID = vboIds[0];
/* bytes: 0, 1, 0, 1, 0, ... */
byte[] flip = new byte[MapRenderer.MAX_QUADS * 4];
for (int i = 0; i < flip.length; i++)
flip[i] = (byte) (i % 2);
ByteBuffer buf = ByteBuffer.allocateDirect(flip.length)
.order(ByteOrder.nativeOrder());
buf.put(flip);
buf.flip();
ShortBuffer sbuf = buf.asShortBuffer();
//GL.bindBuffer(GL20.ARRAY_BUFFER, mVertexFlipID);
GLState.bindVertexBuffer(mVertexFlipID);
gl.bufferData(GL.ARRAY_BUFFER, flip.length, sbuf,
GL.STATIC_DRAW);
GLState.bindVertexBuffer(0);
// mTexID = new int[10];
// byte[] stipple = new byte[2];
// stipple[0] = 32;
// stipple[1] = 32;
// mTexID[0] = GlUtils.loadStippleTexture(stipple);
}
开发者ID:opensciencemap,项目名称:vtm,代码行数:32,代码来源:LineTexBucket.java
示例13: useProgram
import org.oscim.renderer.GLState; //导入依赖的package包/类
@Override
public boolean useProgram() {
if (super.useProgram()) {
GLState.enableVertexArrays(aPos, aTexCoord);
return true;
}
return false;
}
开发者ID:opensciencemap,项目名称:vtm,代码行数:9,代码来源:BitmapBucket.java
示例14: draw
import org.oscim.renderer.GLState; //导入依赖的package包/类
public static RenderBucket draw(RenderBucket b, GLViewport v,
float scale, float alpha) {
GLState.blend(true);
Shader s = shader;
s.useProgram();
TextureBucket tb = (TextureBucket) b;
gl.uniform1f(s.uAlpha, alpha);
v.mvp.setAsUniform(s.uMVP);
bindQuadIndicesVBO();
for (TextureItem t = tb.textures; t != null; t = t.next) {
t.bind();
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;
gl.vertexAttribPointer(s.aPos, 2,
GL.SHORT, false, 12, off);
gl.vertexAttribPointer(s.aTexCoord, 2,
GL.SHORT, false, 12, off + 8);
int numIndices = t.indices - i;
if (numIndices > MAX_INDICES)
numIndices = MAX_INDICES;
gl.drawElements(GL.TRIANGLES, numIndices,
GL.UNSIGNED_SHORT, 0);
}
}
return b.next;
}
开发者ID:opensciencemap,项目名称:vtm,代码行数:40,代码来源:BitmapBucket.java
示例15: 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;
}
开发者ID:opensciencemap,项目名称:vtm,代码行数:38,代码来源:TextureBucket.java
示例16: useProgram
import org.oscim.renderer.GLState; //导入依赖的package包/类
@Override
public boolean useProgram() {
if (super.useProgram()) {
GLState.enableVertexArrays(aPos, -1);
return true;
}
return false;
}
开发者ID:opensciencemap,项目名称:vtm,代码行数:9,代码来源:LineBucket.java
示例17: 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);
}
开发者ID:opensciencemap,项目名称:vtm,代码行数:15,代码来源:TextRenderer.java
示例18: 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("...");
}
开发者ID:opensciencemap,项目名称:vtm,代码行数:36,代码来源:CustomRenderer.java
示例19: 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("...");
}
开发者ID:opensciencemap,项目名称:vtm-android,代码行数:36,代码来源:CustomRenderLayer.java
示例20: setShader
import org.oscim.renderer.GLState; //导入依赖的package包/类
private static void setShader(int shader, Matrices m) {
//if (
GLState.useProgram(polygonProgram[shader]);
// ) {
GLState.enableVertexArrays(hPolygonVertexPosition[shader], -1);
glVertexAttribPointer(hPolygonVertexPosition[shader], 2, GL_SHORT,
false, 0, POLYGON_VERTICES_DATA_POS_OFFSET);
m.mvp.setAsUniform(hPolygonMatrix[shader]);
//}
}
开发者ID:opensciencemap,项目名称:vtm-android,代码行数:14,代码来源:PolygonRenderer.java
注:本文中的org.oscim.renderer.GLState类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论