MCPcopy Index your code
hub / github.com/benfry/processing4 / initTex2DShader

Method initTex2DShader

core/src/processing/opengl/PGL.java:1329–1361  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1327
1328
1329 protected PGL initTex2DShader() {
1330 PGL ppgl = primaryPGL ? this : graphics.getPrimaryPGL();
1331
1332 if (!ppgl.loadedTex2DShader || ppgl.tex2DShaderContext != ppgl.glContext) {
1333 String[] preprocVertSrc = preprocessVertexSource(texVertShaderSource, getGLSLVersion(), getGLSLVersionSuffix());
1334 String vertSource = PApplet.join(preprocVertSrc, "\n");
1335 String[] preprocFragSrc = preprocessFragmentSource(tex2DFragShaderSource, getGLSLVersion(), getGLSLVersionSuffix());
1336 String fragSource = PApplet.join(preprocFragSrc, "\n");
1337 ppgl.tex2DVertShader = createShader(VERTEX_SHADER, vertSource);
1338 ppgl.tex2DFragShader = createShader(FRAGMENT_SHADER, fragSource);
1339 if (0 < ppgl.tex2DVertShader && 0 < ppgl.tex2DFragShader) {
1340 ppgl.tex2DShaderProgram = createProgram(ppgl.tex2DVertShader, ppgl.tex2DFragShader);
1341 }
1342 if (0 < ppgl.tex2DShaderProgram) {
1343 ppgl.tex2DVertLoc = getAttribLocation(ppgl.tex2DShaderProgram, "position");
1344 ppgl.tex2DTCoordLoc = getAttribLocation(ppgl.tex2DShaderProgram, "texCoord");
1345 ppgl.tex2DSamplerLoc = getUniformLocation(ppgl.tex2DShaderProgram, "texMap");
1346 }
1347 ppgl.loadedTex2DShader = true;
1348 ppgl.tex2DShaderContext = ppgl.glContext;
1349
1350 genBuffers(1, intBuffer);
1351 ppgl.tex2DGeoVBO = intBuffer.get(0);
1352 bindBuffer(ARRAY_BUFFER, ppgl.tex2DGeoVBO);
1353 bufferData(ARRAY_BUFFER, 16 * SIZEOF_FLOAT, null, STATIC_DRAW);
1354 }
1355
1356 if (texData == null) {
1357 texData = allocateDirectFloatBuffer(texCoords.length);
1358 }
1359
1360 return ppgl;
1361 }
1362
1363
1364 protected void drawTexture2D(int id, int texW, int texH,

Callers 1

drawTexture2DMethod · 0.95

Calls 15

getGLSLVersionMethod · 0.95
getGLSLVersionSuffixMethod · 0.95
joinMethod · 0.95
createShaderMethod · 0.95
createProgramMethod · 0.95
getAttribLocationMethod · 0.95
getUniformLocationMethod · 0.95
genBuffersMethod · 0.95
bindBufferMethod · 0.95
bufferDataMethod · 0.95

Tested by

no test coverage detected