Example #1
0
int _tmain(int argc, _TCHAR* argv[])
{
	ESContext esContext;

    esInitContext ( &esContext );

	esCreateWindow ( &esContext, "Hello Model", Globals::screenWidth, Globals::screenHeight, ES_WINDOW_RGB | ES_WINDOW_DEPTH);

	if ( Init ( &esContext ) != 0 )
		return 0;

	if (ppShaders.Init("../Resources/Shaders/PPShaderVS.vs", "../Resources/Shaders/PPShaderFS.fs") != 0)
		return 0;

	esRegisterDrawFunc ( &esContext, Draw );
	esRegisterUpdateFunc ( &esContext, Update );
	esRegisterKeyFunc ( &esContext, Key);

	esMainLoop ( &esContext );

	//releasing OpenGL resources
	CleanUp();

	//identifying memory leaks
	MemoryDump();
	printf("Press any key...\n");
	_getch();

	return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
	//identifying memory leaks
	_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); 

	ESContext esContext;

    esInitContext ( &esContext );

	esCreateWindow ( &esContext, "Hello Triangle", Globals::screenWidth, Globals::screenHeight, ES_WINDOW_RGB | ES_WINDOW_DEPTH);

	if ( Init ( &esContext ) != 0 )
		return 0;

	esRegisterDrawFunc ( &esContext, Draw );
	esRegisterUpdateFunc ( &esContext, Update );
	esRegisterKeyFunc ( &esContext, Key);

	esMainLoop ( &esContext );

	//releasing OpenGL resources
	CleanUp();

	printf("Press any key...\n");
	_getch();

	return 0;
}
Example #3
0
int main(int argc, char *argv[])
{
    ESContext esContext;
    UserData userData;
#ifdef HOOK
    the_hook("/tmp/egl2.fdr");
#endif

    esInitContext ( &esContext );
    esContext.userData = &userData;

    esCreateWindow ( &esContext, "Cubic fun", 320, 240, ES_WINDOW_RGB );

    if ( !Init ( &esContext ) )
       return 0;

    esRegisterDrawFunc ( &esContext, Draw );

    esMainLoop ( &esContext );
    //dump_gl_screen("/sdcard/egl2.bmp", width, height);
#ifdef HOOK
    glFinish();
    close_hook();
#endif
    return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
	ESContext esContext;

    esInitContext ( &esContext );

	esCreateWindow ( &esContext, "Shadow Effect", Globals::screenWidth, Globals::screenHeight, ES_WINDOW_RGB | ES_WINDOW_DEPTH);

	if ( Init ( &esContext ) != 0 )
		return 0;

	esRegisterDrawFunc ( &esContext, Draw );
	esRegisterUpdateFunc ( &esContext, Update );
	esRegisterKeyFunc ( &esContext, Key);

	esMainLoop ( &esContext );

	//releasing OpenGL resources
	CleanUp();

	printf("Press any key...\n");
	_getch();

	return 0;
}
Example #5
0
int main(int argc, char *argv[])
{
    ESContext esContext;
    UserData  userData;



    //==========================================================
    // Init GLES Context
    //==========================================================
    esInitContext ( &esContext );
    esContext.userData = &userData;

    esCreateWindow ( &esContext, "Model 3D Render", 640, 480, ES_WINDOW_ALPHA | ES_WINDOW_DEPTH);

    if ( !Init ( &esContext ) )
        return 0;

    esRegisterDrawFunc ( &esContext, Draw );
    esRegisterUpdateFunc ( &esContext, Update );


    esMainLoop ( &esContext );

    ShutDown ( &esContext );
    return 1;
}
CoreWindow::CoreWindow(int x, int y, int width, int height, const char* title, bool fullscreenMode)
{
	m_imp = new Impl();
//	m_display = XOpenDisplay(0);
	
	m_imp->m_w = width;
	m_imp->m_h = height;
//	bool r = make_window(m_display, title, 32, 24, width, height, &m_imp->m_win, &m_imp->m_ctx);
//	XMapWindow(m_display, m_imp->m_win);
//	glXMakeCurrent(m_display, m_imp->m_win, m_imp->m_ctx);
    
    esInitContext ( &esContext );
    esCreateWindow ( &esContext, title, width, height, ES_WINDOW_RGB );
	g_win = this;
	glViewport(0,0,width,height);
}
int main ( int argc, char *argv[] )
{
   ESContext esContext;
   UserData  userData;

   esInitContext ( &esContext );
   esContext.userData = &userData;

   esCreateWindow ( &esContext, "Hello Triangle", 320, 240, ES_WINDOW_RGB );
   
   if ( !Init ( &esContext ) )
      return 0;

   esRegisterDrawFunc ( &esContext, Draw );
   
   esMainLoop ( &esContext );
}
Example #8
0
int main(int argc, char *argv[])
{
	ESContext esContext;
	UserData  userData;

	esInitContext(&esContext);
	esContext.userData = &userData;


	esCreateWindow(&esContext, TEXT("Hello Triangle"), 800, 600, ES_WINDOW_RGB);

	setupGraphics(800, 600);

	esRegisterDrawFunc(&esContext, Draw);

	esMainLoop(&esContext);
}
Example #9
0
int main(){
   
   ESContext esContext;
   UserData  userData;
   
   esInitContext(&esContext);
   esContext.userData = &userData;

   esCreateWindow(&esContext,"Traingle",640,480,ES_WINDOW_RGB);

   if(!Init(&esContext))
      return 0;
 
   esRegisterDrawFunc(&esContext,Draw);
	
   esMainLoop(&esContext);

}
Example #10
0
int main ( int argc, char *argv[] )
{
   ESContext esContext;
   UserData  userData;

   esInitContext ( &esContext );
   esContext.userData = &userData;

   esCreateWindow ( &esContext, TEXT("Simple Texture 2D"), 320, 240, ES_WINDOW_RGB );
   
   if ( !Init ( &esContext ) )
      return 0;

   esRegisterDrawFunc ( &esContext, Draw );
   
   esMainLoop ( &esContext );

   ShutDown ( &esContext );
}
int main ( int argc, char *argv[] )
{
   ESContext esContext;
   UserData  userData;

   esInitContext ( &esContext );
   esContext.userData = &userData;

   esCreateWindow ( &esContext, "MipMap 2D", 640, 480, ES_WINDOW_RGB );

   if ( !Init ( &esContext ) )
      return 0;

   esRegisterDrawFunc ( &esContext, Draw );

   esMainLoop ( &esContext );

   ShutDown ( &esContext );
}
Example #12
0
int main ( int argc, char *argv[] )
{
   ESContext esContext;
   UserData  userData;

   esInitContext ( &esContext );
   esContext.userData = &userData;

   esCreateWindow ( &esContext, "Stencil Test", 320, 240,
                    ES_WINDOW_RGB | ES_WINDOW_DEPTH | ES_WINDOW_STENCIL );
   
   if ( !Init ( &esContext ) )
      return 0;

   esRegisterDrawFunc ( &esContext, Draw );
   
   esMainLoop ( &esContext );

   ShutDown ( &esContext );
}
Example #13
0
int main ( int argc, char *argv[] )
{
   ESContext esContext;
   UserData  userData;
   const char* s;

   esInitContext ( &esContext );
   esContext.userData = &userData;

   esCreateWindow ( &esContext, TEXT("Hello Triangle"), 320, 240, ES_WINDOW_RGB );
   
   s = glGetString(GL_RENDERER);

   if ( !Init ( &esContext ) )
      return 0;

   esRegisterDrawFunc ( &esContext, Draw );
   
   esMainLoop ( &esContext );
}
Example #14
0
int main ( int argc, char *argv[] )
{
   ESContext esContext;
   UserData  userData;

   esInitContext ( &esContext );
   esContext.userData = &userData;

   esCreateWindow ( &esContext, TEXT("Texture Wrap"), 640, 480, ES_WINDOW_RGB );
   
   if ( !Init ( &esContext ) )
      return 0;

   esRegisterDrawFunc ( &esContext, Draw );
   esRegisterKeyFunc ( &esContext, OnKey );
   
   esMainLoop ( &esContext );

   ShutDown ( &esContext );
}
Example #15
0
int main ( int argc, char *argv[] )
{
   ESContext esContext;
   UserData  userData;

   esInitContext ( &esContext );
   esContext.userData = &userData;

   esCreateWindow ( &esContext, TEXT("MipMap 2D"), 320, 240, ES_WINDOW_RGB | ES_WINDOW_FULLSCREEN );
   
   if ( !Init ( &esContext ) )
      return 0;

   esRegisterDrawFunc ( &esContext, Draw );
   esRegisterKeyFunc ( &esContext, OnKey );
   
   esMainLoop ( &esContext );

   ShutDown ( &esContext );
}
int main ( int argc, char *argv[] )
{
   ESContext esContext;
   UserData  userData;

   esInitContext ( &esContext );
   esContext.userData = &userData;

   esCreateWindow ( &esContext, "Multi-sampling", 320, 240, ES_WINDOW_RGB );
   
   if ( !Init ( &esContext ) )
      return 0;

   esRegisterDrawFunc ( &esContext, Draw );
   esRegisterKeyFunc( &esContext, Key );

   esMainLoop ( &esContext );

   ShutDown ( &esContext );
}
Example #17
0
int main ( int argc, char *argv[] )
{
   ESContext esContext;
   UserData  userData;

   esInitContext ( &esContext );
   esContext.userData = &userData;

   esCreateWindow ( &esContext, TEXT("ParticleSystem"), 640, 480, ES_WINDOW_RGB );
   
   if ( !Init ( &esContext ) )
      return 0;

   esRegisterDrawFunc ( &esContext, Draw );
   esRegisterUpdateFunc ( &esContext, Update );
   
   esMainLoop ( &esContext );

   ShutDown ( &esContext );
}
Example #18
0
void* gles_show_yuv2_main (void *p )
{
   ESContext esContext;
   UserData  userData;

   esInitContext ( &esContext );
   esContext.userData = &userData;

   esCreateWindow ( &esContext, "yuv2", 640, 480, ES_WINDOW_RGB );
   
   if ( !Init ( &esContext ) )
      return 0;

   esRegisterDrawFunc ( &esContext, Draw );
   
   esMainLoop ( &esContext );

   ShutDown ( &esContext );

   return 0;
}
Example #19
0
int main ( int argc, char *argv[] )
{
   ESContext esContext;

   esInitContext ( &esContext );

   esCreateWindow ( &esContext, "Hello Triangle", 800, 600, ES_WINDOW_RGB );
   
   if ( !Init ( &esContext ) )
      return 0;

   esRegisterKeyFunc(&esContext,KeyPressed);
   esRegisterDrawFunc ( &esContext, Draw );
   
   esMainLoop ( &esContext );

   DELETE_SAFELY(woman1);
   DELETE_SAFELY(woman2);
   DELETE_SAFELY(sky);
   DELETE_SAFELY(cam);
   DELETE_SAFELY(camSky);
}
Example #20
0
int main ( int argc, char *argv[] )
{
   GLboolean retval;
   ESContext esContext;
   //UserData  userData;
   void *userData;

   esInitContext ( &esContext );
   staticContext = &esContext;
   userData = fwl_init_instance(); //before setting any structs we need a struct allocated
   esContext.userData = userData;//&userData;

   //Blackberry PlayBook 1024x600 (7") 170 PPI
   //equivalent 7" on Acer x203w desktop monitor: 600x352
   retval = esCreateWindow ( &esContext, "winGLES2", 600, 352, ES_WINDOW_RGB | ES_WINDOW_DEPTH | ES_WINDOW_STENCIL );
   //retval = esCreateWindow ( &esContext, "winGLES2", 1024, 600, ES_WINDOW_RGB | ES_WINDOW_DEPTH | ES_WINDOW_STENCIL );
   fwl_setOrientation (0); //int: 0, 90, 180, 270
   setDisplayed(1); //0=not 1=displayed
   if( retval == GL_FALSE ) printf("ouch - esCreateWindow returns false\n");
   printf("%s\n",glGetString(GL_VERSION));
   printf("%s\n",glGetString(GL_SHADING_LANGUAGE_VERSION));
   
   if ( !fwInit ( &esContext ) )
      return 0;
   	//statusbarOnResize(600,352);
	fwl_setScreenDim(600,352);

   //esRegisterUpdateFunc ( &esContext, fwUpdate );
   esRegisterDrawFunc ( &esContext, fwDraw );
   esRegisterKeyFunc ( &esContext, fwOnKey );
   esRegisterMouseFunc ( &esContext, fwOnMouse );
   esRegisterResizeFunc( &esContext, fwOnResize );
   
   esMainLoop ( &esContext );
   finalizeRenderSceneUpdateScene();

}
Example #21
0
Drawable::Drawable() {
	esInitContext(&esContext);
	esContext.userData = &userData;
}
Example #22
0
    // internal initialization. performed when run is invoked
    void Raspi_App::init()
    {
        gettimeofday(&m_startTime, NULL);

        esInitContext(m_context.get());
        esCreateWindow(m_context.get(), name().c_str(),
                       ES_WINDOW_RGB | ES_WINDOW_ALPHA | ES_WINDOW_DEPTH /*| ES_WINDOW_MULTISAMPLE*/);

        // set graphical log stream
        Logger::get()->add_outstream(&m_outstream_gl);

        // version
        LOG_INFO<<"OpenGL: " << glGetString(GL_VERSION);
        LOG_INFO<<"GLSL: " << glGetString(GL_SHADING_LANGUAGE_VERSION);

        set_window_size(gl::vec2(m_context->width, m_context->height));
        LOG_INFO<<"Context: " << gl::window_dimension().x << " x " << gl::window_dimension().y;

        // file search paths
        if(!args().empty()){ fs::add_search_path(fs::get_directory_part(args().front())); }
        // fs::add_search_path("./");
        fs::add_search_path("./res");
        fs::add_search_path("/usr/local/share/fonts");

        get_input_file_descriptors(&m_mouse_fd, &m_keyboard_fd, &m_touch_fd);

        m_timer_device_scan = Timer(background_queue().io_service(), [this]()
        {
            int mouse_fd = m_mouse_fd, keyboard_fd = m_keyboard_fd;
            int *mp = nullptr, *kp = nullptr;
            bool has_changed = false;

            // check for keyboard and mouse being added/removed
            auto mouse_handler = find_mouse_handler();
            auto kb_handler = find_keyboard_handler();

            if((!m_keyboard_fd && !kb_handler.empty()) ||
               (m_keyboard_fd && kb_handler.empty()))
            {
                keyboard_fd = 0;
                kp = &keyboard_fd;
                has_changed = true;
            }
            if((!m_mouse_fd && !mouse_handler.empty()) ||
               (m_mouse_fd && mouse_handler.empty()))
            {
                mouse_fd = 0;
                mp = &mouse_fd;
                has_changed = true;
            }
            if(!has_changed){ return; }

            get_input_file_descriptors(mp, kp, nullptr);
            main_queue().submit([this, mouse_fd, keyboard_fd]
            {
                if(mouse_fd && !m_mouse_fd)
                {
                    LOG_TRACE << "mouse connected";
                    m_mouse_fd = mouse_fd;
                }
                else if(!mouse_fd && m_mouse_fd)
                {
                     LOG_TRACE << "mouse disconnected";
                     close(m_mouse_fd); m_mouse_fd = 0;
                }
                if(keyboard_fd && !m_keyboard_fd)
                {
                    LOG_TRACE << "keyboard connected";
                    m_keyboard_fd = keyboard_fd;
                }
                else if(!keyboard_fd && m_keyboard_fd)
                {
                    LOG_TRACE << "keyboard disconnected";
                    close(m_keyboard_fd); m_keyboard_fd = 0;
                }
            });
        });
        m_timer_device_scan.set_periodic();
        m_timer_device_scan.expires_from_now(5.0);

        // make sure touchscreen backlight stays on
        // TODO: use timer here
        // set_lcd_backlight(true);

        // center cursor
        current_mouse_pos = gl::window_dimension() / 2.f;

        // user setup hook
        setup();
    }