MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / getImage

Method getImage

src/main/java/field/graphics/util/SaverFBO.java:166–191  ·  view source on GitHub ↗
(Pair<ByteBuffer, ByteBuffer> storage)

Source from the content-addressed store, hash-verified

164 while (s.length() < 6) s = "0" + s;
165 return s;
166 }
167
168 @HiddenInAutocomplete
169 private void getImage(Pair<ByteBuffer, ByteBuffer> storage) {
170
171 int[] a = {0};
172 assert glGetError() == 0;
173
174 storage.first.rewind();
175 a[0] = glGetInteger(GL_FRAMEBUFFER_BINDING);
176 glBindFramebuffer(GL_FRAMEBUFFER, fbo.get().getOpenGLFrameBufferNameInCurrentContext());
177 glReadPixels(0, 0, width, height, GL12.GL_BGR, GL_UNSIGNED_BYTE, storage.first);
178 glBindFramebuffer(GL_FRAMEBUFFER, a[0]);
179 storage.first.rewind();
180
181//// glFinish();
182// storage.first.rewind();
183// a[0] = glGetInteger(GL_FRAMEBUFFER_BINDING);
184// glBindFramebuffer(GL_FRAMEBUFFER, 0);
185//// glFinish();
186//// GL11.glReadBuffer(GL11.GL_BACK);
187// glReadPixels(0, 0, width, height, GL11.GL_RGB, GL_UNSIGNED_BYTE, storage.first);
188//// glFinish();
189// glBindFramebuffer(GL_FRAMEBUFFER, a[0]);
190// storage.first.rewind();
191
192 assert glGetError() == 0;
193 }
194

Callers 1

updateMethod · 0.95

Calls 5

glGetErrorMethod · 0.80
glGetIntegerMethod · 0.80
glReadPixelsMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected