On 13 April 2017 at 14:38, Ch'Gans <chg...@gna.org> wrote: > Hi, > > I would like to be able to select at run-time how my entities are > rendered (ideally on a per entity basis). > I would like to have 3 choices: > - 1. wireframe > - 2. shaded > - 3. shaded + wireframe > > I had a look at the wire frame QML example, and translated it to C++. > The code is working. I have simplified the fragment shader, as i don't > need fancy light effect, other than a shaded color per face. > These shaders allow me to achieve 2 & 3. But my feeling is that i need > something completely different to render a 'transparent' wireframe > only. > Reading through OpenGL materials, it looks like i need things like > glPolygonMode, reading through Qt3D leads me to > QGeometryRenderer::PrimitiveType. > > But i am having problems connecting the dots. > PrimitiveType is a property of QGeometryRenderer, which means that it > is closely related with my buffer data and how the data are arranged > within the buffer. > So If i want to switch from 'shaded' to wireframe I need to change my > data (and my shader code too), surely there is to be a way to use the > same data buffer to achieve the 3 rendering modes. Should I use a 2 > passes rendering? The first one renders (or not) the face shades and > the second one renders (or not) the wireframes? Actually this should > even be a 3 passes: back of wireframe (or not), shaded faces (or not) > and front of wireframe (or not)... > Is this the right approach? Or should I instead define 3 materials and > simply switch the material as i want a different drawing style? > > Last thing is that my input data are triangulated polygon with holes, > but i have as well access to the original polygon with holes alone. > And i actually don't want to render the internal (triangulation) edges > of my polygonal faces (up and down) or rectangular faces (side ones). > So basically in shaded mode, i only need to calculate the color per > geometric face (as oppose to triangular face) ... > > PS: I've spent serious time yesterday reading through > https://learnopengl.com, although I think i now understand (way > better) how OpenGL works and how to use it, Qt3D seems to be way more > than a convenience wrapper around the OpenGL API. > I couldn't find a place in Qt3D where you would manipulate OpenGL > directly (eg calling glFooBar()). I am not even sure if it was design > too do this sort of things.
Answering myself partially: QRenderState provides lot of these. Eg.: glCullFace() => QCullFace, glFrontFace() => QFrontFace, ... Bu as far as i can understand OpenGL and Qt3D, i would say that Qt3D simply doesn't support the OpenGL polygon mode. Maybe because it's either sort-of deprecated, or there are other (better?) ways to do this sort of things... Chris > > > Thanks, > Chris _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest