mirror of
https://github.com/MartinOpat/cuda-based-raytrace.git
synced 2025-06-07 02:13:10 +02:00
fix: forgor to allocate gpu memory
This commit is contained in:
@@ -3,10 +3,11 @@
|
||||
|
||||
|
||||
__host__ FrameBuffer::FrameBuffer(unsigned int w, unsigned int h) : w(w), h(h) {
|
||||
this->buffer_size = w*h*4;
|
||||
this->buffer_size = w*h*sizeof(unsigned int);
|
||||
cudaMalloc((void**)&this->buffer, this->buffer_size);
|
||||
cudaMemset(this->buffer, 0, this->buffer_size);
|
||||
}
|
||||
|
||||
|
||||
__device__ void FrameBuffer::writePixel(int x, int y, float r, float g, float b) {
|
||||
int i = y * this->w + x;
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@ void Raycaster::resize(int w, int h) {
|
||||
this->w = w;
|
||||
this->h = h;
|
||||
|
||||
delete fb;
|
||||
delete this->fb;
|
||||
this->fb = new FrameBuffer(w, h);
|
||||
|
||||
// TODO: should be globals probably
|
||||
|
||||
Reference in New Issue
Block a user