Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - How to combine Qml window and native openglES window better?: (4 Items)
   
How to combine Qml window and native openglES window better?  
I use native openGLes API draws a 3D animation, I want to know how to make it and QML window stack up.
Thanks
Re: How to combine Qml window and native openglES window better?  
You can make opengl appear "on top" of qml by setting z-order.   Numeric number for z-order must be higher than your qml
 window (which is normally a low integer). 

The following calls set size, position and z-order for your opengl window:

int wf_pos[2] = { WF_UL_X, WF_UL_Y	};
int wf_size[2] = { WF_WIDTH, WF_HEIGHT };  // fixed
int zorder = 100;  // some default

        ...
	if (wf_size[0] > 0 && wf_size[1] > 0)
	{
		rc = screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_SIZE, wf_size);
		if (rc)
		{
			perror("screen_set_window_property_iv(SCREEN_PROPERTY_SIZE)");
			goto fail5;
		}
	}
	else
	{
		rc = screen_get_window_property_iv(screen_win, SCREEN_PROPERTY_SIZE, wf_size);
		if (rc)
		{
			perror("screen_get_window_property_iv(SCREEN_PROPERTY_SIZE)");
			goto fail5;
		}
	}

	if (wf_pos[0] != 0 || wf_pos[1] != 0)
	{
		rc = screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_POSITION, wf_pos);
		if (rc)
		{
			perror("screen_set_window_property_iv(SCREEN_PROPERTY_POSITION)");
			goto fail5;
		}
	}

	rc = screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_ZORDER, &zorder);
	if (rc)
	{
		perror("screen_set_window_property_iv(SCREEN_PROPERTY_ZORDER)");
		goto fail5;
	}

Re: How to combine Qml window and native openglES window better?  
Hi Dennis:
First thank you for your reply, should I Create a thread of native opengl window alone? Or like a normal QT Class 
registered to the QML? Excuse me, what kind of way of thinking is correct?
Thanks.
Re: How to combine Qml window and native openglES window better?  
Guess it depends on what you are doing in the openGL window, but I assume it would be an independent thread controllable
 by the UI.