• Home
  • Raw
  • Download

Lines Matching full:opengl

37 #include <OpenGL/gl3.h>
70 * but since OpenGL 3.0 GL_LUMINANCE is deprecated.
88 /* MinGW exposes only OpenGL 1.1 API */
155 …av_log(ctx, AV_LOG_ERROR, "OpenGL error occurred in '%s', line %d: %d\n", __FUNCTION__, __LINE__, …
187 /* OpenGL implementation limits */
194 /* Current OpenGL configuration */
281 static av_cold int opengl_init_context(OpenGLContext *opengl);
283 static av_cold void opengl_deinit_context(OpenGLContext *opengl) in opengl_deinit_context() argument
285 glDeleteTextures(4, opengl->texture_name); in opengl_deinit_context()
286 opengl->texture_name[0] = opengl->texture_name[1] = in opengl_deinit_context()
287 opengl->texture_name[2] = opengl->texture_name[3] = 0; in opengl_deinit_context()
288 if (opengl->glprocs.glUseProgram) in opengl_deinit_context()
289 opengl->glprocs.glUseProgram(0); in opengl_deinit_context()
290 if (opengl->glprocs.glDeleteProgram) { in opengl_deinit_context()
291 opengl->glprocs.glDeleteProgram(opengl->program); in opengl_deinit_context()
292 opengl->program = 0; in opengl_deinit_context()
294 if (opengl->glprocs.glDeleteShader) { in opengl_deinit_context()
295 opengl->glprocs.glDeleteShader(opengl->vertex_shader); in opengl_deinit_context()
296 opengl->glprocs.glDeleteShader(opengl->fragment_shader); in opengl_deinit_context()
297 opengl->vertex_shader = opengl->fragment_shader = 0; in opengl_deinit_context()
299 if (opengl->glprocs.glBindBuffer) { in opengl_deinit_context()
300 opengl->glprocs.glBindBuffer(FF_GL_ARRAY_BUFFER, 0); in opengl_deinit_context()
301 opengl->glprocs.glBindBuffer(FF_GL_ELEMENT_ARRAY_BUFFER, 0); in opengl_deinit_context()
303 if (opengl->glprocs.glDeleteBuffers) { in opengl_deinit_context()
304 opengl->glprocs.glDeleteBuffers(2, &opengl->index_buffer); in opengl_deinit_context()
305 opengl->vertex_buffer = opengl->index_buffer = 0; in opengl_deinit_context()
312 OpenGLContext *opengl = h->priv_data; in opengl_resize() local
313 opengl->window_width = width; in opengl_resize()
314 opengl->window_height = height; in opengl_resize()
315 if (opengl->inited) { in opengl_resize()
316 if (opengl->no_window && in opengl_resize()
318 av_log(opengl, AV_LOG_ERROR, "Application failed to prepare window buffer.\n"); in opengl_resize()
331 OpenGLContext *opengl = h->priv_data; in opengl_control_message() local
340 return opengl_resize(h, opengl->window_width, opengl->window_height); in opengl_control_message()
348 OpenGLContext *opengl = h->priv_data; in opengl_sdl_process_events() local
367 SDL_GL_GetDrawableSize(opengl->window, &message.width, &message.height); in opengl_sdl_process_events()
379 OpenGLContext *opengl = h->priv_data; in opengl_sdl_create_window() local
382 av_log(opengl, AV_LOG_ERROR, "Unable to initialize SDL: %s\n", SDL_GetError()); in opengl_sdl_create_window()
385 opengl->window = SDL_CreateWindow(opengl->window_title, in opengl_sdl_create_window()
388 opengl->window_width, opengl->window_height, in opengl_sdl_create_window()
390 if (!opengl->window) { in opengl_sdl_create_window()
391 av_log(opengl, AV_LOG_ERROR, "Unable to create default window: %s\n", SDL_GetError()); in opengl_sdl_create_window()
394 opengl->glcontext = SDL_GL_CreateContext(opengl->window); in opengl_sdl_create_window()
395 if (!opengl->glcontext) { in opengl_sdl_create_window()
396 …av_log(opengl, AV_LOG_ERROR, "Unable to create OpenGL context on default window: %s\n", SDL_GetErr… in opengl_sdl_create_window()
404 av_log(opengl, AV_LOG_INFO, "SDL driver: '%s'.\n", SDL_GetCurrentVideoDriver()); in opengl_sdl_create_window()
405 SDL_GL_GetDrawableSize(opengl->window, &message.width, &message.height); in opengl_sdl_create_window()
409 static int av_cold opengl_sdl_load_procedures(OpenGLContext *opengl) in opengl_sdl_load_procedures() argument
411 FFOpenGLFunctions *procs = &opengl->glprocs; in opengl_sdl_load_procedures()
416 av_log(opengl, AV_LOG_ERROR, "Cannot load OpenGL function: '%s'\n", #name); \ in opengl_sdl_load_procedures()
453 static int av_cold opengl_load_procedures(OpenGLContext *opengl) in opengl_load_procedures() argument
455 FFOpenGLFunctions *procs = &opengl->glprocs; in opengl_load_procedures()
458 if (!opengl->no_window) in opengl_load_procedures()
459 return opengl_sdl_load_procedures(opengl); in opengl_load_procedures()
490 static int av_cold opengl_load_procedures(OpenGLContext *opengl) in opengl_load_procedures() argument
492 FFOpenGLFunctions *procs = &opengl->glprocs; in opengl_load_procedures()
503 av_log(opengl, AV_LOG_ERROR, "Cannot load OpenGL function: '%s'\n", #name); \ in opengl_load_procedures()
508 if (!opengl->no_window) in opengl_load_procedures()
509 return opengl_sdl_load_procedures(opengl); in opengl_load_procedures()
573 OpenGLContext *opengl = h->priv_data; in opengl_read_limits() local
592 av_log(h, AV_LOG_ERROR, "No OpenGL context initialized for the current thread\n"); in opengl_read_limits()
596 av_log(h, AV_LOG_DEBUG, "OpenGL version: %s\n", version); in opengl_read_limits()
609 glGetIntegerv(GL_MAX_TEXTURE_SIZE, &opengl->max_texture_size); in opengl_read_limits()
610 glGetIntegerv(GL_MAX_VIEWPORT_DIMS, &opengl->max_viewport_width); in opengl_read_limits()
611opengl->non_pow_2_textures = major >= 2 || strstr(extensions, "GL_ARB_texture_non_power_of_two"); in opengl_read_limits()
613 opengl->unpack_subimage = !!strstr(extensions, "GL_EXT_unpack_subimage"); in opengl_read_limits()
615 opengl->unpack_subimage = 1; in opengl_read_limits()
618 …av_log(h, AV_LOG_DEBUG, "Non Power of 2 textures support: %s\n", opengl->non_pow_2_textures ? "Yes… in opengl_read_limits()
619 …av_log(h, AV_LOG_DEBUG, "Unpack Subimage extension support: %s\n", opengl->unpack_subimage ? "Yes"… in opengl_read_limits()
620 …av_log(h, AV_LOG_DEBUG, "Max texture size: %dx%d\n", opengl->max_texture_size, opengl->max_texture… in opengl_read_limits()
622 opengl->max_viewport_width, opengl->max_viewport_height); in opengl_read_limits()
624 OPENGL_ERROR_CHECK(opengl); in opengl_read_limits()
656 static av_cold void opengl_get_texture_params(OpenGLContext *opengl) in opengl_get_texture_params() argument
660 if (opengl_format_desc[i].fixel_format == opengl->pix_fmt) { in opengl_get_texture_params()
661 opengl->format = opengl_format_desc[i].format; in opengl_get_texture_params()
662 opengl->type = opengl_format_desc[i].type; in opengl_get_texture_params()
671 OpenGLContext *opengl = s->priv_data; in opengl_compute_display_area() local
681 if (av_cmp_q(dar, (AVRational){ opengl->window_width, opengl->window_height }) > 0) { in opengl_compute_display_area()
683 opengl->picture_width = opengl->window_width; in opengl_compute_display_area()
684 opengl->picture_height = av_rescale(opengl->picture_width, dar.den, dar.num); in opengl_compute_display_area()
687 opengl->picture_height = opengl->window_height; in opengl_compute_display_area()
688 opengl->picture_width = av_rescale(opengl->picture_height, dar.num, dar.den); in opengl_compute_display_area()
692 static av_cold void opengl_get_texture_size(OpenGLContext *opengl, int in_width, int in_height, in opengl_get_texture_size() argument
695 if (opengl->non_pow_2_textures) { in opengl_get_texture_size()
699 int max = FFMIN(FFMAX(in_width, in_height), opengl->max_texture_size); in opengl_get_texture_size()
705 av_log(opengl, AV_LOG_DEBUG, "Texture size calculated from %dx%d into %dx%d\n", in opengl_get_texture_size()
710 static av_cold void opengl_fill_color_map(OpenGLContext *opengl) in opengl_fill_color_map() argument
714 enum AVPixelFormat pix_fmt = opengl->pix_fmt; in opengl_fill_color_map()
729 opengl->color_map[(i << 2) + (desc->comp[i].offset >> shift)] = 1.0; \ in opengl_fill_color_map()
732 memset(opengl->color_map, 0, sizeof(opengl->color_map)); in opengl_fill_color_map()
742 static av_cold GLuint opengl_load_shader(OpenGLContext *opengl, GLenum type, const char *source) in opengl_load_shader() argument
744 GLuint shader = opengl->glprocs.glCreateShader(type); in opengl_load_shader()
747 av_log(opengl, AV_LOG_ERROR, "glCreateShader() failed\n"); in opengl_load_shader()
750 opengl->glprocs.glShaderSource(shader, 1, &source, NULL); in opengl_load_shader()
751 opengl->glprocs.glCompileShader(shader); in opengl_load_shader()
753 opengl->glprocs.glGetShaderiv(shader, FF_GL_COMPILE_STATUS, &result); in opengl_load_shader()
756 opengl->glprocs.glGetShaderiv(shader, FF_GL_INFO_LOG_LENGTH, &result); in opengl_load_shader()
759 opengl->glprocs.glGetShaderInfoLog(shader, result, NULL, log); in opengl_load_shader()
760 av_log(opengl, AV_LOG_ERROR, "Compile error: %s\n", log); in opengl_load_shader()
766 OPENGL_ERROR_CHECK(opengl); in opengl_load_shader()
769 opengl->glprocs.glDeleteShader(shader); in opengl_load_shader()
773 static av_cold int opengl_compile_shaders(OpenGLContext *opengl, enum AVPixelFormat pix_fmt) in opengl_compile_shaders() argument
779 av_log(opengl, AV_LOG_ERROR, "Provided pixel format '%s' is not supported\n", in opengl_compile_shaders()
784 opengl->vertex_shader = opengl_load_shader(opengl, FF_GL_VERTEX_SHADER, in opengl_compile_shaders()
786 if (!opengl->vertex_shader) { in opengl_compile_shaders()
787 av_log(opengl, AV_LOG_ERROR, "Vertex shader loading failed.\n"); in opengl_compile_shaders()
790 opengl->fragment_shader = opengl_load_shader(opengl, FF_GL_FRAGMENT_SHADER, in opengl_compile_shaders()
792 if (!opengl->fragment_shader) { in opengl_compile_shaders()
793 av_log(opengl, AV_LOG_ERROR, "Fragment shader loading failed.\n"); in opengl_compile_shaders()
797 opengl->program = opengl->glprocs.glCreateProgram(); in opengl_compile_shaders()
798 if (!opengl->program) in opengl_compile_shaders()
801 opengl->glprocs.glAttachShader(opengl->program, opengl->vertex_shader); in opengl_compile_shaders()
802 opengl->glprocs.glAttachShader(opengl->program, opengl->fragment_shader); in opengl_compile_shaders()
803 opengl->glprocs.glLinkProgram(opengl->program); in opengl_compile_shaders()
805 opengl->glprocs.glGetProgramiv(opengl->program, FF_GL_LINK_STATUS, &result); in opengl_compile_shaders()
808 opengl->glprocs.glGetProgramiv(opengl->program, FF_GL_INFO_LOG_LENGTH, &result); in opengl_compile_shaders()
813 opengl->glprocs.glGetProgramInfoLog(opengl->program, result, NULL, log); in opengl_compile_shaders()
814 av_log(opengl, AV_LOG_ERROR, "Link error: %s\n", log); in opengl_compile_shaders()
820 opengl->position_attrib = opengl->glprocs.glGetAttribLocation(opengl->program, "a_position"); in opengl_compile_shaders()
821opengl->texture_coords_attrib = opengl->glprocs.glGetAttribLocation(opengl->program, "a_textureCoo… in opengl_compile_shaders()
822opengl->projection_matrix_location = opengl->glprocs.glGetUniformLocation(opengl->program, "u_proj… in opengl_compile_shaders()
823opengl->model_view_matrix_location = opengl->glprocs.glGetUniformLocation(opengl->program, "u_mode… in opengl_compile_shaders()
824opengl->color_map_location = opengl->glprocs.glGetUniformLocation(opengl->program, "u_colorMap"); in opengl_compile_shaders()
825opengl->texture_location[0] = opengl->glprocs.glGetUniformLocation(opengl->program, "u_texture0"); in opengl_compile_shaders()
826opengl->texture_location[1] = opengl->glprocs.glGetUniformLocation(opengl->program, "u_texture1"); in opengl_compile_shaders()
827opengl->texture_location[2] = opengl->glprocs.glGetUniformLocation(opengl->program, "u_texture2"); in opengl_compile_shaders()
828opengl->texture_location[3] = opengl->glprocs.glGetUniformLocation(opengl->program, "u_texture3"); in opengl_compile_shaders()
829opengl->chroma_div_w_location = opengl->glprocs.glGetUniformLocation(opengl->program, "u_chroma_di… in opengl_compile_shaders()
830opengl->chroma_div_h_location = opengl->glprocs.glGetUniformLocation(opengl->program, "u_chroma_di… in opengl_compile_shaders()
832 OPENGL_ERROR_CHECK(opengl); in opengl_compile_shaders()
835 opengl->glprocs.glDeleteShader(opengl->vertex_shader); in opengl_compile_shaders()
836 opengl->glprocs.glDeleteShader(opengl->fragment_shader); in opengl_compile_shaders()
837 opengl->glprocs.glDeleteProgram(opengl->program); in opengl_compile_shaders()
838 opengl->fragment_shader = opengl->vertex_shader = opengl->program = 0; in opengl_compile_shaders()
842 static av_cold int opengl_configure_texture(OpenGLContext *opengl, GLuint texture, in opengl_configure_texture() argument
847 opengl_get_texture_size(opengl, width, height, &new_width, &new_height); in opengl_configure_texture()
853 glTexImage2D(GL_TEXTURE_2D, 0, opengl->format, new_width, new_height, 0, in opengl_configure_texture()
854 opengl->format, opengl->type, NULL); in opengl_configure_texture()
864 OpenGLContext *opengl = s->priv_data; in opengl_prepare_vertex() local
867 …if (opengl->window_width > opengl->max_viewport_width || opengl->window_height > opengl->max_viewp… in opengl_prepare_vertex()
868 opengl->window_width = FFMIN(opengl->window_width, opengl->max_viewport_width); in opengl_prepare_vertex()
869 opengl->window_height = FFMIN(opengl->window_height, opengl->max_viewport_height); in opengl_prepare_vertex()
870 …av_log(opengl, AV_LOG_WARNING, "Too big viewport requested, limited to %dx%d", opengl->window_widt… in opengl_prepare_vertex()
872 glViewport(0, 0, opengl->window_width, opengl->window_height); in opengl_prepare_vertex()
873 opengl_make_ortho(opengl->projection_matrix, in opengl_prepare_vertex()
874 - (float)opengl->window_width / 2.0f, (float)opengl->window_width / 2.0f, in opengl_prepare_vertex()
875 - (float)opengl->window_height / 2.0f, (float)opengl->window_height / 2.0f, in opengl_prepare_vertex()
877 opengl_make_identity(opengl->model_view_matrix); in opengl_prepare_vertex()
881 opengl->vertex[0].z = opengl->vertex[1].z = opengl->vertex[2].z = opengl->vertex[3].z = 0.0f; in opengl_prepare_vertex()
882 opengl->vertex[0].x = opengl->vertex[1].x = - (float)opengl->picture_width / 2.0f; in opengl_prepare_vertex()
883 opengl->vertex[2].x = opengl->vertex[3].x = (float)opengl->picture_width / 2.0f; in opengl_prepare_vertex()
884 opengl->vertex[1].y = opengl->vertex[2].y = - (float)opengl->picture_height / 2.0f; in opengl_prepare_vertex()
885 opengl->vertex[0].y = opengl->vertex[3].y = (float)opengl->picture_height / 2.0f; in opengl_prepare_vertex()
887 opengl_get_texture_size(opengl, opengl->width, opengl->height, &tex_w, &tex_h); in opengl_prepare_vertex()
889 opengl->vertex[0].s0 = 0.0f; in opengl_prepare_vertex()
890 opengl->vertex[0].t0 = 0.0f; in opengl_prepare_vertex()
891 opengl->vertex[1].s0 = 0.0f; in opengl_prepare_vertex()
892 opengl->vertex[1].t0 = (float)opengl->height / (float)tex_h; in opengl_prepare_vertex()
893 opengl->vertex[2].s0 = (float)opengl->width / (float)tex_w; in opengl_prepare_vertex()
894 opengl->vertex[2].t0 = (float)opengl->height / (float)tex_h; in opengl_prepare_vertex()
895 opengl->vertex[3].s0 = (float)opengl->width / (float)tex_w; in opengl_prepare_vertex()
896 opengl->vertex[3].t0 = 0.0f; in opengl_prepare_vertex()
898 opengl->glprocs.glBindBuffer(FF_GL_ARRAY_BUFFER, opengl->vertex_buffer); in opengl_prepare_vertex()
899opengl->glprocs.glBufferData(FF_GL_ARRAY_BUFFER, sizeof(opengl->vertex), opengl->vertex, FF_GL_STA… in opengl_prepare_vertex()
900 opengl->glprocs.glBindBuffer(FF_GL_ARRAY_BUFFER, 0); in opengl_prepare_vertex()
901 OPENGL_ERROR_CHECK(opengl); in opengl_prepare_vertex()
907 static int opengl_prepare(OpenGLContext *opengl) in opengl_prepare() argument
910 opengl->glprocs.glUseProgram(opengl->program); in opengl_prepare()
911opengl->glprocs.glUniformMatrix4fv(opengl->projection_matrix_location, 1, GL_FALSE, opengl->projec… in opengl_prepare()
912opengl->glprocs.glUniformMatrix4fv(opengl->model_view_matrix_location, 1, GL_FALSE, opengl->model_… in opengl_prepare()
914 if (opengl->texture_location[i] != -1) { in opengl_prepare()
915 opengl->glprocs.glActiveTexture(GL_TEXTURE0 + i); in opengl_prepare()
916 glBindTexture(GL_TEXTURE_2D, opengl->texture_name[i]); in opengl_prepare()
917 opengl->glprocs.glUniform1i(opengl->texture_location[i], i); in opengl_prepare()
919 if (opengl->color_map_location != -1) in opengl_prepare()
920opengl->glprocs.glUniformMatrix4fv(opengl->color_map_location, 1, GL_FALSE, opengl->color_map); in opengl_prepare()
921 if (opengl->chroma_div_h_location != -1) in opengl_prepare()
922 opengl->glprocs.glUniform1f(opengl->chroma_div_h_location, opengl->chroma_div_h); in opengl_prepare()
923 if (opengl->chroma_div_w_location != -1) in opengl_prepare()
924 opengl->glprocs.glUniform1f(opengl->chroma_div_w_location, opengl->chroma_div_w); in opengl_prepare()
926 OPENGL_ERROR_CHECK(opengl); in opengl_prepare()
934 OpenGLContext *opengl = h->priv_data; in opengl_create_window() local
937 if (!opengl->no_window) { in opengl_create_window()
940 av_log(opengl, AV_LOG_ERROR, "Cannot create default SDL window.\n"); in opengl_create_window()
944 … av_log(opengl, AV_LOG_ERROR, "FFmpeg is compiled without SDL. Cannot create default window.\n"); in opengl_create_window()
950 message.width = opengl->window_width; in opengl_create_window()
951 message.height = opengl->window_height; in opengl_create_window()
954 av_log(opengl, AV_LOG_ERROR, "Application failed to create window buffer.\n"); in opengl_create_window()
958 av_log(opengl, AV_LOG_ERROR, "Application failed to prepare window buffer.\n"); in opengl_create_window()
968 OpenGLContext *opengl = h->priv_data; in opengl_release_window() local
969 if (!opengl->no_window) { in opengl_release_window()
971 SDL_GL_DeleteContext(opengl->glcontext); in opengl_release_window()
972 SDL_DestroyWindow(opengl->window); in opengl_release_window()
976 av_log(opengl, AV_LOG_ERROR, "Application failed to release window buffer.\n"); in opengl_release_window()
984 OpenGLContext *opengl = h->priv_data; in opengl_write_trailer() local
986 if (opengl->no_window && in opengl_write_trailer()
988 av_log(opengl, AV_LOG_ERROR, "Application failed to prepare window buffer.\n"); in opengl_write_trailer()
990 opengl_deinit_context(opengl); in opengl_write_trailer()
996 static av_cold int opengl_init_context(OpenGLContext *opengl) in opengl_init_context() argument
1001 if ((ret = opengl_compile_shaders(opengl, opengl->pix_fmt)) < 0) in opengl_init_context()
1004 desc = av_pix_fmt_desc_get(opengl->pix_fmt); in opengl_init_context()
1006 glGenTextures(desc->nb_components, opengl->texture_name); in opengl_init_context()
1008 opengl->glprocs.glGenBuffers(2, &opengl->index_buffer); in opengl_init_context()
1009 if (!opengl->index_buffer || !opengl->vertex_buffer) { in opengl_init_context()
1010 av_log(opengl, AV_LOG_ERROR, "Buffer generation failed.\n"); in opengl_init_context()
1015 opengl_configure_texture(opengl, opengl->texture_name[0], opengl->width, opengl->height); in opengl_init_context()
1019 if (opengl->non_pow_2_textures) { in opengl_init_context()
1020 opengl->chroma_div_w = 1.0f; in opengl_init_context()
1021 opengl->chroma_div_h = 1.0f; in opengl_init_context()
1023 opengl->chroma_div_w = 1 << desc->log2_chroma_w; in opengl_init_context()
1024 opengl->chroma_div_h = 1 << desc->log2_chroma_h; in opengl_init_context()
1027 if (opengl->non_pow_2_textures) in opengl_init_context()
1028 opengl_configure_texture(opengl, opengl->texture_name[i], in opengl_init_context()
1029 AV_CEIL_RSHIFT(opengl->width, desc->log2_chroma_w), in opengl_init_context()
1030 AV_CEIL_RSHIFT(opengl->height, desc->log2_chroma_h)); in opengl_init_context()
1032 … opengl_configure_texture(opengl, opengl->texture_name[i], opengl->width, opengl->height); in opengl_init_context()
1034 … opengl_configure_texture(opengl, opengl->texture_name[3], opengl->width, opengl->height); in opengl_init_context()
1037 opengl->glprocs.glBindBuffer(FF_GL_ELEMENT_ARRAY_BUFFER, opengl->index_buffer); in opengl_init_context()
1038opengl->glprocs.glBufferData(FF_GL_ELEMENT_ARRAY_BUFFER, sizeof(g_index), g_index, FF_GL_STATIC_DR… in opengl_init_context()
1039 opengl->glprocs.glBindBuffer(FF_GL_ELEMENT_ARRAY_BUFFER, 0); in opengl_init_context()
1044 glClearColor((float)opengl->background[0] / 255.0f, (float)opengl->background[1] / 255.0f, in opengl_init_context()
1045 (float)opengl->background[2] / 255.0f, 1.0f); in opengl_init_context()
1048 OPENGL_ERROR_CHECK(opengl); in opengl_init_context()
1057 OpenGLContext *opengl = h->priv_data; in opengl_write_header() local
1065 … av_log(opengl, AV_LOG_ERROR, "Only a single raw or wrapped avframe video stream is supported.\n"); in opengl_write_header()
1069 opengl->width = st->codecpar->width; in opengl_write_header()
1070 opengl->height = st->codecpar->height; in opengl_write_header()
1071 opengl->pix_fmt = st->codecpar->format; in opengl_write_header()
1072 if (!opengl->window_width) in opengl_write_header()
1073 opengl->window_width = opengl->width; in opengl_write_header()
1074 if (!opengl->window_height) in opengl_write_header()
1075 opengl->window_height = opengl->height; in opengl_write_header()
1077 if (!opengl->window_title && !opengl->no_window) in opengl_write_header()
1078 opengl->window_title = av_strdup(h->url); in opengl_write_header()
1086 if (opengl->width > opengl->max_texture_size || opengl->height > opengl->max_texture_size) { in opengl_write_header()
1087 av_log(opengl, AV_LOG_ERROR, "Too big picture %dx%d, max supported size is %dx%d\n", in opengl_write_header()
1088 opengl->width, opengl->height, opengl->max_texture_size, opengl->max_texture_size); in opengl_write_header()
1093 if ((ret = opengl_load_procedures(opengl)) < 0) in opengl_write_header()
1096 opengl_fill_color_map(opengl); in opengl_write_header()
1097 opengl_get_texture_params(opengl); in opengl_write_header()
1099 if ((ret = opengl_init_context(opengl)) < 0) in opengl_write_header()
1108 if (!opengl->no_window) in opengl_write_header()
1109 SDL_GL_SwapWindow(opengl->window); in opengl_write_header()
1111 if (opengl->no_window && in opengl_write_header()
1113 av_log(opengl, AV_LOG_ERROR, "Application failed to display window buffer.\n"); in opengl_write_header()
1118 OPENGL_ERROR_CHECK(opengl); in opengl_write_header()
1120 opengl->inited = 1; in opengl_write_header()
1128 static uint8_t* opengl_get_plane_pointer(OpenGLContext *opengl, AVPacket *pkt, int comp_index, in opengl_get_plane_pointer() argument
1132 int wordsize = opengl_type_size(opengl->type); in opengl_get_plane_pointer()
1133 int width_chroma = AV_CEIL_RSHIFT(opengl->width, desc->log2_chroma_w); in opengl_get_plane_pointer()
1134 int height_chroma = AV_CEIL_RSHIFT(opengl->height, desc->log2_chroma_h); in opengl_get_plane_pointer()
1141 data += opengl->width * opengl->height * wordsize; in opengl_get_plane_pointer()
1144 data += opengl->width * opengl->height * wordsize; in opengl_get_plane_pointer()
1148 data += opengl->width * opengl->height * wordsize; in opengl_get_plane_pointer()
1159 int width = sub ? AV_CEIL_RSHIFT(opengl->width, desc->log2_chroma_w) : opengl->width; \
1160 int height = sub ? AV_CEIL_RSHIFT(opengl->height, desc->log2_chroma_h): opengl->height; \
1164 glBindTexture(GL_TEXTURE_2D, opengl->texture_name[comp_index]); \
1167 int bytes_per_pixel = opengl_type_size(opengl->type); \
1172 (opengl->unpack_subimage || ((length / bytes_per_pixel) == width))) { \
1177 opengl->format, opengl->type, data); \
1184 opengl->format, opengl->type, data); \
1189 data = opengl_get_plane_pointer(opengl, input, comp_index, desc); \
1191 opengl->format, opengl->type, data); \
1197 OpenGLContext *opengl = h->priv_data; in opengl_draw() local
1203 if (!opengl->no_window && (ret = opengl_sdl_process_events(h)) < 0) in opengl_draw()
1206 if (opengl->no_window && in opengl_draw()
1208 av_log(opengl, AV_LOG_ERROR, "Application failed to prepare window buffer.\n"); in opengl_draw()
1226 OPENGL_ERROR_CHECK(opengl); in opengl_draw()
1228 if ((ret = opengl_prepare(opengl)) < 0) in opengl_draw()
1231 opengl->glprocs.glBindBuffer(FF_GL_ARRAY_BUFFER, opengl->vertex_buffer); in opengl_draw()
1232 opengl->glprocs.glBindBuffer(FF_GL_ELEMENT_ARRAY_BUFFER, opengl->index_buffer); in opengl_draw()
1233opengl->glprocs.glVertexAttribPointer(opengl->position_attrib, 3, GL_FLOAT, GL_FALSE, sizeof(OpenG… in opengl_draw()
1234 opengl->glprocs.glEnableVertexAttribArray(opengl->position_attrib); in opengl_draw()
1235opengl->glprocs.glVertexAttribPointer(opengl->texture_coords_attrib, 2, GL_FLOAT, GL_FALSE, sizeof… in opengl_draw()
1236 opengl->glprocs.glEnableVertexAttribArray(opengl->texture_coords_attrib); in opengl_draw()
1241 OPENGL_ERROR_CHECK(opengl); in opengl_draw()
1244 if (!opengl->no_window) in opengl_draw()
1245 SDL_GL_SwapWindow(opengl->window); in opengl_draw()
1247 if (opengl->no_window && in opengl_draw()
1249 av_log(opengl, AV_LOG_ERROR, "Application failed to display window buffer.\n"); in opengl_draw()
1288 .class_name = "opengl outdev",
1296 .name = "opengl",
1297 .long_name = NULL_IF_CONFIG_SMALL("OpenGL output"),