mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-06 11:10:44 +00:00
Slightly more pointless fun
This commit is contained in:
parent
06e892b53b
commit
030c165ed0
@ -1824,7 +1824,26 @@ gGraphView::gGraphView(QWidget *parent, gGraphView * shared) :
|
|||||||
//redrawtimer->setInterval(80);
|
//redrawtimer->setInterval(80);
|
||||||
//redrawtimer->start();
|
//redrawtimer->start();
|
||||||
connect(redrawtimer,SIGNAL(timeout()),SLOT(repaint()));
|
connect(redrawtimer,SIGNAL(timeout()),SLOT(repaint()));
|
||||||
|
QImage *image=new QImage(":/icons/oximeter.png");
|
||||||
|
images.push_back(image);
|
||||||
|
|
||||||
|
image=new QImage(":/docs/sheep.png");
|
||||||
|
images.push_back(image);
|
||||||
|
|
||||||
|
image=new QImage(":/icons/sdcard.png");
|
||||||
|
images.push_back(image);
|
||||||
|
|
||||||
|
image=new QImage(":/icons/preferences.png");
|
||||||
|
images.push_back(image);
|
||||||
|
|
||||||
|
image=new QImage(":/icons/overview.png");
|
||||||
|
images.push_back(image);
|
||||||
|
|
||||||
|
image=new QImage(":/icons/edit-find.png");
|
||||||
|
images.push_back(image);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gGraphView::~gGraphView()
|
gGraphView::~gGraphView()
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_THREADED_DRAWING
|
#ifdef ENABLE_THREADED_DRAWING
|
||||||
@ -1849,6 +1868,9 @@ gGraphView::~gGraphView()
|
|||||||
disconnect(timer,0,0,0);
|
disconnect(timer,0,0,0);
|
||||||
timer->stop();
|
timer->stop();
|
||||||
delete timer;
|
delete timer;
|
||||||
|
for (int i=0;i<images.size();i++) {
|
||||||
|
delete images[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void gGraphView::DrawTextQue()
|
void gGraphView::DrawTextQue()
|
||||||
{
|
{
|
||||||
@ -2124,6 +2146,14 @@ void gGraphView::initializeGL()
|
|||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
texid.resize(images.size());
|
||||||
|
for(int i=0;i<images.size();i++) {
|
||||||
|
texid[i]=bindTexture(*images[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
glBindTexture(GL_TEXTURE_2D,0);
|
||||||
|
// glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gGraphView::resizeGL(int w, int h)
|
void gGraphView::resizeGL(int w, int h)
|
||||||
@ -2139,7 +2169,7 @@ void gGraphView::resizeGL(int w, int h)
|
|||||||
|
|
||||||
void gGraphView::renderSomethingFun()
|
void gGraphView::renderSomethingFun()
|
||||||
{
|
{
|
||||||
//glPushMatrix();
|
// glPushMatrix();
|
||||||
float w=width();
|
float w=width();
|
||||||
float h=height();
|
float h=height();
|
||||||
glViewport(0, 0, w, h);
|
glViewport(0, 0, w, h);
|
||||||
@ -2150,7 +2180,7 @@ void gGraphView::renderSomethingFun()
|
|||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
glShadeModel(GL_SMOOTH);
|
glShadeModel(GL_SMOOTH);
|
||||||
glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
|
glClearColor(1.0f, 0.4f, 0.2f, 0.5f);
|
||||||
glClearDepth(1.0f);
|
glClearDepth(1.0f);
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
glDepthFunc(GL_LEQUAL);
|
glDepthFunc(GL_LEQUAL);
|
||||||
@ -2162,47 +2192,86 @@ void gGraphView::renderSomethingFun()
|
|||||||
|
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
glTranslatef(0.0f, 0.0f,-7.0f);
|
|
||||||
glRotatef(rotqube,0.0f,1.0f,0.0f);
|
//glAlphaFunc(GL_GREATER,0.1);
|
||||||
glRotatef(rotqube,1.0f,1.0f,1.0f);
|
glEnable(GL_ALPHA_TEST);
|
||||||
|
glEnable(GL_CULL_FACE);
|
||||||
|
//glDisable(GL_COLOR_MATERIAL);
|
||||||
|
|
||||||
|
int imgcount=6;
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
|
glTranslatef(0.0f, 0.0f,-7.0f);
|
||||||
|
glRotatef(rotqube,0.0f,1.0f,0.0f);
|
||||||
|
glRotatef(rotqube,1.0f,1.0f,1.0f);
|
||||||
|
|
||||||
|
int i=0;
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, texid[i % imgcount]);
|
||||||
|
i++;
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
float alpha=0.08;
|
glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Left Of The Texture and Quad
|
||||||
glColor4f(0.0f,1.0f,0.0f,alpha); // Color Blue
|
glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f); // Bottom Right Of The Texture and Quad
|
||||||
glVertex3f( 1.0f, 1.0f,-1.0f); // Top Right Of The Quad (Top)
|
glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f); // Top Right Of The Texture and Quad
|
||||||
glVertex3f(-1.0f, 1.0f,-1.0f); // Top Left Of The Quad (Top)
|
glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f); // Top Left Of The Texture and Quad
|
||||||
glVertex3f(-1.0f, 1.0f, 1.0f); // Bottom Left Of The Quad (Top)
|
|
||||||
glVertex3f( 1.0f, 1.0f, 1.0f); // Bottom Right Of The Quad (Top)
|
|
||||||
glColor4f(1.0f,0.5f,0.0f,alpha); // Color Orange
|
|
||||||
glVertex3f( 1.0f,-1.0f, 1.0f); // Top Right Of The Quad (Bottom)
|
|
||||||
glVertex3f(-1.0f,-1.0f, 1.0f); // Top Left Of The Quad (Bottom)
|
|
||||||
glVertex3f(-1.0f,-1.0f,-1.0f); // Bottom Left Of The Quad (Bottom)
|
|
||||||
glVertex3f( 1.0f,-1.0f,-1.0f); // Bottom Right Of The Quad (Bottom)
|
|
||||||
glColor4f(1.0f,0.0f,0.0f,alpha); // Color Red
|
|
||||||
glVertex3f( 1.0f, 1.0f, 1.0f); // Top Right Of The Quad (Front)
|
|
||||||
glVertex3f(-1.0f, 1.0f, 1.0f); // Top Left Of The Quad (Front)
|
|
||||||
glVertex3f(-1.0f,-1.0f, 1.0f); // Bottom Left Of The Quad (Front)
|
|
||||||
glVertex3f( 1.0f,-1.0f, 1.0f); // Bottom Right Of The Quad (Front)
|
|
||||||
glColor4f(1.0f,1.0f,0.0f,alpha); // Color Yellow
|
|
||||||
glVertex3f( 1.0f,-1.0f,-1.0f); // Top Right Of The Quad (Back)
|
|
||||||
glVertex3f(-1.0f,-1.0f,-1.0f); // Top Left Of The Quad (Back)
|
|
||||||
glVertex3f(-1.0f, 1.0f,-1.0f); // Bottom Left Of The Quad (Back)
|
|
||||||
glVertex3f( 1.0f, 1.0f,-1.0f); // Bottom Right Of The Quad (Back)
|
|
||||||
glColor4f(0.0f,0.0f,1.0f,alpha); // Color Blue
|
|
||||||
glVertex3f(-1.0f, 1.0f, 1.0f); // Top Right Of The Quad (Left)
|
|
||||||
glVertex3f(-1.0f, 1.0f,-1.0f); // Top Left Of The Quad (Left)
|
|
||||||
glVertex3f(-1.0f,-1.0f,-1.0f); // Bottom Left Of The Quad (Left)
|
|
||||||
glVertex3f(-1.0f,-1.0f, 1.0f); // Bottom Right Of The Quad (Left)
|
|
||||||
glColor4f(1.0f,0.0f,1.0f,alpha); // Color Violet
|
|
||||||
glVertex3f( 1.0f, 1.0f,-1.0f); // Top Right Of The Quad (Right)
|
|
||||||
glVertex3f( 1.0f, 1.0f, 1.0f); // Top Left Of The Quad (Right)
|
|
||||||
glVertex3f( 1.0f,-1.0f, 1.0f); // Bottom Left Of The Quad (Right)
|
|
||||||
glVertex3f( 1.0f,-1.0f,-1.0f); // Bottom Right Of The Quad (Right)
|
|
||||||
glEnd();
|
glEnd();
|
||||||
|
// Back Face
|
||||||
|
glBindTexture(GL_TEXTURE_2D, texid[i % imgcount]);
|
||||||
|
i++;
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f); // Bottom Right Of The Texture and Quad
|
||||||
|
glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); // Top Right Of The Texture and Quad
|
||||||
|
glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f); // Top Left Of The Texture and Quad
|
||||||
|
glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f); // Bottom Left Of The Texture and Quad
|
||||||
|
glEnd();
|
||||||
|
// Top Face
|
||||||
|
glBindTexture(GL_TEXTURE_2D, texid[i % imgcount]);
|
||||||
|
i++;
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); // Top Left Of The Texture and Quad
|
||||||
|
glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, 1.0f, 1.0f); // Bottom Left Of The Texture and Quad
|
||||||
|
glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, 1.0f, 1.0f); // Bottom Right Of The Texture and Quad
|
||||||
|
glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f); // Top Right Of The Texture and Quad
|
||||||
|
glEnd();
|
||||||
|
// Bottom Face
|
||||||
|
glBindTexture(GL_TEXTURE_2D, texid[i % imgcount]);
|
||||||
|
i++;
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f, -1.0f); // Top Right Of The Texture and Quad
|
||||||
|
glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f, -1.0f); // Top Left Of The Texture and Quad
|
||||||
|
glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f); // Bottom Left Of The Texture and Quad
|
||||||
|
glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Right Of The Texture and Quad
|
||||||
|
glEnd();
|
||||||
|
// Right face
|
||||||
|
glBindTexture(GL_TEXTURE_2D, texid[i % imgcount]);
|
||||||
|
i++;
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f); // Bottom Right Of The Texture and Quad
|
||||||
|
glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f); // Top Right Of The Texture and Quad
|
||||||
|
glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f); // Top Left Of The Texture and Quad
|
||||||
|
glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f); // Bottom Left Of The Texture and Quad
|
||||||
|
glEnd();
|
||||||
|
// Left Face
|
||||||
|
glBindTexture(GL_TEXTURE_2D, texid[i % imgcount]);
|
||||||
|
i++;
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f); // Bottom Left Of The Texture and Quad
|
||||||
|
glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Right Of The Texture and Quad
|
||||||
|
glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f); // Top Right Of The Texture and Quad
|
||||||
|
glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); // Top Left Of The Texture and Quad
|
||||||
|
glEnd();
|
||||||
|
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
|
//glBindTexture(GL_TEXTURE_2D, texid[0]);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
|
||||||
|
glDisable(GL_ALPHA_TEST);
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
glDisable(GL_CULL_FACE);
|
||||||
|
|
||||||
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
rotqube +=0.9f;
|
rotqube +=0.9f;
|
||||||
|
|
||||||
@ -2214,7 +2283,8 @@ void gGraphView::renderSomethingFun()
|
|||||||
glOrtho(0, width(), height(), 0, -1, 1);
|
glOrtho(0, width(), height(), 0, -1, 1);
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glDisable(GL_DEPTH_TEST);
|
|
||||||
|
// glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
void gGraphView::paintGL()
|
void gGraphView::paintGL()
|
||||||
@ -2326,6 +2396,9 @@ void gGraphView::paintGL()
|
|||||||
int x,y;
|
int x,y;
|
||||||
GetTextExtent(m_emptytext,x,y,bigfont);
|
GetTextExtent(m_emptytext,x,y,bigfont);
|
||||||
AddTextQue(m_emptytext,(width()/2)-x/2,(height()/2)+y/2,0.0,col,bigfont);
|
AddTextQue(m_emptytext,(width()/2)-x/2,(height()/2)+y/2,0.0,col,bigfont);
|
||||||
|
|
||||||
|
if (something_fun && this->isVisible())
|
||||||
|
renderSomethingFun();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2360,7 +2433,7 @@ void gGraphView::paintGL()
|
|||||||
//glDisable(GL_TEXTURE_2D);
|
//glDisable(GL_TEXTURE_2D);
|
||||||
//glDisable(GL_DEPTH_TEST);
|
//glDisable(GL_DEPTH_TEST);
|
||||||
if (something_fun && !numgraphs && this->isVisible()) {
|
if (something_fun && !numgraphs && this->isVisible()) {
|
||||||
renderSomethingFun();
|
// renderSomethingFun();
|
||||||
|
|
||||||
redrawtimer->setInterval(25);
|
redrawtimer->setInterval(25);
|
||||||
redrawtimer->setSingleShot(true);
|
redrawtimer->setSingleShot(true);
|
||||||
|
@ -904,6 +904,9 @@ protected:
|
|||||||
|
|
||||||
qint64 m_minx,m_maxx;
|
qint64 m_minx,m_maxx;
|
||||||
float print_scaleX,print_scaleY;
|
float print_scaleX,print_scaleY;
|
||||||
|
|
||||||
|
QVector<QImage *> images;
|
||||||
|
QVector<GLuint> texid;
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user