开发者

How to draw 3D images?

开发者 https://www.devze.com 2023-03-02 08:26 出处:网络
I am working on a simple 3d software renderer but one thing I\'m no sure about is how to actually draw it all on the screen. What could I use to draw a wireframed cube ?

I am working on a simple 3d software renderer but one thing I'm no sure about is how to actually draw it all on the screen. What could I use to draw a wireframed cube ? I am not asking HOW to write a compl开发者_如何学编程ete 3D pipeline just the final step, the actual drawing on the screen.

Edit: I think I could do that with SDL.


You need to project the 3D object onto the 2D screen using a perspective transformation matrix.

This will generate a set of 2D lines etc. which get drawn in the same way as "normal" 2D lines get drawn.

However, without more information about the language and/or framework you are using, it's not easy to go into any more detail.


For the "actual drawing on screen" in Windows XP of your software-rendered wireframe 3D, call StretchDIBits with a pointer to the array of bytes that represents your pixels. This answer addresses maximum convenience; maximum efficiency is another matter.

0

精彩评论

暂无评论...
验证码 换一张
取 消