GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
glc_ext.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 
3  This file is part of the GLC-lib library.
4  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
5  http://glc-lib.sourceforge.net
6 
7  GLC-lib is free software; you can redistribute it and/or modify
8  it under the terms of the GNU Lesser General Public License as published by
9  the Free Software Foundation; either version 3 of the License, or
10  (at your option) any later version.
11 
12  GLC-lib is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with GLC-lib; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 
21 *****************************************************************************/
23 
24 #include "glc_ext.h"
25 #include <QString>
26 #include <QGLContext>
27 #include <QDebug>
28 #include <QGLShaderProgram>
29 #include <QGLBuffer>
30 
31 #if !defined(Q_OS_MAC)
32 
33 // GL_point_parameters Point Sprite
34 PFNGLPOINTPARAMETERFARBPROC glPointParameterf = NULL;
35 PFNGLPOINTPARAMETERFVARBPROC glPointParameterfv = NULL;
36 
37 #endif
38 
39 
40 // Return true if the extension is supported
41 bool glc::extensionIsSupported(const QString& extension)
42 {
43  QString glExtension(reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)));
44  return glExtension.contains(extension);
45 }
46 
47 // Return true if VBO extension is succesfully loaded
49 {
50  QGLBuffer buffer;
51  bool result= buffer.create();
52  buffer.destroy();
53  return result;
54 }
55 
56 // Load GLSL extensions
58 {
59  return QGLShaderProgram::hasOpenGLShaderPrograms();
60 }
61 
62 // Load Point Sprite extension
64 {
65  bool result= true;
66 #if !defined(Q_OS_MAC)
67  const QGLContext* pContext= QGLContext::currentContext();
68  glPointParameterf = (PFNGLPOINTPARAMETERFARBPROC)pContext->getProcAddress(QLatin1String("glPointParameterf"));
69  if (!glPointParameterf) qDebug() << "not glPointParameterf";
70  glPointParameterfv = (PFNGLPOINTPARAMETERFVARBPROC)pContext->getProcAddress(QLatin1String("glPointParameterfv"));
71  if (!glPointParameterfv) qDebug() << "not glPointParameterfv";
72 
74 
75 #endif
76  return result;
77 }
78 

©2005-2013 Laurent Ribon