Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> OpenGL 1.1-style implementation on software

How many lines to implement OpenGL 2.0 (non ES) ?



An order of magnitude more ;) You need to implement user-programmable shaders, both ARB assembly and GLSL. That needs a GLSL parser, a shader interpreter (talking about compiling it to machine code would add another magnitude of complexity).

You also need to implement multitexturing (probably the easy part) but also all the texture combiner stuff too. This one is not hard but also a good chunk of code...

All in all, at least 40K if you ask me, but that's a very lowball estimate.

Of course if you don't care about implementing the full spec, you can get away with a lot less.


I implemented the OpenGL API for fixed function hardware once, and chose the cut off at 1.5 with some extensions like framebuffer objects. 1.x has a lot of cruft that nobody should use, but is still easy to implement. 2.x has a lot of stuff like shaders that are a lot more work to implement in software.


Not sure what the line count is, but PortableGL is a software renderer for 3.x(ish):

https://github.com/rswinkle/PortableGL

Cool project, and fun to play with.


It currently clocks it at 12.5K but that includes stuff that could easily be stripped out. I suspect, even if I had it "finished" with everything I would ever want in it, it wouldn't be more than 15-20k. PGL saves a lot by not bothering with GLSL at all.

Glad you found it fun to play with, that's what it's for. Hoping to have a new release in the next week or so, and there have been some serious/breaking changes since the last so hopefully it goes well.

And on the topic of this thread, PGL is overkill for raylib's software rendering backend since they don't need arbitrary shader support, but I would still love to try making PGL a raylib backend someday because it would be cool and running the entire set of Raylib examples would be a great stress test. Plus then I could use raylib to make a game with PGL, win-win.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: