~thumper/nux/next-changes

« back to all changes in this revision

Viewing changes to NuxGraphics/GLDeviceObjects.cpp

  • Committer: Neil Jagdish Patel
  • Date: 2010-09-01 21:15:42 UTC
  • Revision ID: neil.patel@canonical.com-20100901211542-cw2ce3ak28unouwb
Add NuxGraphics with licensing

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2010 Inalogic Inc.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify it 
 
5
 * under the terms of the GNU Lesser General Public License version 3, as
 
6
 * published by the  Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful, but 
 
9
 * WITHOUT ANY WARRANTY; without even the implied warranties of 
 
10
 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR 
 
11
 * PURPOSE.  See the applicable version of the GNU Lesser General Public 
 
12
 * License for more details.
 
13
 * 
 
14
 * You should have received a copy of both the GNU Lesser General Public 
 
15
 * License version 3 along with this program.  If not, see 
 
16
 * <http://www.gnu.org/licenses/>
 
17
 *
 
18
 * Authored by: Jay Taoko <jay.taoko_AT_gmail_DOT_com>
 
19
 *
 
20
 */
 
21
 
 
22
 
 
23
#include "GLResource.h"
 
24
#include "GLDeviceFactory.h"
 
25
#include "GLDeviceObjects.h"
 
26
#include "GLResourceManager.h"
 
27
 
 
28
#include "GLTextureResourceManager.h"
 
29
#include "GLVertexResourceManager.h"
 
30
#include "GLDeviceFrameBufferObject.h"
 
31
#include "GLTemplatePrimitiveBuffer.h"
 
32
#include "OpenGLEngine.h"
 
33
 
 
34
NAMESPACE_BEGIN_OGL
 
35
 
 
36
extern PixelFormatInfo GPixelFormats[];
 
37
//NObjectType IOpenGLResource::StaticObjectType(TEXT("IOpenGLResource"), 0);
 
38
IMPLEMENT_ROOT_OBJECT_TYPE(IOpenGLResource);
 
39
 
 
40
 
 
41
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
42
/*
 
43
GLSL Built-in vertex attribute (Deprecated in GLSL 1.30)
 
44
-------------------------------
 
45
Built-in vertex attribute name      Incompatible aliased vertex attribute index
 
46
gl_Vertex                           0
 
47
gl_Normal                           2
 
48
gl_Color                            3
 
49
gl_SecondaryColor                   4
 
50
gl_FogCoord                         5
 
51
gl_MultiTexCoord0                   8
 
52
gl_MultiTexCoord1                   9
 
53
gl_MultiTexCoord2                   10
 
54
gl_MultiTexCoord3                   11
 
55
gl_MultiTexCoord4                   12
 
56
gl_MultiTexCoord5                   13
 
57
gl_MultiTexCoord6                   14
 
58
gl_MultiTexCoord7                   15
 
59
 
 
60
 
 
61
gl_Vertex:
 
62
    - glVertex{234sifd}
 
63
    - glEnableClientState/glDisableClientState(GL_VERTEX_ARRAY); glVertexPointer(...);
 
64
gl_Normal:
 
65
    - glNormal{3sifd}
 
66
    - glEnableClientState/glDisableClientState(GL_NORMAL_ARRAY); glNormalPointer(...);
 
67
gl_Color:
 
68
    - glColor{34sifd}
 
69
    - glEnableClientState/glDisableClientState(GL_COLOR_ARRAY); glColorPointer(...);
 
70
gl_SecondaryColor (requires GL_EXT_secondary_color)
 
71
    - glSecondaryColor3{bsifd};
 
72
    - glEnableClientState/glDisableClientState(SECONDARY_COLOR_ARRAY_EXT); glSecondaryColorPointerEXT(...);
 
73
gl_FogCoord (requires GL_EXT_fog_coord)
 
74
    - glFogCoord{fd};
 
75
    - glEnableClientState/glDisableClientState(FOG_COORDINATE_ARRAY_EXT); glFogCoordPointerEXT(...);
 
76
gl_MultiTexCoordXXX
 
77
    - glMultiTexCoord{234fd}
 
78
    - glClientActiveTextureARB(GL_TEXTUREXXX_ARB); glEnableClientState/glDisableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(...);
 
79
 
 
80
GLSL Vertex Shader Special output variables (write)
 
81
----------------------------------------------------
 
82
    gl_Position     (must be written to)
 
83
    gl_PointSize    (may be written to)
 
84
    gl_ClipVertex   (may be written to)
 
85
 
 
86
GLSL Vertex Shader Built-in varying (write)                     GLSL Fragment Shader Built-in varying (read)
 
87
-------------------------------------------                     -------------------------------------------
 
88
    varying vec4    gl_FrontColor;                     ---->    gl_Color
 
89
    varying vec4    gl_BackColor;                      ---->    gl_Color
 
90
    varying vec4    gl_FrontSecondaryColor;            ---->    gl_SecondaryColor
 
91
    varying vec4    gl_BackSecondaryColor;             ---->    gl_SecondaryColor
 
92
    varying vec4    gl_TexCoord[];                     ---->    gl_TexCoord[]
 
93
    varying float   gl_FogFragCoord;                   ---->    gl_FogFragCoord
 
94
 
 
95
GLSL Fragment Built-in variables
 
96
--------------------------------
 
97
    vec4    gl_FragCoord    (read only)
 
98
    bool    gl_FrontFacing  (read only)
 
99
    vec2    gl_PointCoord   (read only)
 
100
 
 
101
GLSL Fragment Shader Special output variables
 
102
---------------------------------------------
 
103
    vec4    gl_FragColor    (may be written to)
 
104
    vec4    gl_FragData[gl_MaxDrawBuffers]  (may be written to)
 
105
    float   gl_FragDepth    (may be written to)
 
106
    vec2    gl_PointCoord   (read only)
 
107
 
 
108
 
 
109
 
 
110
Binding Semantics for Cg programs
 
111
Binding Semantics for Varying Input/Output Data
 
112
-----------------------------------------------
 
113
    Table 23 summarizes the valid binding semantics for varying input parameters
 
114
    in the vp30 profile.
 
115
        One can also use TANGENT and BINORMAL instead of TEXCOORD6 and
 
116
        TEXCOORD7. These binding semantics map to NV_vertex_program2 input
 
117
        attribute parameters. The two sets act as aliases to each other.
 
118
    
 
119
    Table 23 vp30 Varying Input Binding Semantics
 
120
                Binding Semantics                           Name Corresponding Data
 
121
                POSITION, ATTR0                             Input Vertex, Generic Attribute 0
 
122
                BLENDWEIGHT, ATTR1                          Input vertex weight, Generic Attribute 1
 
123
                NORMAL, ATTR2                               Input normal, Generic Attribute 2
 
124
                COLOR0, DIFFUSE, ATTR3                      Input primary color, Generic Attribute 3
 
125
                COLOR1, SPECULAR, ATTR4                     Input secondary color, Generic Attribute 4
 
126
                TESSFACTOR, FOGCOORD, ATTR5                 Input fog coordinate, Generic Attribute 5
 
127
                PSIZE, ATTR6                                Input point size, Generic Attribute 6
 
128
                BLENDINDICES, ATTR7                         Generic Attribute 7
 
129
                TEXCOORD0-TEXCOORD7, ATTR8-ATTR15           Input texture coordinates (texcoord0-texcoord7), Generic Attributes 8�15
 
130
                TANGENT, ATTR14                             Generic Attribute 14
 
131
                BINORMAL, ATTR15                            Generic Attribute 15
 
132
 
 
133
    Table 24 summarizes the valid binding semantics for varying output parameters
 
134
    in the vp30 profile. These binding semantics map to NV_vertex_program2 output registers. The
 
135
    two sets act as aliases to each other.
 
136
        
 
137
 
 
138
    Table 24 vp30 Varying Output Binding Semantics
 
139
                Binding Semantics                           Name Corresponding Data
 
140
                POSITION, HPOS                              Output position
 
141
                PSIZE, PSIZ                                 Output point size
 
142
                FOG, FOGC                                   Output fog coordinate
 
143
                COLOR0, COL0                                Output primary color
 
144
                COLOR1, COL1                                Output secondary color
 
145
                BCOL0                                       Output backface primary color
 
146
                BCOL1                                       Output backface secondary color
 
147
                TEXCOORD0-TEXCOORD7, TEX0-TEX7              Output texture coordinates
 
148
                CLP0-CL5                                    Output Clip distances
 
149
*/
 
150
 
 
151
NAMESPACE_END_OGL