I've been struggling to get my head around the "proper" -- Qt/3D -- way to use OpenGL (programmable pipeline) in a Qt data aquisition and visualisation application. I'm fairly new to OpenGL and GLSL as well so this may be old news to everyone except me, howeve, while struggling with it I didn't find any examples that showed simply, "this is how to make a nice looking teapot/cube/icosohedron etc."
So, this is one way of makeing a nice looking teapot with a gooch shader in Qt/3D. Qt/3D is under quite rapid development (by the looks of things) so I expect the method will change with time. This example contains one scene node -- teapot (or triangle) -- one light, one shader program and no textures. I'm in scientific visualisation so I don't really need textures much unless I want my data to look like a crate or a wall :-)
I have found "Shader Maker" useful (not for this example, just in general): "Shader Maker Project Page":http://cg.in.tu-clausthal.de/teaching/shader_maker/index.shtml as Shader Designer wouldn't go for me in Kubuntu 11.10.
If there are screw-ups or someone knows better than me what the "Qt way" for doing this sort of thing is... please let me know.
My approach is based on the following copule of lines from the Qt/3D docs at "QGLScreenNode() Qt Doc":http://doc.qt.nokia.com/qt3d-snapshot/qglscenenode.html
"As a general approach to 3D applications, a tree of QGLSceneNodes may be constructed, geometry added to them, materials and transformations applied, all during application initialization; and then by simply calling the draw() function the scene is easily rendered for each frame."
Sigh, well i was going to post the code but apparently i have more then 6k characters and that's making it grumpy... So D/L code from,