0
我目前擁有的東西:給定直角座標的寬度和高度以及紋理的比例因子,生成紋理座標。這是沃金精:GopenGL將紋理座標與世界對齊,而不是面對
vertices = new float[] {
0, 0, 0, this.height/(this.texture.height * this.texScaleHeight),
this.width, 0, this.width/(this.texture.width * this.texScaleWidth), height/(this.texture.height * this.texScaleHeight),
this.width, this.height, this.width/(this.texture.width * this.texScaleWidth), 0,
0, this.height, 0, 0 };
我想現在要做的,就是一些與矩形不同的位置有紋理的無縫畢業(即相鄰)。我嘗試了以下但沒有好的結果。
vertices = new float[] {
0, 0, -this.getPosition().x * this.texScaleWidth, this.height/(this.texture.height * this.texScaleHeight) -this.getPosition().y * this.texScaleHeight,
this.width, 0, this.width/(this.texture.width * this.texScaleWidth) -this.getPosition().x * this.texScaleWidth, height/(this.texture.height * this.texScaleHeight)-this.getPosition().y * this.texScaleHeight,
this.width, this.height, this.width/(this.texture.width * this.texScaleWidth) -this.getPosition().x * this.texScaleWidth, -this.getPosition().y * this.texScaleHeight,
0, this.height, -this.getPosition().x * this.texScaleWidth, -this.getPosition().y * this.texScaleHeight };
我怎樣才能實現紋理是「對齊到世界」,而不是他們坐的矩形?