我对 LWJGL 和使用位图字符的四边形纹理有疑问。我想显示一个大写的T。T 在第 6 行和第 5 列。这是X:40,Y:距离左上角32px。
我使用以下代码:
GL11.glTexCoord2f((float) (Math.floor(charID / this.charsInRow) * charSize) / bitmapSize, (float) (Math.floor(charID % this.charsInRow) * charSize) / bitmapSize);
GL11.glVertex2f((charPosition * fontSize) + x, y);
GL11.glTexCoord2f((float) (Math.floor(charID / this.charsInRow) * charSize + charSize) / bitmapSize, (float) (Math.floor(charID % this.charsInRow) * charSize) / bitmapSize);
GL11.glVertex2f((charPosition * fontSize) + x + fontSize, y);
GL11.glTexCoord2f((float) (Math.floor(charID / this.charsInRow) * charSize + charSize) / bitmapSize, (float) (Math.floor(charID % this.charsInRow) * charSize + charSize) / bitmapSize);
GL11.glVertex2f((charPosition * fontSize) + x + fontSize, y + fontSize);
GL11.glTexCoord2f((float) (Math.floor(charID / this.charsInRow) * charSize) / bitmapSize, (float) (Math.floor(charID % this.charsInRow) * charSize + charSize) / bitmapSize);
GL11.glVertex2f((charPosition * fontSize) + x
,y + fontSize);
但是LWJGL从右下角开始计数,所以会显示一个奇怪的ASCII符号。
我该怎么做才能选择 T?