Modern OpenGL pipeline implementation in Qt
-
Hi all.I am new to -QT- Qt and I need to develop a desktop app with GUI which utilizes OpenGL 3x (modern not fixed pipeline ). I read the docs and the OpenGL examples seem to be fixed pipeline. Does -QT- Qt at all supports OpenGL 3.1/4.1 version ? Are there any examples on how to load vert/frag shaders, create buffers and programs "-QT- Qt way" ?
Thanks .
-
Hi,
take a look at "Qt 3D":http://doc.qt.nokia.com/qt3d-snapshot/index.html and "QGLShaderProgram":http://doc.trolltech.com/4.7-snapshot/qglshaderprogram.html
I think this will help you. -
Well I did give you example of which uses programmable pipeline. :)
-
My recommendation for VBO, use 'packed' vertices with stride parameter.
-
You have packed vertices in one array of this struct:
@Struct Vertex {
float x, y, z;
float nx, ny, nz;
float some_vertex_attribute;
}@Which has size, 28 bytes, if I am not wrong.
Stride parameter is byte offset between consecutive vertices, then for example, x, y, z (vertex pos) stride would be, you guess, 28 bytes: the driver would take three floats, and then will jump 28 bytes, take three floats, then jump, etc...
I hope you understand.
-
I think I got you.You mean packing different data for the vertex buffer in a single vertex array.Like vertices positions,color, like :
@
GLfloat vertAndColors[]={
23.0f,12.0f,23.43f,/vertex 1 /0.23f,0.75f,1.0f.1.0f / RGBA color for that vertex/ ,
....
......
........
}
@
?