I am planning on writing a software rasterizer. I searched for some tips on the internet. i found people implementing it on SDL. I was wondering if i can use glut as my window toolkit to achieve the same. So, i would just need it as the rendering surface. (This is just for learning purpose). Everything else would come from the rasterizer. So, is it possible to somehow do this using glut?
Thanks in advance!
If performance doesn’t matter that much for you, you can simply use glut or any other framework that provides you an OpenGL window and then simply blit your pixel array resulting from the software rasterizer using glDrawPixels.
Alternatively write from your system memory framebuffer into a texture (using glTexSubImage2D), then draw that to screen as a full-screen quad, which might give better performance. You could even get sexy and implement brightness controls, blurs or other post-processing in hardware.
I would also suggest rendering it as a fullscreen quad texture (if performance isn’t so important - on the other hand your software rasterize might still be the bottleneck, not GL).
Rendering it as a texture would give you nearest filtered zoom, brightness control and other simple shader tricks that might help debugging your software rasterizer (also rendering the same geometry in GL and see if your software approach produces the same result - i one used a similar framework for my first simple ray-tracer to check that i got the transformations right… ah, memories).
Thanks a lot for the suggestions. Since i’m planning to do everything from scratch, i’m guessing it would take quite some time.