int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH); glutInitWindowPosition(100,100); glutInitWindowSize(RENDER_WIDTH,RENDER_HEIGHT); glutCreateWindow("GLSL Shadow mapping"); // This call will grab openGL extension function pointers. // This is not necessary for macosx and linux #ifdef _WIN32 getOpenGLFunctionPointers(); #endif generateShadowFBO(); loadShadowShader(); // This is important, if not here, FBO's depthbuffer won't be populated. glEnable(GL_DEPTH_TEST); glClearColor(0,0,0,1.0f); glEnable(GL_CULL_FACE); glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST); glutDisplayFunc(renderScene); glutIdleFunc(renderScene); glutKeyboardFunc(processNormalKeys); glutMainLoop(); }
int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH); glutInitWindowPosition(100,100); glutInitWindowSize(RENDER_WIDTH,RENDER_HEIGHT); glutCreateWindow("GLSL Shadow mapping"); // This call will grab openGL extension function pointers. // This is not necessary for macosx and linux generateShadowFBO(); loadShadowShader(); // This is important, if not here, FBO's depthbuffer won't be populated. glEnable(GL_DEPTH_TEST); glClearColor(0,0,0,1.0f); glEnable(GL_CULL_FACE); glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST); glutDisplayFunc(renderScene); glutIdleFunc(renderScene); glutKeyboardFunc(keyboard); glutSpecialFunc(keySpecial); glutPassiveMotionFunc(mouseMoved); //glutKeyboardFunc(processNormalKeys); shaderProgram = initializeShaders("perPixel.vert", "perPixel.frag"); toonProgram = initializeShaders("toon.vert", "toon.frag"); //loadTextures(); static GLfloat angle = 0.0; for(int x=0; x<45; x++) { for(int y=0; y<45; y++) { angle = x * 2.0 * 3.14159265 / 45; points[x][y][0]=float((x/5.0f)-4.5f); points[x][y][1]=float((y/5.0f)-4.5f); points[x][y][2]=float(sin((((x/5.0f)*40.0f)/360.0f)*3.141592654*2.0f)); } } glutMainLoop(); }
int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB|GLUT_DOUBLE|GLUT_DEPTH); glutInitWindowSize(RENDER_WIDTH,RENDER_HEIGHT); glutCreateWindow("shader cube"); glutDisplayFunc(display_everything); // shadow //glutDisplayFunc(display); //glutDisplayFunc(displayBumpMapping ); glutMouseFunc(mymouse); glutMotionFunc(mymotion); glutKeyboardFunc(mykey); // initialize GLEW GLenum err = glewInit(); if ( err != GLEW_OK) printf(" Error initializing GLEW! \n"); else printf("Initializing GLEW succeeded!\n"); string fileLoc = "/home/arindam/Course/lab5/src/cubeXform"; //programObject = SetupGLSL("/home/arindam/Course/lab3/cse5542Lab3/cubeXform"); //create shaders - assume the shaders are cubeXform.vert and cubeXform.frag programObject = SetupGLSL("/home/arindam/workspace/cse5542lab5/cubeXform"); InitGeometry(); InitTexture(); generateShadowFBO(); glEnable(GL_DEPTH_TEST); glClearColor(0,0,0,1.0f); glEnable(GL_CULL_FACE); glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST); cout <<"init geometry done "<<endl; InitVBO(); cout <<" init vbo "<<endl; cout <<" init texture "<<endl; glutMainLoop(); }
int RenderEngine::init() { p_camera = vec3(16,10,0); //Camera lookAt l_camera = vec3(0,0,0); //Camera up u_camera = vec3(0,1,0); //Light position p_light = vec3(110,60,0); //Light lookAt l_light = vec3(0,0,0); //Light Scatter Physical Light Location (used for demonstrations like title screen, where illumination is not same place as physical light in light scatter render) p_light_scatter = vec3(110,60,0); //Sky Color skyColor = vec4(0,0,0,0); //Trippy Light Scattering Mode deathScatter = false; FreeImage_Initialise(); // set some lights { //float ambient[4] = { .5f, .5f, .5f, 1.f }; float diffuse[4] = { 1.0f, 1.0f, 1.0f, 1.f }; float pos[4] = { p_light[0], p_light[1], p_light[2], 0 }; //glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse); glLightfv(GL_LIGHT0, GL_POSITION, pos); glEnable(GL_LIGHT0); } glEnable(GL_DEPTH_TEST); glClearColor(0,0,0,1.0f); glEnable(GL_CULL_FACE); glFrontFace(GL_CCW); glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST); this->activate(); glutDisplayFunc(renderFunction); glutIdleFunc(renderFunction); glewInit(); if (GLEW_ARB_vertex_shader && GLEW_ARB_fragment_shader) printf("Ready for GLSL\n"); else { printf("No GLSL support\n"); exit(1); } //Generate FBOs generateShadowFBO(); generateBlurFBO(); generateLightFBO(); //Load Shaders shade = new ShadowShader("shaders/MainVertexShader.c", "shaders/MainFragmentShader.c"); blurShade = new BlurShader("shaders/GaussianBlurVertexShader.c", "shaders/GaussianBlurFragmentShader.c"); depthShade = new GeometryShader("shaders/DepthVertexShader.c", "shaders/DepthFragmentShader.c"); scatterShade = new ScatterShader("shaders/ScatteringVertexShader.c", "shaders/ScatteringFragmentShader.c"); darkShade = new GeometryShader("shaders/SimpleDarkVertexShader.c", "shaders/SimpleDarkFragmentShader.c"); return 0; }