Implémentation du raytracing pour Global Memory/Shared Memory/Constant Memory
[GPU.git] / WCudaMSE / Student_Cuda_Image / src / cpp / core / mainGL.cpp
1 #include <iostream>
2 #include <stdlib.h>
3 #include <string.h>
4 using namespace std;
5
6 #include "GLUTImageViewers.h"
7
8 #include "Device.h"
9 #include "cudaTools.h"
10
11 #include "Rippling0Provider.h"
12 #include "RipplingProvider.h"
13 #include "FractalProvider.h"
14 #include "NewtonProvider.h"
15 #include "HeatTransfertProvider.h"
16 #include "RayTracingProvider.h"
17 #include "ConvolutionProvider.h"
18
19 #include "Viewer.h"
20
21 int mainGL(const vector<string>& args)
22 {
23 const string defaultCommand = "raytracing";
24 const string command = args.size() > 0 ? args[0] : defaultCommand;
25
26 // AutoViewer<Rippling0Image, Rippling0Provider> rippling0(true, true, 10, 10); // Warmup.
27
28 if (command == "rippling")
29 {
30 AutoViewer<Image, RipplingProvider> rippling(true, true, 10, 10);
31 }
32 else if (command == "mandelbrot")
33 {
34 const bool multiGPU = args.size() >= 2 && args[1] == "--mp";
35 Viewer<ImageFonctionel> fractalMandelbrot(MandelbrotProvider::createGL(multiGPU), true, true, 10, 10);
36 }
37 else if (command == "julia")
38 AutoViewer<ImageFonctionel, JuliaProvider> fractalJulia(true, true, 10, 10);
39 else if (command == "newton")
40 AutoViewer<ImageFonctionel, NewtonProvider> newtown(true, true, 10, 10);
41 else if (command == "heat-transfert")
42 AutoViewer<Image, HeatTransfertProvider> heatTransfert(true, false, 10, 10);
43 else if (command == "raytracing")
44 AutoViewer<Image, RayTracingProvider> rayTracing(true, true, 20, 20);
45 else if (command == "convolution")
46 {
47 const string videoPath = args.size() >= 2 ? args[1] : "/media/Data/Video/nasaFHD_short.avi"; // Vidéo par défaut si pas donnée en paramètre.
48 Viewer<Image> convolution(ConvolutionProvider::createGL(videoPath), true, true, 10, 10);
49 }
50 else if (command == "demo")
51 {
52 Viewer<Image> convolution(ConvolutionProvider::createGL("/media/Data/Video/nasaFHD_short.avi"), true, true, 10, 10, false);
53 AutoViewer<Image, RipplingProvider> rippling(true, true, 60, 30, false);
54 Viewer<ImageFonctionel> fractalMandelbrot(MandelbrotProvider::createGL(false), true, true, 120, 60, false);
55 AutoViewer<ImageFonctionel, JuliaProvider> fractalJulia(true, true, 180, 80, false);
56 AutoViewer<ImageFonctionel, NewtonProvider> newtown(true, true, 260, 120, false);
57 AutoViewer<Image, HeatTransfertProvider> heatTransfert(true, false, 1200, 300, false);
58 GLUTImageViewers::runALL();
59 }
60 else
61 {
62 cout << "Command unknown: " << command << endl;
63 }
64
65 return EXIT_SUCCESS;
66 }