()
| 1416 | |
| 1417 | |
| 1418 | protected PGL initTexRectShader() { |
| 1419 | PGL ppgl = primaryPGL ? this : graphics.getPrimaryPGL(); |
| 1420 | |
| 1421 | if (!ppgl.loadedTexRectShader || ppgl.texRectShaderContext != ppgl.glContext) { |
| 1422 | String[] preprocVertSrc = preprocessVertexSource(texVertShaderSource, getGLSLVersion(), getGLSLVersionSuffix()); |
| 1423 | String vertSource = PApplet.join(preprocVertSrc, "\n"); |
| 1424 | String[] preprocFragSrc = preprocessFragmentSource(texRectFragShaderSource, getGLSLVersion(), getGLSLVersionSuffix()); |
| 1425 | String fragSource = PApplet.join(preprocFragSrc, "\n"); |
| 1426 | ppgl.texRectVertShader = createShader(VERTEX_SHADER, vertSource); |
| 1427 | ppgl.texRectFragShader = createShader(FRAGMENT_SHADER, fragSource); |
| 1428 | if (0 < ppgl.texRectVertShader && 0 < ppgl.texRectFragShader) { |
| 1429 | ppgl.texRectShaderProgram = createProgram(ppgl.texRectVertShader, |
| 1430 | ppgl.texRectFragShader); |
| 1431 | } |
| 1432 | if (0 < ppgl.texRectShaderProgram) { |
| 1433 | ppgl.texRectVertLoc = getAttribLocation(ppgl.texRectShaderProgram, "position"); |
| 1434 | ppgl.texRectTCoordLoc = getAttribLocation(ppgl.texRectShaderProgram, "texCoord"); |
| 1435 | ppgl.texRectSamplerLoc = getUniformLocation(ppgl.texRectShaderProgram, "texMap"); |
| 1436 | } |
| 1437 | ppgl.loadedTexRectShader = true; |
| 1438 | ppgl.texRectShaderContext = ppgl.glContext; |
| 1439 | |
| 1440 | genBuffers(1, intBuffer); |
| 1441 | ppgl.texRectGeoVBO = intBuffer.get(0); |
| 1442 | bindBuffer(ARRAY_BUFFER, ppgl.texRectGeoVBO); |
| 1443 | bufferData(ARRAY_BUFFER, 16 * SIZEOF_FLOAT, null, STATIC_DRAW); |
| 1444 | } |
| 1445 | |
| 1446 | return ppgl; |
| 1447 | } |
| 1448 | |
| 1449 | |
| 1450 | protected void drawTextureRect(int id, int texW, int texH, |
no test coverage detected