MCPcopy Create free account
hub / github.com/OpenKinect/libfreenect2 / allocate

Method allocate

src/opengl_depth_packet_processor.cpp:315–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

313 }
314
315 void allocate(size_t new_width, size_t new_height)
316 {
317 if (size)
318 return;
319
320 GLint max_size;
321 glGetIntegerv(GL_MAX_RECTANGLE_TEXTURE_SIZE, &max_size);
322 if (new_width > (size_t)max_size || new_height > (size_t)max_size)
323 {
324 LOG_ERROR << "GL_MAX_RECTANGLE_TEXTURE_SIZE is too small: " << max_size;
325 exit(-1);
326 }
327
328 width = new_width;
329 height = new_height;
330 size = height * width * bytes_per_pixel;
331 data = new unsigned char[size];
332
333 glGenTextures(1, &texture);
334 bindToUnit(GL_TEXTURE0);
335 glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
336 glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
337 glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
338 glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
339 glTexImage2D(GL_TEXTURE_RECTANGLE, 0, FormatT::InternalFormat, width, height, 0, FormatT::Format, FormatT::Type, 0);
340 CHECKGL();
341 }
342
343 void upload()
344 {

Callers 4

initializeMethod · 0.45
loadXZTablesMethod · 0.45
loadLookupTableMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected