Live data from Hacker News

How OpenGL works: software renderer in 500 lines of code

github.com

1–10 of 37 posts

Re: How OpenGL works: software renderer in 500 lines of code

#5
I wrote a software implementation of OpenGL with the only goal of being able to play Quake3 using it. I can vouch that it is an amazing learning experience. The tutorial here doesnt seem to aproach the issues of performance however, which really are another learning experience entirely.

Re: How OpenGL works: software renderer in 500 lines of code

#6
post #4

Will this teach you how shader-based OpenGL works or the older fixed function pipeline rendering method?

"OpenGL" is a bit of a misnomer here, there's nothing directly related to OpenGL. This will not teach you how opengl works, but is an example of a software rasterizer. Knowing how that works will help you understand what is going on under the hood of your graphics API.

This renderer does do lighting per-fragment, so it's more akin to the newer shader-based OpenGL.

Re: How OpenGL works: software renderer in 500 lines of code

#7
I remember once I needed to macro up a software that needed an X server with OpenGL to run. (Like really dirtily hack it up, with xmacro and stuff like that). I wish I could set up a headless X server with a dummy OpenGL renderer (witch doesn't actually render anything), so it doesn't bottleneck on rendering that isn't used anyway. I guess it's even easier to write such and OpenGL implementation.

edit: Now I see it doesn't implement the OpenGL API though, the goals are obviously different.

Re: How OpenGL works: software renderer in 500 lines of code

#8
post #4

Will this teach you how shader-based OpenGL works or the older fixed function pipeline rendering method?

If you look at main.cpp the vertex and framgment stages are abstracted via IShader, which also handles passing data between them. This emulates the programmable pipeline.

Re: How OpenGL works: software renderer in 500 lines of code

#10
post #7

I remember once I needed to macro up a software that needed an X server with OpenGL to run. (Like really dirtily hack it up, with xmacro and stuff like that). I wish I could set up a headless X server with a dummy OpenGL renderer (witch doesn't actually render anything), so it doesn't bottleneck on rendering that isn't used anyway. I guess it's even easier to write such and OpenGL implementation. edit: Now I see it d…

Mesa has an offscreen rendering implementation that allows you to do OpenGL without an X server :

http://www.mesa3d.org/osmesa.html

Post reply on HN