...
#include "glwidget.h"
#include "motion.h"
#include "MainWindow.h"
#include <GL/glut.h>
...
void GLWidget::initializeGL()
{
glClearColor(1.0,1.0,1.0,1.0);
GLUquadricObj *qobj = gluNewQuadric();
gluQuadricDrawStyle(qobj,GLU_FILL);
gluQuadricNormals(qobj,GLU_SMOOTH);
glClearDepth( 1.0f );
glEnable(GL_DEPTH_TEST);
glShadeModel(GL_SMOOTH);
double eqn[] = {0.01f,0.0f,0.01f,-1.0f};// enable clip plane
glClipPlane(GL_CLIP_PLANE0,eqn);
setupLight();
}
void GLWidget::paintGL()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glTranslatef(0.0, 0.0, -5.0);
glRotatef(xRot / 16.0, 1.0, 0.0, 0.0);
glRotatef(yRot / 16.0, 0.0, 1.0, 0.0);
glRotatef(zRot / 16.0, 0.0, 0.0, 1.0);
//glTranslated(xTrans / 20.0, yTrans/ 20.0, 0.0f);
glScalef(scale, scale, 1.0);
m.drawControlFunction();
glPopMatrix();
}
//ok for now
void GLWidget::resizeGL(int w, int h){
int side = qMin(w, h);
double ratio = (double)w/(double)h;
//glViewport((w - side) / 2, (h - side) / 2, side, side);
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(70.0f, ratio, 0.1f, 1000.0f);
// glOrtho(-15.0, +15.0, -10.0, +15.0, 1.0, 15.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity ();
glTranslatef(0.0f, 0.0f, -10.0f);
}
...
void GLWidget::updateScreen(void)
{
qDebug()<<"Im working";
updateGL();
update();
repaint();
}
...
#include "glwidget.h"
#include "motion.h"
#include "MainWindow.h"
#include <GL/glut.h>
...
void GLWidget::initializeGL()
{
glClearColor(1.0,1.0,1.0,1.0);
GLUquadricObj *qobj = gluNewQuadric();
gluQuadricDrawStyle(qobj,GLU_FILL);
gluQuadricNormals(qobj,GLU_SMOOTH);
glClearDepth( 1.0f );
glEnable(GL_DEPTH_TEST);
glShadeModel(GL_SMOOTH);
double eqn[] = {0.01f,0.0f,0.01f,-1.0f};// enable clip plane
glClipPlane(GL_CLIP_PLANE0,eqn);
setupLight();
}
void GLWidget::paintGL()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glTranslatef(0.0, 0.0, -5.0);
glRotatef(xRot / 16.0, 1.0, 0.0, 0.0);
glRotatef(yRot / 16.0, 0.0, 1.0, 0.0);
glRotatef(zRot / 16.0, 0.0, 0.0, 1.0);
//glTranslated(xTrans / 20.0, yTrans/ 20.0, 0.0f);
glScalef(scale, scale, 1.0);
m.drawControlFunction();
glPopMatrix();
}
//ok for now
void GLWidget::resizeGL(int w, int h){
int side = qMin(w, h);
double ratio = (double)w/(double)h;
//glViewport((w - side) / 2, (h - side) / 2, side, side);
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(70.0f, ratio, 0.1f, 1000.0f);
// glOrtho(-15.0, +15.0, -10.0, +15.0, 1.0, 15.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity ();
glTranslatef(0.0f, 0.0f, -10.0f);
}
...
void GLWidget::updateScreen(void)
{
qDebug()<<"Im working";
updateGL();
update();
repaint();
}
To copy to clipboard, switch view to plain text mode
Bookmarks