Qt3D Reference Documentation

QGLCube Class Reference

The QGLCube class represents the geometry of simple six-sided cube in 3D space. More...

 #include <QGLCube>

This class was introduced in Qt3D 4.8.

Public Functions

QGLCube ( qreal size = 1.0f )
void setSize ( qreal size )
qreal size () const

Related Non-Members

QGLBuilder & operator<< ( QGLBuilder & builder, const QGLCube & cube )

Detailed Description

The QGLCube class represents the geometry of simple six-sided cube in 3D space.

The following example adds a cube of 2 units on a side to a geometry builder, and draws it at (10, 25, 0) in a QGLPainter:

 QGLBuilder list;
 list.newSection(QGL::Faceted);
 list << QGLCube(2);
 painter->translate(10, 25, 0);
 list.draw(painter);

QGLCube will create a default set of texture coordinates that shows the same texture of all six faces.

Member Function Documentation

QGLCube::QGLCube ( qreal size = 1.0f )

Constructs the geometry for a regular cube of size units on a side.

void QGLCube::setSize ( qreal size )

Sets the size of this cube.

See also size().

qreal QGLCube::size () const

Returns the size of this cube.

See also setSize().

Related Non-Members

QGLBuilder & operator<< ( QGLBuilder & builder, const QGLCube & cube )

Builds the geometry for cube within the specified geometry builder.

This operator specifies the positions, and 2D texture co-ordinates for all of the vertices that make up the cube. Normals will be calculated by the builder, depending on its current section's smoothing setting.