unsigned int surfaceId;
unsigned int surfaceWidth;
unsigned int surfaceHeight;
+ unsigned int surfacePosX;
+ unsigned int surfacePosY;
+ float opacity;
+ bool nosky;
};
class OpenGLES2App
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);
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;
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);
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);
#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[])
{
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
{
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();