3D parametric plotter

This video from Benedek93 is a little slow to get going, but it’s well worth watching all the way through for a really tight demonstration of what you can achieve with OpenGL ES on the Pi. 

Benedek says:

Recently I’ve started going through a tutorial for modern OpenGL programming again (I can recommend it:http://arcsynthesis.org/gltut/ ), and on the way I decided to re-do that function plotter program I have showed off in one of my videos (“OpenGL Shaders and Shadow Maps”).

First I wrote it using the old, fixed-pipeline OpenGL specification so that I could run it on my laptop which didn’t support the newer versions. You can download it here and play with it on a PC: https://bitbucket.org/benedek/simple-…

At the same time I was also messing around with OpenGL on the Raspberry Pi and I was impressed seeing how smoothly you could make it draw simple but pretty 3D graphics. So I started porting that program to the RPi, adding the boilerplate code necessary to set up a GL context on it and changing the graphics code to use modern OpenGL ES.

In the end, the results were just as pretty as in my old shadow-mapping plotter program (except for the shadows), and the RPi was able to draw models smoothly at the same triangle counts as my laptop.

Here’s the download link: https://bitbucket.org/benedek/rpi-sim…

21 comments

Avatar

Way cool. Can’t wait to play with it tonight.

Avatar

Did compile on a raspian from February 2013.
Did not compile on a raspian from December 2012, updated, upgraded and rpi-updated.
Missing symbols:
georg@crumb ~/benedek-rpi-simple-paramplot-36f81c51893d $ g++ -o rpi-simple-paramplot main.o graphics.o evaluator.o -L/opt/vc/lib -lGLESv2 -lEGL `pkg-config –libs sdl`
main.o:main.cpp:function main: error: undefined reference to ‘bcm_host_init’
main.o:main.cpp:function main: error: undefined reference to ‘bcm_host_deinit’
graphics.o:graphics.cpp:function Graphics::init_egl_context(): error: undefined reference to ‘graphics_get_display_size’
graphics.o:graphics.cpp:function Graphics::init_egl_context(): error: undefined reference to ‘vc_dispmanx_display_open’
graphics.o:graphics.cpp:function Graphics::init_egl_context(): error: undefined reference to ‘vc_dispmanx_update_start’
graphics.o:graphics.cpp:function Graphics::init_egl_context(): error: undefined reference to ‘vc_dispmanx_element_add’
graphics.o:graphics.cpp:function Graphics::init_egl_context(): error: undefined reference to ‘vc_dispmanx_update_submit_sync’
collect2: ld returned 1 exit status

Any help is appreciated!

Avatar

Yeah, I’ve only built it on the newest version (I had an older Raspbian on an SD card which I lost apparently) and I used the minimal set of building options which made it compile for me :)

You can take a look at the demo’s Makefile in /opt/vc/src/ to get some extra g++ options.
Here’s some you could try:

-lbcm_host -lvcos [possibly: -lopenmaxil -lvchiq_arm]

If you get it running, could you please let me know which options are necessary so I can update the Makefile in the repository? Many thanks!

liz

Hi Benedek! If you have a website you’d like us to link to in this post, please let me know (loved your YouTube channel). And thank you very much for producing this video; it’s awesome.

Avatar

Hey, thanks very much for linking to my video! If it weren’t for this post, it would never have gotten this much attention =)

The closest thing I have to a website right now is
http://n.ethz.ch/~vartokb/
but you don’t have to link to it, I don’t use it that much.

Avatar

Adding -lbcm_host at the end did the trick.

Avatar

A truly superb demonstration of the capabilities of the Raspberry Pi!

This gives a great ‘peak’ at what the ‘big kids’ can do with the $35 wonder. Visualization would help so much in grasping advanced math concepts, every lab/classroom should have one…

Thank you for investing the time and for the excellent demonstration.

Avatar

Ok, now this is really annoying, not the video, but how it seems everyone else’s OpenGL ES is working find but mine has never worked, tried Minecraft Pi edition it worked 3 times then crashed, re-installed it and it still pulled up an error after i did an sudo apt-get update && sudo apt-get upgrade, and I re-installed OpenGL ES. Sorry if this is not the right place to vent my aggravation over this but i would like some help… (Awesome job Benedek93!)

Avatar

Oh, and i am using Occidentals from Adafruit if this helps (re-installed the image as well and nothing…)

Avatar

Have you tried using a different power supply?
You’ll be able to get more help if you ask on the Forum (see the big prominent link at the top of the page? ;-) )
See also http://elinux.org/R-Pi_Troubleshooting

Avatar

try monster speaker cables :[=]

Avatar

Impressive Video! I had No Idea RP had the ability to do this sort of Graphics Processing. Fantastic! Thank You for the demo.

Regards
Vince

Avatar

That’s really neat! Much better than the Casio graphic calculator I used during my Maths A-level :-)

I initially mis-read the title as “3D parametric printer” – funny how your brain gets so used to seeing certain phrases.

Avatar

A Casio graphic calculator! and I remember being happy with my new 12″ slide rule. It even had the sqrt(1 + x**2). They arrived in time to be handed out during a Further Maths examination.

Avatar

Always good to see that there is at least one guy present older than me!

When the time came that I learned about logarithms in school my father took me to the side and showed me his collection of slide rules.

It was like with phones and tablets: you had to trade resolution for mobility. ;-)

Avatar

Fabulous stuff.

As an aside, I see you have headers in P2, what are you using them for ?

Avatar

The lack of mounting holes indicates he’s using a Revision1.0 RasPi – these all came with headers fitted to P2 (even though it’s not usable by anybody outside Broadcom). http://elinux.org/RPi_Low-level_peripherals and http://elinux.org/RPi_Hardware contain more details.

Avatar

Nice to see the slick graphics demos coming through :)

Avatar

If you’re interested, you can also discuss this program on the forum thread I created here: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=68&t=35867

Avatar

Excellent, will have a go, looks really good.

Avatar

Am very new to any form of linux so have spent the evening learning about make and apt-get and have installed sdl. However, am now getting the error that it is missing the file glm/glm.hpp. Should there be a glm subdirectory?

Leave a Comment

Comments are closed