當前位置: 首頁>>代碼示例>>Java>>正文


Java GL10.glLineWidth方法代碼示例

本文整理匯總了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);
}
 
開發者ID:xhd-Git,項目名稱:3DPrint-Controller,代碼行數:26,代碼來源:STLRenderer.java

示例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);
}
 
開發者ID:StringMon,項目名稱:homescreenarcade,代碼行數:13,代碼來源:GLFieldView.java

示例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);
}
 
開發者ID:xhd-Git,項目名稱:3DPrint-Controller,代碼行數:33,代碼來源:STLRenderer.java

示例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);
	}
 
開發者ID:AmulaySoftGroup,項目名稱:TaBeTa,代碼行數:82,代碼來源:CurlMesh.java


注:本文中的javax.microedition.khronos.opengles.GL10.glLineWidth方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。