void __attribute__((noreturn)) gl_main_loop(global_context *ctx){ int i,j,k; while(!gl_window_should_close(ctx->window)){ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if(ctx->update_userdata){ ctx->update_userdata(ctx->userdata); } for(i=0;i<ctx->num_scenes;i++){ gl_scene *scene = &(ctx->scenes[i]); //or gl_scene scene = ctx->scenes[i]; bind_scene(scene); if(scene->update_scene){ scene->update_scene(scene, ctx->userdata); } //bind uniform blocks for(j=0;j<scene->num_buffers;j++){ gl_buffer *buf = scene->buffers + j*sizeof(gl_buffer); bind_buffer(buf); if(buf->update_buffer){ buf->update_buffer(buf, ctx->userdata); } /* TODO: update the buffer struct to contain index limits and optimze this by calling glDrawRangeElements instead. */ glDrawElements(buf->draw_mode, buf->draw_count, buf->index_type, (void*)buf->index_offset); } } gl_swap_buffers(ctx->window); gl_poll_events(); } exit(0);//need a way to specify an exit value }
/** * gst_vaapi_window_glx_swap_buffers: * @window: a #GstVaapiWindowGLX * * Promotes the contents of the back buffer of @window to become the * contents of the front buffer of @window. This simply is wrapper * around glXSwapBuffers(). */ void gst_vaapi_window_glx_swap_buffers (GstVaapiWindowGLX * window) { GstVaapiWindowGLXPrivate *priv; g_return_if_fail (GST_VAAPI_IS_WINDOW_GLX (window)); GST_VAAPI_WINDOW_LOCK_DISPLAY (window); priv = GST_VAAPI_WINDOW_GLX_GET_PRIVATE (window); gl_swap_buffers (priv->gl_context); GST_VAAPI_WINDOW_UNLOCK_DISPLAY (window); }