Showing posts with label Qt. Show all posts
Showing posts with label Qt. Show all posts

Friday, 14 March 2014

OpenGL Sandbox - My first shader

Here it is the rendering of the Utah Teapot and the Stanford Dragon rendered with my first shader. 



It's a very simple shader and it does not create any light source in the scene. The depth perception is given by the coloration of the triangles. As you can see in the teapot image, each triangle is colored using a blend of the axes color given by the triangle's normal vector.

The shader's code is straightforward:


Here below the code which passes the vertex attributes to the shader is presented. Qt helper classes are a good choice in order to write quickly a more readable code. For this reason I will use this approach whenever it's possible

Tuesday, 25 February 2014

My first OpenGL application

After a 2-years work in the field of 3D reconstruction, computational geometry and 3D modeling I've realized that I need to learn also a little bit of rendering as well. During my free time I have watched several online video lectures and started the online course "Interactive 3D Graphics" on Udacity.

I've decided to use OpenGL as rendering API, because it is multiplatform and easily extendable to the Web application thanks to WebGL and Three.js

The first thing to do is to buy the Red Book of OpenGl.Another useful way to start is the video lecture, available in the SIGGRAPH University program, called "An Introduction to OpenGL Programming".

After some reading and watching I've created my first application. Although I just started from the "hellogl" test I alredy reorganized the code in order to make it easier to add new tests and so on.



The next step is to create the "Hello world" test that could only be the rendering of the Utah Teapot!


PS: for the lazy people here's the video lecture that I mentioned before