Commit 36bc56a1 authored by Oliver Bock's avatar Oliver Bock
Browse files

Added Earth texture (instead of wireframe and lighting)

parent 3484fe10
...@@ -209,22 +209,7 @@ void PulsarAnimationWidget::initializeGL() ...@@ -209,22 +209,7 @@ void PulsarAnimationWidget::initializeGL()
} }
// prepare and check beam texture // prepare and check beam texture
QImage beamTexture(":/textures/resources/texture_beam.png"); QImage beamTexture(":/textures/resources/World-Map-7.jpg");
if(beamTexture.width() != beamTexture.height()) {
qWarning() << msgShape.arg(tr("Beam"));
}
else {
double integer = 0.0;
double fraction = 0.0;
fraction = modf(log(beamTexture.width()) / log(2.0), &integer);
if(fraction > 0.0) {
qWarning() << msgPower.arg(tr("Beam"));
}
}
if(beamTexture.width() > maxTextureSize) {
qWarning() << msgSize.arg(tr("beam").arg(maxTextureSize).arg(maxTextureSize));
beamTexture = beamTexture.scaled(maxTextureSize, maxTextureSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
}
// bind textures // bind textures
m_backgroundTexture = bindTexture(backgroundTexture, GL_TEXTURE_2D, GL_RGBA); m_backgroundTexture = bindTexture(backgroundTexture, GL_TEXTURE_2D, GL_RGBA);
...@@ -286,7 +271,7 @@ void PulsarAnimationWidget::paintGL() ...@@ -286,7 +271,7 @@ void PulsarAnimationWidget::paintGL()
glLoadIdentity(); glLoadIdentity();
// draw backdrop (independent parallel projection) // draw backdrop (independent parallel projection)
glColor3f(0.5, 0.5, 0.5f); glColor3f(1.0, 1.0, 1.0f);
glTranslatef(0.0, 0.0, -501.0); glTranslatef(0.0, 0.0, -501.0);
// restore original state // restore original state
...@@ -297,25 +282,25 @@ void PulsarAnimationWidget::paintGL() ...@@ -297,25 +282,25 @@ void PulsarAnimationWidget::paintGL()
} }
glPopMatrix(); glPopMatrix();
// enable wireframe mode
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
// draw earth // draw earth
glPushMatrix(); glPushMatrix();
{
glRotatef(130, 0.0, 1.0, 0.0);
glPushMatrix();
{ {
glRotatef(90, 1.0, 0.0, 0.0); glRotatef(90, 1.0, 0.0, 0.0);
glRotatef(180, 1.0, 1.0, 0.0);
// create texture coordinates and enable texturing
gluQuadricTexture(m_quadricPulsar, GL_TRUE);
glBindTexture(GL_TEXTURE_2D, m_beamTexture);
glEnable(GL_TEXTURE_2D);
// draw sphere, with proper lighting
glEnable(GL_LIGHTING);
glMaterialfv(GL_FRONT, GL_AMBIENT, no_mat);
glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
gluSphere(m_quadricPulsar, m_pulsarRadius, 32, 32); gluSphere(m_quadricPulsar, m_pulsarRadius, 32, 32);
glDisable(GL_LIGHTING);
} }
glPopMatrix(); glPopMatrix();
}
// back to solid rendering glPopMatrix();
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
// draw source // draw source
glPushMatrix(); glPushMatrix();
......
...@@ -15,5 +15,6 @@ ...@@ -15,5 +15,6 @@
<qresource prefix="/textures"> <qresource prefix="/textures">
<file>resources/texture_background_carina.png</file> <file>resources/texture_background_carina.png</file>
<file>resources/texture_beam.png</file> <file>resources/texture_beam.png</file>
<file>resources/World-Map-7.jpg</file>
</qresource> </qresource>
</RCC> </RCC>
Supports Markdown
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