MCPcopy Index your code
hub / github.com/processing/processing / restoreFirstFrame

Method restoreFirstFrame

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

Source from the content-addressed store, hash-verified

1000
1001
1002 protected void restoreFirstFrame() {
1003 if (firstFrame == null) return;
1004
1005 IntBuffer tex = allocateIntBuffer(1);
1006 genTextures(1, tex);
1007
1008 int w, h;
1009 float scale = getPixelScale();
1010 if (hasNpotTexSupport()) {
1011 w = (int)(scale * graphics.width);
1012 h = (int)(scale * graphics.height);
1013 } else {
1014 w = nextPowerOfTwo((int)(scale * graphics.width));
1015 h = nextPowerOfTwo((int)(scale * graphics.height));
1016 }
1017
1018 bindTexture(TEXTURE_2D, tex.get(0));
1019 texParameteri(TEXTURE_2D, TEXTURE_MIN_FILTER, NEAREST);
1020 texParameteri(TEXTURE_2D, TEXTURE_MAG_FILTER, NEAREST);
1021 texParameteri(TEXTURE_2D, TEXTURE_WRAP_S, CLAMP_TO_EDGE);
1022 texParameteri(TEXTURE_2D, TEXTURE_WRAP_T, CLAMP_TO_EDGE);
1023 texImage2D(TEXTURE_2D, 0, RGBA, w, h, 0, RGBA, UNSIGNED_BYTE, null);
1024 texSubImage2D(TEXTURE_2D, 0, 0, 0, graphics.width, graphics.height, RGBA, UNSIGNED_BYTE, firstFrame);
1025
1026 drawTexture(TEXTURE_2D, tex.get(0), w, h,
1027 0, 0, graphics.width, graphics.height,
1028 0, 0, (int)(scale * graphics.width), (int)(scale * graphics.height),
1029 0, 0, graphics.width, graphics.height);
1030
1031 deleteTextures(1, tex);
1032 firstFrame.clear();
1033 firstFrame = null;
1034 }
1035
1036 protected void destroyFBOLayer() {
1037 if (threadIsCurrent() && fboLayerCreated) {

Callers 1

beginRenderMethod · 0.95

Calls 13

allocateIntBufferMethod · 0.95
genTexturesMethod · 0.95
getPixelScaleMethod · 0.95
hasNpotTexSupportMethod · 0.95
nextPowerOfTwoMethod · 0.95
bindTextureMethod · 0.95
texParameteriMethod · 0.95
texImage2DMethod · 0.95
texSubImage2DMethod · 0.95
drawTextureMethod · 0.95
deleteTexturesMethod · 0.95
getMethod · 0.65

Tested by

no test coverage detected