如何在Android中使用OpenGL绘制圆?如何在、Android、OpenGL

由网友(吾执青灯欲锁魂)分享简介:我一直工作在一个小应用程序为我的电话,我想补充一个功能需求一个圆圈被吸引到屏幕上。我不知道我怎么能做到这一点使用OpenGL ES。谁能帮助? I've been working on a small app for my phone, and I wanted to add afeature that need...

我一直工作在一个小应用程序为我的电话,我想补充一个功能需求一个圆圈被吸引到屏幕上。我不知道我怎么能做到这一点使用OpenGL ES。谁能帮助?

I've been working on a small app for my phone, and I wanted to add a feature that needs a circle to be drawn to screen. I was wondering how I could do this using OpenGL ES. can anyone help?

推荐答案

基本上有三个选项画一个圆圈。你不指定是否要固/薄/厚等等看,所以不是所有的这些可能是appriopriate为您的情况:

Basically, there are three options for drawing a circle. You don't specify whether you want a solid/thin/thick etc look, so not all of these might be appriopriate for your case:

产生在一个圆圈顶点和使用glDrawArray(GL_LINES,...)。根据你有多少个顶点生成,这将产生一个很好的和清晰的结果。

Generate vertices in a circle and use glDrawArray( GL_LINES, ... ). Depending on how many vertices you generate this will yield a nice and crisp result.

使用pgenerated圆(阿尔法透明度)的质地$ P $并将其映射在四。这将导致非常流畅的图形,并允许一个'thick'圈,但它不会像灵活:即使有纹理映射,你会希望你的纹理是关于你正在呈现四相同尺寸

Use a pregenerated texture of a circle (with alpha transparency) and map it on a quad. This will result in very smooth graphics and allow for a ´thick´ circle, but it will not be as flexible: even with mipmapping, you'll want your texture to be about the same size you are rendering the quad.

使用一个片段着色器。如这个例子应该的正常工作。

Use a fragment shader. Examples like this should work fine.

阅读全文

相关推荐

最新文章