From: Tim R. <ti...@us...> - 2004-09-11 18:52:56
|
Update of /cvsroot/csdopenglnet/csdOpenGL/samples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6134/samples Modified Files: gears.cs samples.build Log Message: adaptation for windows Index: gears.cs =================================================================== RCS file: /cvsroot/csdopenglnet/csdOpenGL/samples/gears.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** gears.cs 6 Aug 2004 11:42:34 -0000 1.7 --- gears.cs 11 Sep 2004 18:52:46 -0000 1.8 *************** *** 1,4 **** --- 1,5 ---- using csDragons.OpenGL; using System; + using System.Diagnostics; public class Gears : GL { *************** *** 13,43 **** public Gears() { glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); glutInitWindowSize( 480, 480 ); glutCreateWindow("Gears"); initGL(); glutDisplayFunc( new cb0_glutDisplayFunc( draw ) ); glutKeyboardFunc( new cb0_glutKeyboardFunc( keyboard ) ); glutReshapeFunc( new cb0_glutReshapeFunc( reshape ) ); glutVisibilityFunc( new cb0_glutVisibilityFunc( visible ) ); glutMainLoop(); } protected void visible( int state ) { if ( state==GLUT_VISIBLE ) { glutIdleFunc( new cb0_glutIdleFunc( redraw ) ); } else { ! glutIdleFunc( null ); } } protected void redraw() { rotAng += 0.5f; glutPostRedisplay(); } protected void initGL() { float[] pos = { 5.0f, 5.0f, 10.0f, 0.0f }; float[] red = { 0.8f, 0.1f, 0.0f, 1.0f }; --- 14,76 ---- public Gears() { + Debug.Indent(); + Debug.WriteLine( "Entering Gears() "); + + Debug.WriteLine( "Initializiing GLUT" ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); glutInitWindowSize( 480, 480 ); glutCreateWindow("Gears"); + Debug.WriteLine( "Initialzing GL" ); initGL(); + Debug.WriteLine( "Initializing GLUT-CallBacks" ); + glutDisplayFunc( new cb0_glutDisplayFunc( draw ) ); glutKeyboardFunc( new cb0_glutKeyboardFunc( keyboard ) ); glutReshapeFunc( new cb0_glutReshapeFunc( reshape ) ); + glutIdleFunc( new cb0_glutIdleFunc( redraw ) ); glutVisibilityFunc( new cb0_glutVisibilityFunc( visible ) ); + + Debug.WriteLine( "Starting Main Loop" ); glutMainLoop(); + + Debug.WriteLine( "Exiting Gears() "); + Debug.Unindent(); } protected void visible( int state ) { + Debug.Indent(); + Debug.WriteLine( "Entering Gears.visible(int)" ); + if ( state==GLUT_VISIBLE ) { glutIdleFunc( new cb0_glutIdleFunc( redraw ) ); } else { ! glutIdleFunc( new cb0_glutIdleFunc( dummy ) ); } + + Debug.WriteLine( "Exiting Gears.visible(int)" ); + Debug.Unindent(); + } + + protected void dummy() { } protected void redraw() { + Debug.Indent(); + Debug.WriteLine( "Entering Gears.redraw() "); + rotAng += 0.5f; glutPostRedisplay(); + + Debug.WriteLine( "Exiting Gears.redraw() "); + Debug.Unindent(); } protected void initGL() { + Debug.Indent(); + Debug.WriteLine( "Entering Gears.initGL() "); + + Debug.WriteLine( "Set defaults "); float[] pos = { 5.0f, 5.0f, 10.0f, 0.0f }; float[] red = { 0.8f, 0.1f, 0.0f, 1.0f }; *************** *** 57,60 **** --- 90,94 ---- /* gears */ + Debug.WriteLine( "Define Gears "); gear1 = glGenLists( 1 ); glNewList( gear1, GL_COMPILE ); *************** *** 76,82 **** --- 110,123 ---- glEnable( GL_NORMALIZE ); + + Debug.WriteLine( "Exiting Gears.initGL() "); + Debug.Unindent(); + } protected void reshape( int width, int height ) { + Debug.Indent(); + Debug.WriteLine( "Entering Gears.reshape(int,int) "); + if (height==0) height = 1; // prevent division by zero float h = ((float)height) / ((float)width); *************** *** 90,96 **** --- 131,143 ---- glLoadIdentity(); glTranslatef( 0.0f, 0.0f, -40.0f ); + + Debug.WriteLine( "Exiting Gears.reshape(int,int) "); + Debug.Unindent(); } protected void draw() { + Debug.Indent(); + Debug.WriteLine( "Entering Gears.draw() "); + glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); *************** *** 121,127 **** --- 168,180 ---- glutSwapBuffers(); + + Debug.WriteLine( "Exiting Gears.draw() "); + Debug.Unindent(); } protected void gear( double inner_radius, double outer_radius, double width, int teeth, double tooth_depth ) { + Debug.Indent(); + Debug.WriteLine( "Entering Gears.gear(double,double.double,int,double) "); + int i; double r0, r1, r2, angle, da, u, v, len; *************** *** 232,235 **** --- 285,291 ---- } glEnd(); + + Debug.WriteLine( "Exiting Gears.gear(double,double.double,int,double) "); + Debug.Unindent(); } *************** *** 239,245 **** public static void Main( string[] args) { new Gears(); } ! } \ No newline at end of file --- 295,303 ---- public static void Main( string[] args) { + Debug.Listeners.Add( new TextWriterTraceListener( Console.Out ) ); + Debug.AutoFlush = true; new Gears(); } ! } Index: samples.build =================================================================== RCS file: /cvsroot/csdopenglnet/csdOpenGL/samples/samples.build,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** samples.build 11 Sep 2004 14:17:51 -0000 1.2 --- samples.build 11 Sep 2004 18:52:46 -0000 1.3 *************** *** 9,17 **** <delete file="${build.dir}/${filename}.exe" failonerror="false" /> </foreach> </target> ! <target name="build" description="compiles the source code"> <foreach item="String" in="${examples}" delim=" " property="filename"> ! <csc target="exe" output="${build.dir}/${filename}.exe"> <sources> <include name="${filename}" /> --- 9,19 ---- <delete file="${build.dir}/${filename}.exe" failonerror="false" /> </foreach> + <delete file="${build.dir}/Flag.bmp" failonerror="false" /> </target> ! <target name="build" description="compiles the source code" depends="build_gtk"> ! <copy file="Flag.bmp" todir="${build.dir}" /> <foreach item="String" in="${examples}" delim=" " property="filename"> ! <csc target="exe" output="${build.dir}/${filename}.exe" debug="${debug}"> <sources> <include name="${filename}" /> *************** *** 28,33 **** </csc> </foreach> ! <foreach item="String" in="${gtkexamples}" delim=" " property="filename" if="${gtk}"> ! <csc target="exe" output="${build.dir}/${filename}.exe"> <sources> <include name="${filename}" /> --- 30,38 ---- </csc> </foreach> ! </target> ! ! <target name="build_gtk" description="compiles the source code" if="${gtk}"> ! <foreach item="String" in="${gtkexamples}" delim=" " property="filename" > ! <csc target="exe" output="${build.dir}/${filename}.exe" debug="${debug}"> <sources> <include name="${filename}" /> *************** *** 50,52 **** </foreach> </target> ! </project> \ No newline at end of file --- 55,57 ---- </foreach> </target> ! </project> |