Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
491 views
in Technique[技术] by (71.8m points)

android - OpenGL ES - Dashed Lines

I'm Using OpenGlEs10 for My Android Game Development, I Want to Draw Dashed-lines Now Im Using This Code to Draw My Line:

gl.glColor4f(1.0f, 0.0f, 0.0f, 1.0f);
// gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
gl.glLineWidth(4.0f);
gl.glVertexPointer(2, GL10.GL_FLOAT, 0, mBufDestVertices);
gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, mDesPoly.getNumPoints());

How Should I Change It? Does I have to Texture The line? And if so, How?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I recommend to use a 1D texture (performance: use alpha testing instead of blending)

don't forget to:

  • set texture filter to GL_NEAREST
  • texture wrapping to GL_REPEAT

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...