Qt 4.8
Public Functions | Public Variables | List of all members
QGLShaderPrivate Class Reference
Inheritance diagram for QGLShaderPrivate:
QObjectPrivate QObjectData

Public Functions

bool compile (QGLShader *q)
 
bool create ()
 
void deleteShader ()
 
 QGLShaderPrivate (const QGLContext *context, QGLShader::ShaderType type)
 
 ~QGLShaderPrivate ()
 
- Public Functions inherited from QObjectPrivate
void _q_reregisterTimers (void *pointer)
 
void addConnection (int signal, Connection *c)
 
void cleanConnectionLists ()
 
void connectNotify (const char *signal)
 
void deleteChildren ()
 
void disconnectNotify (const char *signal)
 
bool isSender (const QObject *receiver, const char *signal) const
 
bool isSignalConnected (uint signalIdx) const
 Returns true if the signal with index signal_index from object sender is connected. More...
 
void moveToThread_helper ()
 
 QObjectPrivate (int version=QObjectPrivateVersion)
 
QObjectList receiverList (const char *signal) const
 
QObjectList senderList () const
 
void setParent_helper (QObject *)
 
void setThreadData_helper (QThreadData *currentData, QThreadData *targetData)
 
int signalIndex (const char *signalName) const
 Returns the signal index used in the internal connectionLists vector. More...
 
virtual ~QObjectPrivate ()
 
- Public Functions inherited from QObjectData
virtual ~QObjectData ()=0
 

Public Variables

bool compiled
 
QString log
 
QGLSharedResourceGuard shaderGuard
 
QGLShader::ShaderType shaderType
 
- Public Variables inherited from QObjectPrivate
union {
   QObject *   currentChildBeingDeleted
 
   QAbstractDeclarativeData *   declarativeData
 
}; 
 
quint32 connectedSignals [2]
 
QObjectConnectionListVectorconnectionLists
 
SendercurrentSender
 
QList< QPointer< QObject > > eventFilters
 
ExtraDataextraData
 
QString objectName
 
Connectionsenders
 
QAtomicPointer< QtSharedPointer::ExternalRefCountData > sharedRefcount
 
QThreadDatathreadData
 
void * unused
 
- Public Variables inherited from QObjectData
uint blockSig: 1
 
QObjectList children
 
uint hasGuards: 1
 
uint inEventHandler: 1
 
uint inThreadChangeEvent: 1
 
uint isWidget: 1
 
QMetaObjectmetaObject
 
uint ownObjectName: 1
 
QObjectparent
 
uint pendTimer: 1
 
int postedEvents
 
QObjectq_ptr
 
uint receiveChildEvents: 1
 
uint sendChildEvents: 1
 
uint unused: 22
 
uint wasDeleted: 1
 

Additional Inherited Members

- Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
 
- Static Public Functions inherited from QObjectPrivate
static void clearGuards (QObject *)
 
static QObjectPrivateget (QObject *o)
 
static void resetCurrentSender (QObject *receiver, Sender *currentSender, Sender *previousSender)
 
static SendersetCurrentSender (QObject *receiver, Sender *sender)
 
static void signalSignature (const QMetaMethod &signal, QVarLengthArray< char > *result)
 

Detailed Description

Definition at line 199 of file qglshaderprogram.cpp.

Constructors and Destructors

◆ QGLShaderPrivate()

QGLShaderPrivate::QGLShaderPrivate ( const QGLContext context,
QGLShader::ShaderType  type 
)
inline

Definition at line 203 of file qglshaderprogram.cpp.

204  : shaderGuard(context)
205  , shaderType(type)
206  , compiled(false)
207  {
208  }
int type
Definition: qmetatype.cpp:239
QGLSharedResourceGuard shaderGuard
QGLShader::ShaderType shaderType

◆ ~QGLShaderPrivate()

QGLShaderPrivate::~QGLShaderPrivate ( )

Definition at line 223 of file qglshaderprogram.cpp.

Referenced by QGLShaderPrivate().

224 {
225  if (shaderGuard.id()) {
228  }
229 }
const QGLContext * context() const
Definition: qgl_p.h:873
GLuint id() const
Definition: qgl_p.h:880
QGLSharedResourceGuard shaderGuard
#define glDeleteShader

Functions

◆ compile()

bool QGLShaderPrivate::compile ( QGLShader q)

Definition at line 255 of file qglshaderprogram.cpp.

256 {
257  GLuint shader = shaderGuard.id();
258  if (!shader)
259  return false;
260  glCompileShader(shader);
261  GLint value = 0;
262  glGetShaderiv(shader, GL_COMPILE_STATUS, &value);
263  compiled = (value != 0);
264  value = 0;
265  glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &value);
266  if (!compiled && value > 1) {
267  char *logbuf = new char [value];
268  GLint len;
269  glGetShaderInfoLog(shader, value, &len, logbuf);
270  log = QString::fromLatin1(logbuf);
271  QString name = q->objectName();
272 
273  const char *types[] = {
274  "Fragment",
275  "Vertex",
276  "Geometry",
277  ""
278  };
279 
280  const char *type = types[3];
282  type = types[0];
283  else if (shaderType == QGLShader::Vertex)
284  type = types[1];
285  else if (shaderType == QGLShader::Geometry)
286  type = types[2];
287 
288  if (name.isEmpty())
289  qWarning("QGLShader::compile(%s): %s", type, qPrintable(log));
290  else
291  qWarning("QGLShader::compile(%s)[%s]: %s", type, qPrintable(name), qPrintable(log));
292 
293  delete [] logbuf;
294  }
295  return compiled;
296 }
#define GL_COMPILE_STATUS
int type
Definition: qmetatype.cpp:239
GLuint id() const
Definition: qgl_p.h:880
The QString class provides a Unicode character string.
Definition: qstring.h:83
QGLSharedResourceGuard shaderGuard
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
const char * name
Q_CORE_EXPORT void qWarning(const char *,...)
#define GL_INFO_LOG_LENGTH
#define glGetShaderInfoLog
QGLShader::ShaderType shaderType
static const struct @32 types[]
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
QString objectName() const
#define glGetShaderiv
typedef GLint
Definition: glfunctions.h:67
#define glCompileShader
#define qPrintable(string)
Definition: qglobal.h:1750

◆ create()

bool QGLShaderPrivate::create ( )

Definition at line 231 of file qglshaderprogram.cpp.

232 {
233  const QGLContext *context = shaderGuard.context();
234  if (!context)
235  return false;
236  if (qt_resolve_glsl_extensions(const_cast<QGLContext *>(context))) {
237  GLuint shader;
240  else if (shaderType == QGLShader::Geometry)
242  else
244  if (!shader) {
245  qWarning() << "QGLShader: could not create shader";
246  return false;
247  }
248  shaderGuard.setId(shader);
249  return true;
250  } else {
251  return false;
252  }
253 }
const QGLContext * context() const
Definition: qgl_p.h:873
#define GL_VERTEX_SHADER
QGLSharedResourceGuard shaderGuard
bool qt_resolve_glsl_extensions(QGLContext *ctx)
The QGLContext class encapsulates an OpenGL rendering context.
Definition: qgl.h:310
Q_CORE_EXPORT void qWarning(const char *,...)
QGLShader::ShaderType shaderType
#define GL_FRAGMENT_SHADER
void setId(GLuint id)
Definition: qgl_p.h:885
#define glCreateShader
#define GL_GEOMETRY_SHADER_EXT

◆ deleteShader()

void QGLShaderPrivate::deleteShader ( )

Definition at line 298 of file qglshaderprogram.cpp.

299 {
300  if (shaderGuard.id()) {
302  shaderGuard.setId(0);
303  }
304 }
GLuint id() const
Definition: qgl_p.h:880
QGLSharedResourceGuard shaderGuard
void setId(GLuint id)
Definition: qgl_p.h:885
#define glDeleteShader

Properties

◆ compiled

bool QGLShaderPrivate::compiled

Definition at line 213 of file qglshaderprogram.cpp.

Referenced by compile().

◆ log

QString QGLShaderPrivate::log

Definition at line 214 of file qglshaderprogram.cpp.

Referenced by compile().

◆ shaderGuard

QGLSharedResourceGuard QGLShaderPrivate::shaderGuard

Definition at line 211 of file qglshaderprogram.cpp.

Referenced by compile(), create(), deleteShader(), and ~QGLShaderPrivate().

◆ shaderType

QGLShader::ShaderType QGLShaderPrivate::shaderType

Definition at line 212 of file qglshaderprogram.cpp.

Referenced by compile(), and create().


The documentation for this class was generated from the following file: