~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/demos-boxes-glshaders-h.html

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2009-11-02 18:30:08 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (15.2.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 88.
  • Revision ID: james.westby@ubuntu.com-20091102183008-b6a4gcs128mvfb3m
Tags: upstream-4.6.0~beta1
ImportĀ upstreamĀ versionĀ 4.6.0~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?xml version="1.0" encoding="iso-8859-1"?>
2
 
<!DOCTYPE html
3
 
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
4
 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
 
<head>
6
 
  <title>Qt 4.5: glshaders.h Example File (demos/boxes/glshaders.h)</title>
7
 
  <link href="classic.css" rel="stylesheet" type="text/css" />
8
 
</head>
9
 
<body>
10
 
<table border="0" cellpadding="0" cellspacing="0" width="100%">
11
 
<tr>
12
 
<td align="left" valign="top" width="32"><a href="http://qtsoftware.com/products/qt"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
13
 
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="namespaces.html"><font color="#004faf">All&nbsp;Namespaces</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
14
 
<td align="right" valign="top" width="230"></td></tr></table><h1 class="title">glshaders.h Example File<br /><span class="small-subtitle">demos/boxes/glshaders.h</span>
15
 
</h1>
16
 
<pre><span class="comment"> /****************************************************************************
17
 
 **
18
 
 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
19
 
 ** Contact: Nokia Corporation (qt-info@nokia.com)
20
 
 **
21
 
 ** This file is part of the demonstration applications of the Qt Toolkit.
22
 
 **
23
 
 ** $QT_BEGIN_LICENSE:LGPL$
24
 
 ** Commercial Usage
25
 
 ** Licensees holding valid Qt Commercial licenses may use this file in
26
 
 ** accordance with the Qt Commercial License Agreement provided with the
27
 
 ** Software or, alternatively, in accordance with the terms contained in
28
 
 ** a written agreement between you and Nokia.
29
 
 **
30
 
 ** GNU Lesser General Public License Usage
31
 
 ** Alternatively, this file may be used under the terms of the GNU Lesser
32
 
 ** General Public License version 2.1 as published by the Free Software
33
 
 ** Foundation and appearing in the file LICENSE.LGPL included in the
34
 
 ** packaging of this file.  Please review the following information to
35
 
 ** ensure the GNU Lesser General Public License version 2.1 requirements
36
 
 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
37
 
 **
38
 
 ** In addition, as a special exception, Nokia gives you certain
39
 
 ** additional rights. These rights are described in the Nokia Qt LGPL
40
 
 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
41
 
 ** package.
42
 
 **
43
 
 ** GNU General Public License Usage
44
 
 ** Alternatively, this file may be used under the terms of the GNU
45
 
 ** General Public License version 3.0 as published by the Free Software
46
 
 ** Foundation and appearing in the file LICENSE.GPL included in the
47
 
 ** packaging of this file.  Please review the following information to
48
 
 ** ensure the GNU General Public License version 3.0 requirements will be
49
 
 ** met: http://www.gnu.org/copyleft/gpl.html.
50
 
 **
51
 
 ** If you are unsure which license is appropriate for your use, please
52
 
 ** contact the sales department at http://www.qtsoftware.com/contact.
53
 
 ** $QT_END_LICENSE$
54
 
 **
55
 
 ****************************************************************************/</span>
56
 
 
57
 
 #ifndef GLSHADERS_H
58
 
 #define GLSHADERS_H
59
 
 
60
 
<span class="comment"> //#include &lt;GL/glew.h&gt;</span>
61
 
 #include &quot;glextensions.h&quot;
62
 
 
63
 
 #include &lt;QtGui&gt;
64
 
 #include &lt;QtOpenGL&gt;
65
 
 
66
 
 #include &quot;vector.h&quot;
67
 
 
68
 
 class GLShader
69
 
 {
70
 
 public:
71
 
     friend class GLProgram;
72
 
     virtual ~GLShader();
73
 
     bool failed() const {return m_failed;}
74
 
     QString log();
75
 
 protected:
76
 
     GLShader(const char *data, int size, GLenum shaderType);
77
 
     GLShader(const QString&amp; fileName, GLenum shaderType);
78
 
 
79
 
     GLhandleARB m_shader;
80
 
     bool m_compileError;
81
 
     bool m_failed;
82
 
 };
83
 
 
84
 
 class GLVertexShader : public GLShader
85
 
 {
86
 
 public:
87
 
     GLVertexShader(const char *data, int size);
88
 
     GLVertexShader(const QString&amp; fileName);
89
 
 };
90
 
 
91
 
 class GLFragmentShader : public GLShader
92
 
 {
93
 
 public:
94
 
     GLFragmentShader(const char *data, int size);
95
 
     GLFragmentShader(const QString&amp; fileName);
96
 
 };
97
 
 
98
 
 class GLProgram
99
 
 {
100
 
 public:
101
 
     GLProgram();
102
 
     ~GLProgram();
103
 
     void attach(const GLShader &amp;shader);
104
 
     void detach(const GLShader &amp;shader);
105
 
     void bind();
106
 
     void unbind();
107
 
     bool failed();
108
 
     QString log();
109
 
     bool hasParameter(const QString&amp; name);
110
 
     <span class="comment">// use program before setting values</span>
111
 
     void setInt(const QString&amp; name, int value);
112
 
     void setFloat(const QString&amp; name, float value);
113
 
     void setColor(const QString&amp; name, QRgb value);
114
 
     void setMatrix(const QString&amp; name, const gfx::Matrix4x4f &amp;mat);
115
 
     <span class="comment">// TODO: add a bunch of set-functions for different types.</span>
116
 
 private:
117
 
     GLhandleARB m_program;
118
 
     bool m_linked;
119
 
     bool m_linkError;
120
 
     bool m_failed;
121
 
 };
122
 
 
123
 
 #endif</pre>
124
 
<p /><address><hr /><div align="center">
125
 
<table width="100%" cellspacing="0" border="0"><tr class="address">
126
 
<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
127
 
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
128
 
<td width="30%" align="right"><div align="right">Qt 4.5.2</div></td>
129
 
</tr></table></div></address></body>
130
 
</html>