Skip to content
Snippets Groups Projects
Commit 36bc56a1 authored by Oliver Bock's avatar Oliver Bock
Browse files

Added Earth texture (instead of wireframe and lighting)

parent 3484fe10
Branches
No related tags found
No related merge requests found
......@@ -209,22 +209,7 @@ void PulsarAnimationWidget::initializeGL()
}
// prepare and check beam texture
QImage beamTexture(":/textures/resources/texture_beam.png");
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);
}
QImage beamTexture(":/textures/resources/World-Map-7.jpg");
// bind textures
m_backgroundTexture = bindTexture(backgroundTexture, GL_TEXTURE_2D, GL_RGBA);
......@@ -286,7 +271,7 @@ void PulsarAnimationWidget::paintGL()
glLoadIdentity();
// 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);
// restore original state
......@@ -297,25 +282,25 @@ void PulsarAnimationWidget::paintGL()
}
glPopMatrix();
// enable wireframe mode
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
// draw earth
glPushMatrix();
{
glRotatef(130, 0.0, 1.0, 0.0);
glPushMatrix();
{
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);
glDisable(GL_LIGHTING);
}
glPopMatrix();
// back to solid rendering
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
}
glPopMatrix();
// draw source
glPushMatrix();
......
......@@ -15,5 +15,6 @@
<qresource prefix="/textures">
<file>resources/texture_background_carina.png</file>
<file>resources/texture_beam.png</file>
<file>resources/World-Map-7.jpg</file>
</qresource>
</RCC>
src/resources/World-Map-7.jpg

1.22 MiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment