Update of /cvsroot/csdopenglnet/csdOpenGL/samples
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6845
Modified Files:
Makefile
Added Files:
gears.cs
Log Message:
new example
--- NEW FILE: gears.cs ---
using csDragons.OpenGL;
using System;
public class Lesson01GLUT : csdGL {
public Lesson01GLUT() {
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
glutInitWindowSize( 640, 480 );
glutCreateWindow("Gears");
initGL(); // initialize the OpenGL context
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() {
glutPostRedisplay();
}
protected void initGL() {
glShadeModel( GL_SMOOTH );
glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
glClearDepth( 1.0f );
glEnable( GL_DEPTH_TEST );
glDepthFunc( GL_LEQUAL );
glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );
}
protected void reshape( int width, int height ) {
if (height==0) height = 1; // prevent division by zero
float h = ((float)height) / ((float)width);
glViewport (0, 0, width, height);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glFrustum (-1.0, 1.0, -h, h, 5.0, 5.0);
glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();
}
protected void draw() {
glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glLoadIdentity();
glutSwapBuffers();
}
protected void keyboard( byte key, int x, int y ) {
if (key==27) System.Environment.Exit(0);
}
public static void Main( string[] args) {
new Lesson01GLUT();
}
}
Index: Makefile
===================================================================
RCS file: /cvsroot/csdopenglnet/csdOpenGL/samples/Makefile,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Makefile 17 Jul 2004 11:59:31 -0000 1.2
--- Makefile 17 Jul 2004 18:37:49 -0000 1.3
***************
*** 10,14 ****
LIBOPTS=$(foreach lib,$(LIBS),-r $(lib))
! all: $(LIBS) triangle.exe texture.exe gtkWidget.exe
csdGL.dll: libcsdGL.so
--- 10,14 ----
LIBOPTS=$(foreach lib,$(LIBS),-r $(lib))
! all: $(LIBS) triangle.exe texture.exe gtkWidget.exe gears.exe
csdGL.dll: libcsdGL.so
|