Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QGLSphere Class

The QGLSphere class represents the geometry of a simple sphere in 3D space. More...

 #include <QGLSphere>

This class was introduced in Qt 4.8.

Public Functions

QGLSphere(qreal diameter = 1.0f, int depth = 5)
virtual ~QGLSphere()
qreal diameter() const
void setDiameter(qreal diameter)
void setSubdivisionDepth(int depth)
int subdivisionDepth() const

Detailed Description

The QGLSphere class represents the geometry of a simple sphere in 3D space.

The following example creates a sphere of 2 units in diameter and draws it at (10, 25, 0) in a QGLPainter:

 QGLBuilder builder;
 builder << QGLSphere(2);
 QGLSceneNode *node = builder.finalizedSceneNode();

 painter.translate(10, 25, 0);
 node->draw(&painter);

The QGLSphere class specifies positions, normals and 2D texture co-ordinates for all of the vertices that make up the sphere.

The texture co-ordinates are fixed at construction time. This is because constructing the sphere can involve generating additional vertices which need to interpolate the texture co-ordinates of their neighboring vertices.

The default mode of QGLSphere is a "UV sphere", which divides the sphere up into longitudinal and latitudinal sections. The longitudinal slices meet at the poles, which in a single unit sphere are defined to be at (0, 0, +0.5) and (0, 0, -0.5). This choice is the simplest to texture map as the texture will only distort along the x-axis of the 2D texture. However the density of vertices is significantly higher at the poles than it is elsewhere on the sphere and is a poor choice if a uniform density of pixels from the texture map is required.

See also QGLBuilder.

Member Function Documentation

QGLSphere::QGLSphere(qreal diameter = 1.0f, int depth = 5)

Creates a sphere of diameter across (default is 1). When the sphere is recursively subdivided into triangles, it will be subdivided no more than depth times (between 1 and 10, default is 5).

QGLSphere::~QGLSphere() [virtual]

Destroys this sphere object.

qreal QGLSphere::diameter() const

Returns the diameter of this sphere. The default is 1.

See also setDiameter().

void QGLSphere::setDiameter(qreal diameter)

Sets the diameter of this sphere to diameter.

See also diameter().

void QGLSphere::setSubdivisionDepth(int depth)

Sets the maximum depth when this sphere is subdivided into triangles.

See also subdivisionDepth().

int QGLSphere::subdivisionDepth() const

Returns the maximum depth when this sphere is subdivided into triangles. The default is 5. The following picture shows the effect of depth values between 1 and 10 for a UV sphere:

Level of DetailNumber of Triangles
164
2128
3256
4512
51024
62048
74096
88192
916384
1032768

See also setSubdivisionDepth().

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web