[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeedu/kstars/kstars
From: Akarsh Simha <akarshsimha () gmail ! com>
Date: 2011-01-01 4:27:31
Message-ID: 20110101042731.D2CD0AC8B4 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1210556 by asimha:
Fix missing OpenGL checks
M +3 -0 skymap.cpp
M +7 -3 texture.cpp
M +2 -0 texture.h
M +7 -1 texturemanager.cpp
M +7 -0 texturemanager.h
--- trunk/KDE/kdeedu/kstars/kstars/skymap.cpp #1210555:1210556
@@ -61,7 +61,10 @@
#include "texturemanager.h"
#include "skymapqdraw.h"
+
+#ifdef HAVE_OPENGL
#include "skymapgldraw.h"
+#endif
#ifdef HAVE_XPLANET
#include <KProcess>
--- trunk/KDE/kdeedu/kstars/kstars/texture.cpp #1210555:1210556
@@ -22,26 +22,28 @@
#include "skymap.h"
#include "Options.h"
-#if HAVE_OPENGL
+#ifdef HAVE_OPENGL
#include <QGLContext>
#endif
Texture::Texture(QObject* parent): QObject(parent)
{
m_ready = false;
+#ifdef HAVE_OPENGL
m_tid = 0;
+#endif
}
+#ifdef HAVE_OPENGL
bool Texture::bind() const
{
- #ifdef HAVE_OPENGL
if( m_ready && Options::useGL() ) {
glBindTexture(GL_TEXTURE_2D, m_tid);
return true;
} else
- #endif
return false;
}
+#endif
const QImage& Texture::image() const
{
@@ -57,7 +59,9 @@
{
m_image = img;
m_ready = true;
+#ifdef HAVE_OPENGL
genTexture();
+#endif
}
#ifdef HAVE_OPENGL
--- trunk/KDE/kdeedu/kstars/kstars/texture.h #1210555:1210556
@@ -56,7 +56,9 @@
private:
QImage m_image;
bool m_ready;
+ #ifdef HAVE_OPENGL
GLuint m_tid;
+ #endif
};
#endif // KSTEXTURE_H
--- trunk/KDE/kdeedu/kstars/kstars/texturemanager.cpp #1210555:1210556
@@ -23,10 +23,12 @@
#include <kstandarddirs.h>
+#ifdef HAVE_OPENGL
#include <QGLWidget>
+QGLContext* TextureManager::m_context = 0;
+#endif
TextureManager* TextureManager::m_p;
-QGLContext* TextureManager::m_context = 0;
const Texture* TextureManager::getTexture(const QString& name)
{
@@ -48,6 +50,7 @@
return tex;
}
+#ifdef HAVE_OPENGL
void TextureManager::genTextures()
{
//If there's no instance, there are no textures to bind!
@@ -61,12 +64,15 @@
(*it)->genTexture();
}
}
+#endif
TextureManager *TextureManager::Create() {
if( !m_p )
m_p = new TextureManager( KStars::Instance() );
+#ifdef HAVE_OPENGL
if( !m_context )
m_context = new QGLContext( QGLFormat(QGL::SampleBuffers) );
+#endif
return m_p;
}
--- trunk/KDE/kdeedu/kstars/kstars/texturemanager.h #1210555:1210556
@@ -39,6 +39,8 @@
@return a pointer to the texture
*/
static const Texture* getTexture(const QString& name);
+
+#ifdef HAVE_OPENGL
/** If there exist textures that have a QImage loaded
but which have not yet been set up for use with GL,
this function will set them up. */
@@ -48,6 +50,7 @@
*@return the QGLContext that is used for the textures
*/
static inline QGLContext* getContext() { return (m_p ? m_p->m_context : 0); }
+#endif
/**
*@short Create the instance of TextureManager
@@ -58,7 +61,11 @@
TextureManager(QObject* parent = 0);
static TextureManager* m_p;
QHash<QString,Texture*> m_textures;
+
+#ifdef HAVE_OPENGL
static QGLContext *m_context; // GL Context to bind textures to.
+#endif
+
};
#endif // KSTEXTUREMANAGER_H
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic