问题描述
我要画圈圈在我的Android应用程序。其实这是一个吃豆子游戏,我需要绘制片。由于有现场许多药片我决定提请各平板电脑一个多边形。
I need to draw circles in my Android application. Actually it is a Pacman game and I need to draw tablets. Since there are many tablets on field I decided to draw each tablet with a single polygon.
下面是我的想法的说明:
Here is the illustration of my idea:
顶点coordrs:
// (x, y)
0 : -R, R * (Math.sqrt(2) + 1)
1 : -R, -R
2 : R * (Math.sqrt(2) + 1), -R
COORDS顶点相对于圆心计算放置圈轻松更高版本。
Vertex coords are calculated relative to circle center to place circles with ease later.
问题出在纹理贴图,根据我的计算UV的应该是这样的。
The problem is in texture mapping, according to my calculations UVs should be like this
0 : 0, -(Math.sqrt(2) + 0.5)
1 : 0, 1
2 : 1, (Math.sqrt(2) + 0.5)
但负V值会导致应用程序只显示黑屏。这就是为什么我认为我失去了一些东西还是我走错路了...
But negative V value causes application to show only black screen. That is why I think that I'm missing something or I'm going the wrong way…
我的问题是:是否有可能呈现以这种方式还是不质地?如果是不可能的,什么是画小点的最佳方式?
My question is: Is it possible to render the texture in that way or not? If it isn't possible, what is the best way to draw small dots?
P.S:我与OpenGL ES 2.0的Android上工作
P.S: I'm working with OpenGL ES 2.0 on Android.
在我看来,这家伙正在试图做的。
Seems to me, that this guy is trying to do the same.
推荐答案
的 GL_TEXTURE_WRAP_S
和 GL_TEXTURE_WRAP_T
纹理参数默认设置为 GL_REPEAT
。它们设置为 GL_CLAMP_TO_EDGE
,而不是让你在寻找(请参阅)
The GL_TEXTURE_WRAP_S
and GL_TEXTURE_WRAP_T
texture parameters are set to GL_REPEAT
by default. Set them to GL_CLAMP_TO_EDGE
instead to get the effect you're looking for (see the glTexParameter documentation)
这篇关于OpenGL ES的纹理映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!