36 const int texture_width,
37 const int texture_height)
62 glActiveTexture(GL_TEXTURE0);
63 glBindTexture(GL_TEXTURE_2D,
texture_.gl_id);
64 glTexImage2D(GL_TEXTURE_2D,
75 glBindTexture(GL_TEXTURE_2D, 0);
92 if (
texture_.buffer_width != buffer_width ||
texture_.buffer_height != buffer_height) {
93 const size_t size_in_bytes =
sizeof(
half4) * buffer_width * buffer_height;
94 glBindBuffer(GL_PIXEL_UNPACK_BUFFER,
texture_.gl_pbo_id);
95 glBufferData(GL_PIXEL_UNPACK_BUFFER, size_in_bytes,
nullptr, GL_DYNAMIC_DRAW);
96 glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
98 texture_.buffer_width = buffer_width;
99 texture_.buffer_height = buffer_height;
213 glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
217 glActiveTexture(GL_TEXTURE0);
218 glBindTexture(GL_TEXTURE_2D,
texture_.gl_id);
222 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
225 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
233 GLuint vertex_array_object;
234 glGenVertexArrays(1, &vertex_array_object);
235 glBindVertexArray(vertex_array_object);
240 glEnableVertexAttribArray(texcoord_attribute);
241 glEnableVertexAttribArray(position_attribute);
243 glVertexAttribPointer(
244 texcoord_attribute, 2, GL_FLOAT, GL_FALSE, 4 *
sizeof(
float), (
const GLvoid *)
nullptr);
245 glVertexAttribPointer(position_attribute,
250 (
const GLvoid *)(
sizeof(
float) * 2));
252 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
254 glBindBuffer(GL_ARRAY_BUFFER, 0);
255 glBindTexture(GL_TEXTURE_2D, 0);
257 glDeleteVertexArrays(1, &vertex_array_object);
333 glActiveTexture(GL_TEXTURE0);
334 glBindTexture(GL_TEXTURE_2D,
texture_.gl_id);
335 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
336 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
337 glBindTexture(GL_TEXTURE_2D, 0);
340 glGenBuffers(1, &
texture_.gl_pbo_id);
342 LOG_ERROR <<
"Error creating texture pixel buffer object.";