(Texture tex)
| 1323 | } |
| 1324 | |
| 1325 | protected void setTexture(Texture tex) { |
| 1326 | texture = tex; |
| 1327 | |
| 1328 | float scaleu = 1; |
| 1329 | float scalev = 1; |
| 1330 | float dispu = 0; |
| 1331 | float dispv = 0; |
| 1332 | |
| 1333 | if (tex != null) { |
| 1334 | if (tex.invertedX()) { |
| 1335 | scaleu = -1; |
| 1336 | dispu = 1; |
| 1337 | } |
| 1338 | |
| 1339 | if (tex.invertedY()) { |
| 1340 | scalev = -1; |
| 1341 | dispv = 1; |
| 1342 | } |
| 1343 | |
| 1344 | scaleu *= tex.maxTexcoordU(); |
| 1345 | dispu *= tex.maxTexcoordU(); |
| 1346 | scalev *= tex.maxTexcoordV(); |
| 1347 | dispv *= tex.maxTexcoordV(); |
| 1348 | |
| 1349 | setUniformValue(texOffsetLoc, 1.0f / tex.width, 1.0f / tex.height); |
| 1350 | |
| 1351 | if (-1 < textureLoc) { |
| 1352 | texUnit = -1 < ppixelsUnit ? ppixelsUnit + 1 : getLastTexUnit() + 1; |
| 1353 | setUniformValue(textureLoc, texUnit); |
| 1354 | pgl.activeTexture(PGL.TEXTURE0 + texUnit); |
| 1355 | tex.bind(); |
| 1356 | } |
| 1357 | } |
| 1358 | |
| 1359 | if (-1 < texMatrixLoc) { |
| 1360 | if (tcmat == null) { |
| 1361 | tcmat = new float[16]; |
| 1362 | } |
| 1363 | tcmat[0] = scaleu; tcmat[4] = 0; tcmat[ 8] = 0; tcmat[12] = dispu; |
| 1364 | tcmat[1] = 0; tcmat[5] = scalev; tcmat[ 9] = 0; tcmat[13] = dispv; |
| 1365 | tcmat[2] = 0; tcmat[6] = 0; tcmat[10] = 0; tcmat[14] = 0; |
| 1366 | tcmat[3] = 0; tcmat[7] = 0; tcmat[11] = 0; tcmat[15] = 0; |
| 1367 | setUniformMatrix(texMatrixLoc, tcmat); |
| 1368 | } |
| 1369 | } |
| 1370 | |
| 1371 | |
| 1372 | protected boolean supportsTexturing() { |
no test coverage detected