本文整理汇总了Java中javax.microedition.khronos.opengles.GL10.glLineWidth方法的典型用法代码示例。如果您正苦于以下问题:Java GL10.glLineWidth方法的具体用法?Java GL10.glLineWidth怎么用?Java GL10.glLineWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.microedition.khronos.opengles.GL10
的用法示例。
在下文中一共展示了GL10.glLineWidth方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawLines
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
/**
* 画坐标
* @param gl
*/
private void drawLines(GL10 gl){
gl.glLineWidth(3f);
float[] vertexArray = { -100, 0, 0, 100, 0, 0, 0, -100, 0, 0, 100, 0, 0, 0, -100, 0, 0, 100 };
FloatBuffer lineBuffer = getFloatBufferFromArray(vertexArray);
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, lineBuffer);
// X : red
gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_AMBIENT, new float[] { 1.0f, 0f, 0f, 0.75f }, 0);
gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_DIFFUSE, new float[] { 1.0f, 0f, 0f, 0.5f }, 0);
gl.glDrawArrays(GL10.GL_LINES, 0, 2);
// Y : blue
gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_AMBIENT, new float[] { 0f, 0f, 1.0f, 0.75f }, 0);
gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_DIFFUSE, new float[] { 0f, 0f, 1.0f, 0.5f }, 0);
gl.glDrawArrays(GL10.GL_LINES, 2, 2);
// Z : green
gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_AMBIENT, new float[] { 0f, 1.0f, 0f, 0.75f }, 0);
gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_DIFFUSE, new float[] { 0f, 1.0f, 0f, 0.5f }, 0);
gl.glDrawArrays(GL10.GL_LINES, 4, 2);
}
示例2: endGLElements
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
void endGLElements(GL10 gl) {
vertexListManager.end();
gl.glEnable(GL10.GL_DITHER);
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity();
gl.glLineWidth(2);
vertexListManager.render(gl);
}
示例3: drawGrids
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
/**
* 画网格
* @param gl
*/
private void drawGrids(GL10 gl) {
List<Float> lineList = new ArrayList<Float>();
for (int x = -100; x <= 100; x += 5) {
lineList.add((float) x);
lineList.add(-100f);
lineList.add(0f);
lineList.add((float)x);
lineList.add(100f);
lineList.add(0f);
}
for (int y = -100; y <= 100; y += 5) {
lineList.add(-100f);
lineList.add((float) y);
lineList.add(0f);
lineList.add(100f);
lineList.add((float) y);
lineList.add(0f);
}
FloatBuffer lineBuffer = getFloatBufferFromList(lineList);
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, lineBuffer);
gl.glLineWidth(1f);
gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_AMBIENT, new float[]{0.5f, 0.5f, 0.5f, 1.0f}, 0);
gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_DIFFUSE, new float[]{0.5f, 0.5f, 0.5f, 1.0f}, 0);
gl.glDrawArrays(GL10.GL_LINES, 0, lineList.size() / 3);
}
示例4: render
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
void render(GL10 gl, boolean DrawDest) {
if (DRAW_TEXTURE && mPage.getTexturesChanged()) {
mPage.recycle();
reset();
}
// Some 'global' settings.
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
if (DRAW_TEXTURE) {
gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, mBufTexCoords);
}
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mBufVertices);
// Enable color array.
gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
gl.glColorPointer(4, GL10.GL_FLOAT, 0, mBufColors);
gl.glDisable(GL10.GL_LIGHTING);
gl.glDisable(GL10.GL_TEXTURE_2D);
if (!DRAW_TEXTURE) {
// inja khasiate transparent ro faAl mikonim ke betoonim too
// CurlPage be kaaghaz alpha bedim
gl.glEnable(GL10.GL_BLEND);
gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, mVerticesCountFront);
}
// Draw front facing texture.
if (DRAW_TEXTURE) {
gl.glEnable(GL10.GL_BLEND);
gl.glEnable(GL10.GL_TEXTURE_2D);
gl.glBindTexture(GL10.GL_TEXTURE_2D, renderTex[0]);
gl.glBlendFunc(GL10.GL_ONE_MINUS_DST_ALPHA, GL10.GL_ZERO);
gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, mVerticesCountFront);
gl.glDisable(GL10.GL_BLEND);
gl.glDisable(GL10.GL_TEXTURE_2D);
}
int backStartIdx = Math.max(0, mVerticesCountFront - 2);
int backCount = mVerticesCountFront + mVerticesCountBack - backStartIdx;
// Draw back facing blank vertices.
if (!DRAW_TEXTURE) {
// Added At 5/6/1394
gl.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA);
gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, backStartIdx, backCount);
}
// Draw back facing texture.
if (DRAW_TEXTURE) {
gl.glEnable(GL10.GL_BLEND);
gl.glEnable(GL10.GL_TEXTURE_2D);
gl.glBindTexture(GL10.GL_TEXTURE_2D, renderTex[0]);
// Changed with gl.glBlendFunc(GLES10.GL_SRC_ALPHA,
// GLES10.GL_ONE_MINUS_SRC_ALPHA); At 5/6/1394
gl.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA);
gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, backStartIdx, backCount);
gl.glDisable(GL10.GL_BLEND);
gl.glDisable(GL10.GL_TEXTURE_2D);
}
// Disable textures and color array.
gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
if (DRAW_POLYGON_OUTLINES_FRONT) {
gl.glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
gl.glLineWidth(3.0f);
gl.glVertexPointer(2, GL10.GL_FLOAT, 0, mBufOutFront);
gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, mOutFrontCount);
}
if (DRAW_DEST_POLY && DrawDest) {
gl.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
gl.glLineWidth(5.0f);
gl.glVertexPointer(2, GL10.GL_FLOAT, 0, mBufDestVertices);
gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, mDesPoly.getNumPoints());
}
gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
}