Factorial program in Java Get link Facebook X Pinterest Email Other Apps April 12, 2014 public class factorial { static int fact(int n) { if(n==0 || n==1) return 1; else return n*fact(n-1); } public static void main(String [] args) { System.out.println("Factorial(4)="+fact(4)); } } Get link Facebook X Pinterest Email Other Apps Comments
GL_QUAD_STRIP Example In OpenGl May 09, 2014 #include <GL/glut.h> void display() { glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0,1.0,0.0); glBegin(GL_QUAD_STRIP); glVertex3f(0.2, 0.2,0.0); glVertex3f(0.8, 0.2,0.0); glVertex3f(0.2,0.4,0.0); glVertex3f(0.8,0.4,0.0); glVertex3f(0.2,0.8,0.0); glVertex3f(0.8,0.8,0.0); glEnd(); glFlush(); } void init() { glClearColor(0.0,0.5,0.2,0.8); } int main(int argc, char** argv) { glutCreateWindow("simple 3D"); glutDisplayFunc(display); init(); glutMainLoop(); } Read more
GL_POLYGON Example In OpenGl May 09, 2014 #include <GL/glut.h> void display() { glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0,1.0,0.0); glBegin(GL_POLYGON); glVertex3f(0.1, 0.1,0.0); glVertex3f(0.6, 0.1,0.0); glVertex3f(0.8,0.3,0.0); glVertex3f(0.6,0.6,0.0); glVertex3f(0.1,0.6,0.0); glVertex3f(0.0,0.3,0.0); glEnd(); glFlush(); } void init() { glClearColor(0.0,0.5,0.2,0.8); } int main(int argc, char** argv) { glutCreateWindow("simple 3D"); glutDisplayFunc(display); init(); glutMainLoop(); } Read more
Comments
Post a Comment