Example #1
0
static gboolean
gst_eglglessink_open (GstEglGlesSink * eglglessink)
{
  if (!egl_init (eglglessink)) {
    return FALSE;
  }

  return TRUE;
}
Example #2
0
void glloader_init()
{
	glloader::gl_features_extractor::delete_instance();

#ifdef GLLOADER_GL
	gl_init();
#endif

#ifdef GLLOADER_WGL
	wgl_init();
#endif

#ifdef GLLOADER_GLX
	glx_init();
#endif

#ifdef GLLOADER_GLES
	gles_init();
#endif

#ifdef GLLOADER_EGL
	egl_init();
#endif
}
Example #3
0
void* render_thread(void* p)
{
    /* egl init */    
    int width = 512, height = 512;
    struct wl_egl_window* p_wl_egl_window
        = (struct wl_egl_window*)wl_egl_window_create(window->p_wl_surface, width, height);
    if (!p_wl_egl_window) {
        printf("wl_egl_window_create error\n");
    }
    egl = egl_init((EGLNativeDisplayType)window->p_wl_display,
                   (EGLNativeWindowType)p_wl_egl_window);

    /* init */
    init_gl();
    print_gles_env();

    while(1) {
        draw();
        eglSwapBuffers(egl->display, egl->surface);
        FPS();
    }

    return NULL;
}
Example #4
0
void* render_thread(void* p)
{
    /* egl init */    
    int width = 640, height = 480;
#if defined SHOW_YUYV
    width = 640;
    height = 480;
#endif
#if defined SHOW_NV12
    width = 720;
    height = 480;
#endif
    struct wl_egl_window* p_wl_egl_window
        = (struct wl_egl_window*)wl_egl_window_create(window->p_wl_surface, width, height);
    if (!p_wl_egl_window) {
        printf("wl_egl_window_create error\n");
    }
    egl = egl_init((EGLNativeDisplayType)window->p_wl_display,
                   (EGLNativeWindowType)p_wl_egl_window);

    /* init */
    print_gles_env();

    glEnable (GL_BLEND);
    //glBlendFunc(GL_SRC_ALPHA, GL_ONE);
    //glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    int index = -1;
    int step = 4;
    int step_width = width/step;
    int step_height = height/step;

#define next_viewport()                         \
    /* Set the viewport */                      \
        glViewport(index%step*step_width,       \
                   ++index/step*step_height,    \
                   step_width, step_height);    \

    while(1) {
        index = 0;
        // Clear the color buffer
        //glClearColor(.0, .0, .0, .5);
        glClearColor(.0, .0, .0, 1.0);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        //glDepthFunc(GL_LEQUAL);
        glEnable(GL_DEPTH_TEST);

        next_viewport();
        draw_tetrahedron();

        next_viewport();
        draw_antialiasfiltering();

        next_viewport();
        show_default(width, height);

        next_viewport();
#if defined SHOW_YUYV
        show_yuyv(width, height);
#endif
#if defined SHOW_NV12
        show_nv12(width, height);
#endif

        next_viewport();
        show_rgba(width, height);

        next_viewport();
        extern int obj_test_draw();
        obj_test_draw();

        next_viewport();
        mvptest();

        next_viewport();
        draw_vertexs_update();

        next_viewport();
        //draw_simple();

        eglSwapBuffers(egl->display, egl->surface);
        FPS();
    }

    return NULL;
}
Example #5
0
void _start()
#endif
{
  dnload();
  dnload_SDL_Init(SDL_INIT_VIDEO);
#if defined(DNLOAD_GLESV2) && !defined(DNLOAD_VIDEOCORE)
  dnload_SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
  dnload_SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
  dnload_SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
#endif
  g_sdl_window = dnload_SDL_CreateWindow(NULL, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_W,
      SCREEN_H, SDL_WINDOW_OPENGL | (FLAG_FULLSCREEN ? SDL_WINDOW_FULLSCREEN : 0));
#if defined(DNLOAD_GLESV2) && defined(DNLOAD_VIDEOCORE)
  videocore_create_native_window(SCREEN_W, SCREEN_H);
  egl_init(reinterpret_cast<NativeWindowType>(&g_egl_native_window), &g_egl_display, &g_egl_surface);
#else
  dnload_SDL_GL_CreateContext(g_sdl_window);
#endif
  dnload_SDL_ShowCursor(0);

#if defined(USE_LD)
  glewInit();
#endif

#if defined(DNLOAD_GLESV2)
  g_program_fragment = create_program(g_shader_vertex_quad, g_shader_fragment_quad);
  dnload_glUseProgram(g_program_fragment);
  g_uniform_t = dnload_glGetUniformLocation(g_program_fragment, "t");
#else
  // Shader generation inline.
  GLuint pipeline;
  GLuint program_vert = dnload_glCreateShaderProgramv(GL_VERTEX_SHADER, 1, &g_shader_vertex_quad);
  g_program_fragment = dnload_glCreateShaderProgramv(GL_FRAGMENT_SHADER, 1, &g_shader_fragment_quad);

  dnload_glGenProgramPipelines(1, &pipeline);
  dnload_glBindProgramPipeline(pipeline);
  dnload_glUseProgramStages(pipeline, 1, program_vert);
  dnload_glUseProgramStages(pipeline, 2, g_program_fragment);
#endif

  unsigned start_ticks = dnload_SDL_GetTicks();

  for(;;)
  {
    SDL_Event event;
    unsigned curr_ticks = dnload_SDL_GetTicks() - start_ticks;

    dnload_SDL_PollEvent(&event);

    if((curr_ticks >= INTRO_LENGTH) || (event.type == SDL_KEYDOWN))
    {
      break;
    }

    draw(curr_ticks);
    swap_buffers();
  }

  teardown();
#if defined(USE_LD)
  return 0;
#else
  asm_exit();
#endif
}
Example #6
0
int main(int argc, char **argv)
{
    const char *s;

    EGLmanager *eglman = calloc(1, sizeof(*eglman));

    // Open X Display
    Display *x_dpy = XOpenDisplay(NULL);
    if (!x_dpy)
    {
        printf("error: can't open default display\n");
        goto exit0;
    }
    eglman->xdpy = (EGLNativeDisplayType)x_dpy;

    // Get EGL Display
    eglman->dpy = eglGetDisplay(eglman->xdpy);
    if (!eglman->dpy || eglGetError() != EGL_SUCCESS)
    {
        printf("error: can't get EGL display\n");
        goto exit1;
    }

    // Initialize EGL
    eglInitialize(eglman->dpy, &eglman->major_ver, &eglman->minor_ver);
    if (eglGetError() != EGL_SUCCESS)
    {
        goto exit1;
    }

    // Query and print out information
    s = eglQueryString(eglman->dpy, EGL_VERSION);
    printf("EGL_VERSION = %s\n", s);

    s = eglQueryString(eglman->dpy, EGL_VENDOR);
    printf("EGL_VENDOR = %s\n", s);

    s = eglQueryString(eglman->dpy, EGL_EXTENSIONS);
    printf("EGL_EXTENSIONS = %s\n", s);

    s = eglQueryString(eglman->dpy, EGL_CLIENT_APIS);
    printf("EGL_CLIENT_APIS = %s\n", s);

    // Create an RGB, double-buffered X window
    if (create_x_window(eglman, "vgimage to texture") != EGL_TRUE)
    {
        goto exit2;
    }

    XMapWindow(eglman->xdpy, eglman->xwin);

    // Initialize EGL
    if (egl_init(eglman) != EGL_TRUE)
    {
        goto exit3;
    }

    // Initialize rendering API: OpenGL ES and OpenVG
    if (vg_es_init(eglman) != EGL_TRUE)
    {
        goto exit3;
    }

    // Rendering
    draw(eglman);

    // Deinitialize rendering API
    vg_es_deinit(eglman);

    // Deinitialize EGL
    egl_deinit(eglman);

exit3:
    XDestroyWindow(eglman->xdpy, eglman->xwin);
exit2:
    eglTerminate(eglman->dpy);
exit1:
    XCloseDisplay(eglman->xdpy);
exit0:
    free(eglman);

    return 0;
}