From: Timo Lotterbach Date: Mon, 21 May 2012 10:48:00 +0000 (+0200) Subject: EGLWLMockNavigation: added new features X-Git-Tag: ivi-layer-management_version_0_9_7_rc~32 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b537560de030b8b35e8e054a76864823afa8b0d6;p=profile%2Fivi%2Flayer-management.git EGLWLMockNavigation: added new features added new arguments: -nosky do not render sky, background transparent -posx x set surface x position on layer to x -posy x set surface y position on layer to x -opacity x set opacity of surface to x --- diff --git a/LayerManagerExamples/EGLWLMockNavigation/include/OpenGLES2App.h b/LayerManagerExamples/EGLWLMockNavigation/include/OpenGLES2App.h index ef71c7a..7b73518 100644 --- a/LayerManagerExamples/EGLWLMockNavigation/include/OpenGLES2App.h +++ b/LayerManagerExamples/EGLWLMockNavigation/include/OpenGLES2App.h @@ -33,6 +33,10 @@ struct SurfaceConfiguration unsigned int surfaceId; unsigned int surfaceWidth; unsigned int surfaceHeight; + unsigned int surfacePosX; + unsigned int surfacePosY; + float opacity; + bool nosky; }; class OpenGLES2App diff --git a/LayerManagerExamples/EGLWLMockNavigation/src/OpenGLES2App.cpp b/LayerManagerExamples/EGLWLMockNavigation/src/OpenGLES2App.cpp index 8a917b0..5a46ad7 100644 --- a/LayerManagerExamples/EGLWLMockNavigation/src/OpenGLES2App.cpp +++ b/LayerManagerExamples/EGLWLMockNavigation/src/OpenGLES2App.cpp @@ -105,8 +105,14 @@ OpenGLES2App::OpenGLES2App(float fps, float animationSpeed, SurfaceConfiguration createEGLContext(); setupLayerMangement(config); - //glClearColor(0.2f, 0.2f, 0.5f, 1.0f); - glClearColor(0.2f, 0.2f, 0.5f, 1.0f); + if (config->nosky) + { + glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + } + else + { + glClearColor(0.2f, 0.2f, 0.5f, 1.0f); + } glDisable(GL_BLEND); glClearDepthf(1.0f); @@ -278,7 +284,18 @@ bool OpenGLES2App::setupLayerMangement(SurfaceConfiguration* config) t_ilm_surface surfaceid = (t_ilm_surface)config->surfaceId;//SURFACE_EXAMPLE_EGLX11_APPLICATION; int width = config->surfaceWidth; int height = config->surfaceHeight; + int posX = config->surfacePosX; + int posY = config->surfacePosY; + float opacity = config->opacity; + if (config->nosky) + { + glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + } + else + { + glClearColor(0.2f, 0.2f, 0.5f, 1.0f); + } // TODO: auto generate surface id cout << "creating surface " << surfaceid << "\n"; struct wl_object* p_obj = (struct wl_object*)m_wlContextStruct.wlSurface; @@ -288,8 +305,8 @@ bool OpenGLES2App::setupLayerMangement(SurfaceConfiguration* config) error = ilm_surfaceCreate( (t_ilm_nativehandle) native_ilm_handle, width, height, ILM_PIXELFORMAT_RGBA_8888, &surfaceid); - cout << "set surface " << surfaceid << " dest region " << 0 << ", " << 0 << ", " << width << ", " << height << "\n"; - error = ilm_surfaceSetDestinationRectangle(surfaceid, 0, 0, width, height); + cout << "set surface " << surfaceid << " dest region " << posX << ", " << posY << ", " << width << ", " << height << "\n"; + ilm_surfaceSetDestinationRectangle(surfaceid, posX, posY, width, height); cout << "set surface " << surfaceid << " src region " << 0 << ", " << 0 << ", " << width << ", " << height << "\n"; error = ilm_surfaceSetSourceRectangle(surfaceid, 0, 0, width, height); @@ -297,8 +314,8 @@ bool OpenGLES2App::setupLayerMangement(SurfaceConfiguration* config) cout << "Set surface " << surfaceid << " visible\n"; error = ilm_surfaceSetVisibility(surfaceid, ILM_TRUE); - cout << "Set surface " << surfaceid << " opacity 0.7\n"; - error = ilm_surfaceSetOpacity(surfaceid, 0.5f); + cout << "Set surface " << surfaceid << " opacity " << opacity << "\n"; + ilm_surfaceSetOpacity(surfaceid, opacity); cout << "add surface " << surfaceid << " to layer " << layerid << "\n"; error = ilm_layerAddSurface(layerid, surfaceid); diff --git a/LayerManagerExamples/EGLWLMockNavigation/src/main.cpp b/LayerManagerExamples/EGLWLMockNavigation/src/main.cpp index 8ecf192..6860330 100644 --- a/LayerManagerExamples/EGLWLMockNavigation/src/main.cpp +++ b/LayerManagerExamples/EGLWLMockNavigation/src/main.cpp @@ -30,6 +30,11 @@ using std::cout; #define DEFAULT_SURFACE SURFACE_EXAMPLE_EGLX11_APPLICATION #define DEFAULT_WIDTH 800 #define DEFAULT_HEIGHT 480 +#define DEFAULT_POS_X 0 +#define DEFAULT_POS_Y 0 +#define DEFAULT_OPACITY 1.0 +#define DEFAULT_NOSKY false +#define DEFAULT_HELP false int main (int argc, const char * argv[]) { @@ -39,19 +44,27 @@ int main (int argc, const char * argv[]) UnsignedIntArgument layerId("layer", DEFAULT_LAYER, argc, argv); IntArgument width("width", DEFAULT_WIDTH, argc, argv); IntArgument height("height", DEFAULT_HEIGHT, argc, argv); - BoolArgument help("help", false, argc, argv); + IntArgument posx("posx", DEFAULT_POS_X, argc, argv); + IntArgument posy("posy", DEFAULT_POS_Y, argc, argv); + FloatArgument opacity("opacity", DEFAULT_FPS, argc, argv); + BoolArgument nosky("nosky", DEFAULT_NOSKY, argc, argv); + BoolArgument help("help", DEFAULT_HELP, argc, argv); if (help.get()) { cout << "\nUsage: " << argv[0] << " [options]\n" << "possible options are:\n" - << " -help show this help text\n" + << " -help show this help text (default " << DEFAULT_HELP << ")\n" << " -fps x limit frames per second to x (default " << DEFAULT_FPS << ")\n" << " -anim x set animation speed (default " << DEFAULT_ANIM << ")\n" + << " -nosky do not render sky, background transparent (default " << DEFAULT_NOSKY << ")\n" << " -surface x render to surface id x (default " << DEFAULT_SURFACE << ")\n" << " -layer x add surface to layer x (default " << DEFAULT_LAYER << ")\n" << " -width x set surface width to x (default " << DEFAULT_WIDTH << ")\n" - << " -height x set surface height to x (default " << DEFAULT_HEIGHT << ")\n\n"; + << " -height x set surface height to x (default " << DEFAULT_HEIGHT << ")\n" + << " -posx x set surface x position on layer to x (default " << DEFAULT_POS_X << ")\n" + << " -posy x set surface y position on layer to x (default " << DEFAULT_POS_Y << ")\n" + << " -opacity x set opacity of surface to x (default " << DEFAULT_OPACITY << ")\n\n"; } else { @@ -60,6 +73,10 @@ int main (int argc, const char * argv[]) config.surfaceId = surfaceId.get(); config.surfaceWidth = width.get(); config.surfaceHeight = height.get(); + config.surfacePosX = posx.get(); + config.surfacePosY = posy.get(); + config.opacity = opacity.get(); + config.nosky = nosky.get(); MockNavi navi(fps.get(), animSpeed.get(), &config); navi.mainloop();