сабж.
#include "scene.h"
#include <QWidget>
#include <QtOpenGL>
Scene3d::Scene3d(QWidget *obj)
{
}
void Scene3d::initializeGL()
{
qglClearColor(Qt::white);
glEnable(GL_DEPTH_TEST|GL_CULL_FACE|GL_DOUBLE);
}
void Scene3d::resizeGL(int w, int h)
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(65.0,w/h,1,100);
glViewport(0,0,(GLint)w,(GLint)h);
}
void Scene3d::paintGL()
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glFrontFace(GL_CCW);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor4f(0.5,0.2,0.2,0.5);
glInit();
glBegin(GL_TRIANGLES);
glVertex3f(0,0,2);
glVertex3f(5,5,5);
glVertex3f(-5,-5,2);
glEnd();
updateGL();
}