diff --git a/src/consts.h b/src/consts.h index 2bb8caa..0c1e8d4 100644 --- a/src/consts.h +++ b/src/consts.h @@ -13,7 +13,7 @@ const int IMAGE_WIDTH = 800; const int IMAGE_HEIGHT = 600; const double epsilon = 1e-10f; -const double infty = 1e15f; // This vlalue is used to represent missing values in data +const double infty = 1e15f; // This value is used to represent missing values in data // --------------------------- Raycasting Constants --------------------------- diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index fee200d..1451789 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -70,6 +70,7 @@ int Window::init_quad(float* data) { this->shader = std::make_unique("./shaders/vertshader.glsl", "./shaders/fragshader.glsl"); this->shader->use(); + glUniform1i(glGetUniformLocation(this->shader->ID, "currentFrameTex"), 0); return 0; } @@ -105,11 +106,6 @@ void Window::tick() { glBindFramebuffer(GL_FRAMEBUFFER, 0); glDisable(GL_DEPTH_TEST); - glClearColor(0.2f, 0.3f, 0.3f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT); - - // render frame - glBindFramebuffer(GL_FRAMEBUFFER, this->current_quad->fb); this->current_quad->render(); this->shader->use(); glBindVertexArray(this->current_quad->VAO); @@ -117,12 +113,9 @@ void Window::tick() { glDrawArrays(GL_TRIANGLES, 0, 6); // draw current frame to texture // check for events - // + swap buffers; TODO: check if necessary? glfwSwapBuffers(this->window); glfwPollEvents(); - std::cout << "done ticking\n"; - } void Window::resize(unsigned int w, unsigned int h) { diff --git a/src/gui/MainWindow.h b/src/gui/MainWindow.h index e7d6c46..62a0e7c 100644 --- a/src/gui/MainWindow.h +++ b/src/gui/MainWindow.h @@ -12,7 +12,7 @@ class Window { public: unsigned int w; unsigned int h; - float* data; //TODO: dynamic data loading + float* data; Window(unsigned int w, unsigned int h); diff --git a/src/gui/Quad.cpp b/src/gui/Quad.cpp index c4fd629..d918763 100644 --- a/src/gui/Quad.cpp +++ b/src/gui/Quad.cpp @@ -67,7 +67,7 @@ Quad::Quad(unsigned int w, unsigned int h) { void Quad::make_fbo(){ glGenFramebuffers(1, &fb); glBindFramebuffer(GL_FRAMEBUFFER, fb); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, this->tex, 0); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0); } @@ -85,8 +85,8 @@ void Quad::cuda_init(float* data) { void Quad::render() { glBindTexture(GL_TEXTURE_2D, 0); this->renderer->render(); - glBindBuffer(GL_PIXEL_UNPACK_BUFFER, this->PBO); glBindTexture(GL_TEXTURE_2D, this->tex); + glBindBuffer(GL_PIXEL_UNPACK_BUFFER, this->PBO); glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, this->w, this->h, GL_BGRA, GL_UNSIGNED_BYTE, NULL); }; diff --git a/src/illumination/FrameBuffer.cu b/src/illumination/FrameBuffer.cu index f81af04..df4fe99 100644 --- a/src/illumination/FrameBuffer.cu +++ b/src/illumination/FrameBuffer.cu @@ -2,11 +2,7 @@ #include "linalg/linalg.h" -__host__ FrameBuffer::FrameBuffer(unsigned int w, unsigned int h) : w(w), h(h) { - this->buffer_size = w*h*sizeof(unsigned int); - cudaMalloc((void**)&this->buffer, this->buffer_size); - cudaMemset(this->buffer, 0, this->buffer_size); -} +__host__ FrameBuffer::FrameBuffer(unsigned int w, unsigned int h) : w(w), h(h) {} __device__ void FrameBuffer::writePixel(int x, int y, float r, float g, float b) { int i = y * this->w + x; diff --git a/src/main.cu b/src/main.cu index f232b3e..68bc172 100644 --- a/src/main.cu +++ b/src/main.cu @@ -14,6 +14,11 @@ static float* d_volume = nullptr; +// TODO: general +// * pass camera_info to the raycasting function - updated according to glfw. +// * on that note, code for handling input (mouse movement certainly, possibly free input / 4 pre-coded views, q/esc to quit, space for pause (would be were the 'simple' render idea would come in)) +// * very similarly - actual code for loading new data as the simulation progresses - right now its effectively a static image loader +// void getTemperature(std::vector& temperatureData, int idx = 0) { std::string path = "data/trimmed";