Pure Rb Code 3D – Topology – Points

OpenGL when it draws has a few choices of the ‘topology’ it uses to render. One of them is GL_Points. See Table 2.1. Another is GL_Lines. Our engine at this stage is using lines to render the triangles. This project adds the ability to draw points. It’s a very simple drawing method that replaces our current call to the Rb Graphics class call to DrawLine(…..) with the call to FillOval(……). I’d like to add the other topology calls that OpenGL uses, but for now will just stay to these two choices. If you press the ‘W’ key key you can toggle between the two different drawing calls in this project.

Lines And Points Screenshot

Points Screenshot

One other little tweak that I’ve done, but not here in this project, is to replace the Rb call to DrawLine with declare calls to the Carbon and Cocoa calls that draw lines. I’m trying to keep this group of projects as cross platform as possible, so I won’t include them here. But, if you’re following this blog and you have some time to explore, one area are these final draw routines. If you do an internet search of ‘Bresenaham’, you will find code that is based on his work on drawing lines. In Rb you can apply this ‘raw’ line drawing routine using the Graphics.Pixel(…..) call. This is one link. Another routine along this thought process is to code up an anti-aliasing line drawing routine. OpenGL implements this with a GL_SMOOTH constant. Just a thought or two. :-)

Download Projects Here …..

Happy New Year!!

About bigdaddytom

Hobbyist programmer, self taught, started with Rb in 1999. Xcode, Objective-C iPhone coder too. I have been blessed being able to live in Hawaii for over three decades. Proud father of two. Business owner. The above image is from atop Mauna Kea looking towards Mauna Loa on the big Island of Hawaii.
This entry was posted in Code. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>