Commit 7947d743 authored by Oliver Bock's avatar Oliver Bock

Show pulsar as wireframe model (without texture)

parent b5c71b20
...@@ -63,7 +63,6 @@ PulsarAnimationWidget::PulsarAnimationWidget(QWidget *parent) : ...@@ -63,7 +63,6 @@ PulsarAnimationWidget::PulsarAnimationWidget(QWidget *parent) :
m_quadricPulsarMagneticAxis = NULL; m_quadricPulsarMagneticAxis = NULL;
// initialize texture pointers // initialize texture pointers
m_pulsarTexture = 0;
m_backgroundTexture = 0; m_backgroundTexture = 0;
// initial render timing settings // initial render timing settings
...@@ -115,7 +114,6 @@ PulsarAnimationWidget::~PulsarAnimationWidget() ...@@ -115,7 +114,6 @@ PulsarAnimationWidget::~PulsarAnimationWidget()
if(m_quadricPulsarSpinAxis) gluDeleteQuadric(m_quadricPulsarSpinAxis); if(m_quadricPulsarSpinAxis) gluDeleteQuadric(m_quadricPulsarSpinAxis);
if(m_quadricPulsarMagneticAxis) gluDeleteQuadric(m_quadricPulsarMagneticAxis); if(m_quadricPulsarMagneticAxis) gluDeleteQuadric(m_quadricPulsarMagneticAxis);
if(m_pulsarTexture) deleteTexture(m_pulsarTexture);
if(m_backgroundTexture) deleteTexture(m_backgroundTexture); if(m_backgroundTexture) deleteTexture(m_backgroundTexture);
} }
...@@ -177,24 +175,6 @@ void PulsarAnimationWidget::initializeGL() ...@@ -177,24 +175,6 @@ void PulsarAnimationWidget::initializeGL()
QString msgPower = tr("%1 texture dimensions not a power of 2!"); QString msgPower = tr("%1 texture dimensions not a power of 2!");
QString msgSize = tr("Maximum texture size exceeded! Scaling down %1 texture to %2x%3..."); QString msgSize = tr("Maximum texture size exceeded! Scaling down %1 texture to %2x%3...");
// prepare and check pulsar texture
QImage pulsarTexture(":/textures/resources/texture_pulsar.png");
if(pulsarTexture.width() != pulsarTexture.height()) {
qWarning() << msgShape.arg(tr("Pulsar"));
}
else {
double integer = 0.0;
double fraction = 0.0;
fraction = modf(log(pulsarTexture.width()) / log(2.0), &integer);
if(fraction > 0.0) {
qWarning() << msgPower.arg(tr("Pulsar"));
}
}
if(pulsarTexture.width() > maxTextureSize) {
qWarning() << msgSize.arg(tr("pulsar").arg(maxTextureSize).arg(maxTextureSize));
pulsarTexture = pulsarTexture.scaled(maxTextureSize, maxTextureSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
}
// prepare and check background texture // prepare and check background texture
QImage backgroundTexture(":/textures/resources/texture_background_carina.png"); QImage backgroundTexture(":/textures/resources/texture_background_carina.png");
if(backgroundTexture.width() != backgroundTexture.height()) { if(backgroundTexture.width() != backgroundTexture.height()) {
...@@ -214,7 +194,6 @@ void PulsarAnimationWidget::initializeGL() ...@@ -214,7 +194,6 @@ void PulsarAnimationWidget::initializeGL()
} }
// bind textures // bind textures
m_pulsarTexture = bindTexture(pulsarTexture, GL_TEXTURE_2D, GL_RGBA);
m_backgroundTexture = bindTexture(backgroundTexture, GL_TEXTURE_2D, GL_RGBA); m_backgroundTexture = bindTexture(backgroundTexture, GL_TEXTURE_2D, GL_RGBA);
// use mipmapped textures // use mipmapped textures
...@@ -284,33 +263,27 @@ void PulsarAnimationWidget::paintGL() ...@@ -284,33 +263,27 @@ void PulsarAnimationWidget::paintGL()
{ {
glRotatef(m_pulsarSpinAxisInclination, 0.0, 0.0, 1.0); glRotatef(m_pulsarSpinAxisInclination, 0.0, 0.0, 1.0);
glRotatef(m_pulsarRotationAngle, 0.0, 1.0, 0.0); glRotatef(m_pulsarRotationAngle, 0.0, 1.0, 0.0);
glRotatef(90, 0.0, 0.0, 0.0);
// draw spin axis // draw spin axis
if(m_showRotationAxes) { if(m_showRotationAxes) {
glPushMatrix(); glPushMatrix();
{ {
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, translucent); glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, translucent);
glRotatef(90.0, 1.0, 0.0, 0.0);
glTranslatef(0.0, 0.0, -5.0); glTranslatef(0.0, 0.0, -5.0);
gluCylinder(m_quadricPulsarSpinAxis, 0.05, 0.05, 10.0, 32, 1); gluCylinder(m_quadricPulsarSpinAxis, 0.05, 0.05, 10.0, 32, 1);
glMaterialfv(GL_FRONT, GL_AMBIENT, no_mat);
glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
} }
glPopMatrix(); glPopMatrix();
} }
// create texture coordinates and enable texturing // enable wireframe mode
glEnable(GL_TEXTURE_GEN_S); glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
glEnable(GL_TEXTURE_GEN_T); // draw pulsar
glBindTexture(GL_TEXTURE_2D, m_pulsarTexture);
glEnable(GL_TEXTURE_2D);
glMaterialfv(GL_FRONT, GL_AMBIENT, no_mat);
glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
gluSphere(m_quadricPulsar, 1.0, 32, 32); gluSphere(m_quadricPulsar, 1.0, 32, 32);
// disable wireframe mode
// disable texturing glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glDisable(GL_TEXTURE_2D);
} }
glPopMatrix(); glPopMatrix();
......
...@@ -89,7 +89,6 @@ private: ...@@ -89,7 +89,6 @@ private:
GLUquadricObj *m_quadricPulsarSpinAxis; GLUquadricObj *m_quadricPulsarSpinAxis;
GLUquadricObj *m_quadricPulsarMagneticAxis; GLUquadricObj *m_quadricPulsarMagneticAxis;
GLuint m_pulsarTexture;
GLuint m_backgroundTexture; GLuint m_backgroundTexture;
int m_framesPerSecond; int m_framesPerSecond;
......
<RCC> <RCC>
<qresource prefix="icons" > <qresource prefix="/icons">
<file>resources/control-pause.png</file> <file>resources/control-pause.png</file>
<file>resources/control-quit.png</file> <file>resources/control-quit.png</file>
<file>resources/control-run.png</file> <file>resources/control-run.png</file>
<file>resources/control-stop.png</file> <file>resources/control-stop.png</file>
<file>resources/help-about.png</file> <file>resources/help-about.png</file>
<file>resources/help-help.png</file> <file>resources/help-help.png</file>
<file>resources/help-website.png</file> <file>resources/help-website.png</file>
<file>resources/aei-icon48.png</file> <file>resources/aei-icon48.png</file>
</qresource> </qresource>
<qresource prefix="i18ns" > <qresource prefix="/i18ns">
<file>resources/pulsatingscience_de.qm</file> <file>resources/pulsatingscience_de.qm</file>
</qresource> </qresource>
<qresource prefix="textures" > <qresource prefix="/textures">
<file>resources/texture_background_carina.png</file> <file>resources/texture_background_carina.png</file>
<file>resources/texture_pulsar.png</file> </qresource>
</qresource>
</RCC> </RCC>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment