int main(int argc, char** argv)
{
    // Launch CUDA/GL
    init(argc, argv);
    cudaGLSetGLDevice( compat_getMaxGflopsDeviceId() );
    cudaGLRegisterBufferObject( planetVBO );
	cudaGLRegisterBufferObject( velocityVBO );
    
#if VISUALIZE == 1 
    initCuda(N_FOR_VIS);
#else
    initCuda(2*128);
#endif

    projection = glm::perspective(fovy, float(width)/float(height), zNear, zFar);
    view = glm::lookAt(cameraPosition, glm::vec3(0.0, 0.0, 0), glm::vec3(0,1,0));
    projection = projection * view;

    initShaders(program);

    glEnable(GL_DEPTH_TEST);

    glutDisplayFunc(display);
    glutKeyboardFunc(keyboard);
	glutMotionFunc(mouseMotion);

    glutMainLoop();

    return 0;
}
예제 #2
0
void initCuda(){
  // Use device with highest Gflops/s
  cudaGLSetGLDevice( compat_getMaxGflopsDeviceId() );

  initPBO(&pbo);

  // Clean up on program exit
  atexit(cleanupCuda);

  runCuda();
}
예제 #3
0
void initCuda(){
  // Use device with highest Gflops/s
  cudaGLSetGLDevice( compat_getMaxGflopsDeviceId() );

  initPBO(&pbo);

  modelView = glm::lookAt(cameraPosition, lookat, up);
  projection = glm::perspective(fovy, float(width) / float(height), zNear, zFar);  
  viewPort[0] = glm::vec4(-float(width)/2,0,0,0.0f);
  viewPort[1] = glm::vec4(0,-(float)height/2,0,0.0f);
  viewPort[2] = glm::vec4(0,0,1.f/2.0f,0.0f);
  viewPort[3] = glm::vec4((float)width/2,(float)height/2,1.0f/2.0f,1.0f);
  // Clean up on program exit
  atexit(cleanupCuda);

  runCuda();
}
예제 #4
0
int main(int argc, char** argv)
{
    // Launch CUDA/GL

    init(argc, argv);

    cudaGLSetGLDevice( compat_getMaxGflopsDeviceId() );
    initPBO(&pbo);
    cudaGLRegisterBufferObject( planetVBO );
    
#if VISUALIZE == 1 
	initCuda(N_FOR_VIS, glm::vec4 (cameraPosition, 1));
#else
    initCuda(20*120);
#endif
//	setDevicePrefetch (prefetchEnabled);
    perspMat = glm::perspective(fovy, float(width)/float(height), zNear, zFar);
    view = glm::lookAt(cameraPosition, glm::vec3(0), glm::vec3(0,0,1));

    projection = perspMat * view;

    GLuint passthroughProgram;
    initShaders(program);

    glUseProgram(program[HEIGHT_FIELD]);
    glActiveTexture(GL_TEXTURE0);

    glEnable(GL_DEPTH_TEST);


    glutDisplayFunc(display);
    glutKeyboardFunc(keyboard);

    glutMainLoop();

    return 0;
}
예제 #5
-1
int main(int argc, char** argv)
{
    // Launch CUDA/GL

    init(argc, argv);

    cudaGLSetGLDevice( compat_getMaxGflopsDeviceId() );
    cudaGLRegisterBufferObject( planetVBO );
    
#if VISUALIZE == 1 
    initCuda(N_FOR_VIS);
#else
    initCuda(2*128);
#endif

    projection = glm::perspective(fovy, float(width)/float(height), zNear, zFar);
	view = camera.getViewMatrix();

    projection = projection * view;

    GLuint passthroughProgram;
    initShaders(program);

    glUseProgram(program[HEIGHT_FIELD]);
    glActiveTexture(GL_TEXTURE0);

    glEnable(GL_DEPTH_TEST);

    glutDisplayFunc(display);
    glutKeyboardFunc(keyboard);

    glutMainLoop();

    return 0;
}