Advanced OTK Functions


The functions on this page are intended for advanced programmers.



OtkWidget Otk_MakeUserDefinedObject( OtkWidget container, float x, float y )

	This function returns a handle to a blank widget shell.  It enables
	you, the programmer, to define your own graphical object by creating an
	OpenGL call-list.  Set the widget's ->ID field to your call-list's
	number.  See Open GL for more information about Open GL calls and techniques.


float Otk_Set_Render_Quality_Hint( float Qual_hint )

	On capable modern PC's, Otk will deliver high quality graphics with rapid response.
	However, on older or less capable display hardware, Otk will adaptively balance 
	the display quality to preserve reasonable display speed.  

	The Otk_Set_Render_Quality_Hint function enables your application to request better
	visual quality, or conversely, better speed, on challenged platforms.

	The Qual_hint parameter defaults to 1.0.  Values greater than 1.0 (example 2.0)
	will tend to yield better display quality, but may be slower on some PC's. 
	Values less than 1.0 (example 0.5) will improve screen update rates on slow PC's,
	but may reduce display quality slightly.  This function returns the previous
	quality setting.


void Otk_Get_Screen_Size( int *scrn_width, int *scrn_height ); 

	Passes back the screen size in pixels.  Useful for setting an application's
	optimal window size for a given user's screen.  This can avoid the situation
	where a developer optimizes a GUI for her screen, but a user has a smaller or
	larger screen so the GUI does not fit well.  For example, call this prior to
	calling OtkInitWindow( winwidth, winht, ...), to set your window's height
	to be perhaps 90% of the screen height, but no larger than say 1,000 pixels.


void otk_set_not_native_window();

	Allows OTK to be included within OpenGL applications that have already
	created the application window.  Call this before calling OtkInitWindow( ...),
	to prevent OTK from creating new window.


void otk_sleep( float Tseconds );

	Causes your OTK application to sleep for the specified time in seconds.
	Allows operating system to process other tasks.


double otk_report_time();

	Returns the time in seconds.  The base value may depend on the system, such as
	when the system was last booted.  Therefore, within an OTK application, it is
	best to work with differences in otk_report_time().  For example, record when
	your program starts, and subtract that value from new calls to otk_report_time().
	Example:
		{
		 double T1, dt;

		 T1 = otk_report_time();
		 otk_sleep( 2.3 );
		 dt = otk_report_time() - T1;
		 printf("Time delay = %g\n", dt );
		}


void otk_set_multisamp( int quality );

	Hardware accelerated multi-sampling provides sharper graphics and faster response -- if your GPU supports it.
	Defaults to Off (quality=0).  To set On, call this function before calling OtkInitWindow(...).
	Multi-sampling is a type of anti-aliasing.  Apparently hardware supported multi-sampling is
	not as uniformly supported, and may cause problems on some systems.  It may be driver libraries
	or graphic board issues.  Use with caution.  Quality of 4 is reasonable, but should be a power
	of 2, such as 2, 4, or 8.

	This function is presently not supported for Microsoft Windows and cannot enabled on that platform.	


Back to main page

SourceForge.net Logo