~ubuntu-branches/ubuntu/oneiric/nux/oneiric

« back to all changes in this revision

Viewing changes to NuxGraphics/GLDeviceObjects.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-11-18 19:17:32 UTC
  • Revision ID: james.westby@ubuntu.com-20101118191732-rn35790vekj6o4my
Tags: upstream-0.9.4
Import upstream version 0.9.4

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 "GpuDevice.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 "GraphicsEngine.h"
 
33
 
 
34
namespace nux
 
35
{
 
36
 
 
37
  extern PixelFormatInfo GPixelFormats[];
 
38
//NObjectType IOpenGLResource::StaticObjectType(TEXT("IOpenGLResource"), 0);
 
39
  NUX_IMPLEMENT_OBJECT_TYPE (IOpenGLResource);
 
40
 
 
41
 
 
42
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
43
  /*
 
44
  GLSL Built-in vertex attribute (Deprecated in GLSL 1.30)
 
45
  -------------------------------
 
46
  Built-in vertex attribute name      Incompatible aliased vertex attribute index
 
47
  gl_Vertex                           0
 
48
  gl_Normal                           2
 
49
  gl_Color                            3
 
50
  gl_SecondaryColor                   4
 
51
  gl_FogCoord                         5
 
52
  gl_MultiTexCoord0                   8
 
53
  gl_MultiTexCoord1                   9
 
54
  gl_MultiTexCoord2                   10
 
55
  gl_MultiTexCoord3                   11
 
56
  gl_MultiTexCoord4                   12
 
57
  gl_MultiTexCoord5                   13
 
58
  gl_MultiTexCoord6                   14
 
59
  gl_MultiTexCoord7                   15
 
60
 
 
61
 
 
62
  gl_Vertex:
 
63
      - glVertex{234sifd}
 
64
      - glEnableClientState/glDisableClientState(GL_VERTEX_ARRAY); glVertexPointer(...);
 
65
  gl_Normal:
 
66
      - glNormal{3sifd}
 
67
      - glEnableClientState/glDisableClientState(GL_NORMAL_ARRAY); glNormalPointer(...);
 
68
  gl_Color:
 
69
      - glColor{34sifd}
 
70
      - glEnableClientState/glDisableClientState(GL_COLOR_ARRAY); glColorPointer(...);
 
71
  gl_SecondaryColor (requires GL_EXT_secondary_color)
 
72
      - glSecondaryColor3{bsifd};
 
73
      - glEnableClientState/glDisableClientState(SECONDARY_COLOR_ARRAY_EXT); glSecondaryColorPointerEXT(...);
 
74
  gl_FogCoord (requires GL_EXT_fog_coord)
 
75
      - glFogCoord{fd};
 
76
      - glEnableClientState/glDisableClientState(FOG_COORDINATE_ARRAY_EXT); glFogCoordPointerEXT(...);
 
77
  gl_MultiTexCoordXXX
 
78
      - glMultiTexCoord{234fd}
 
79
      - glClientActiveTextureARB(GL_TEXTUREXXX_ARB); glEnableClientState/glDisableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(...);
 
80
 
 
81
  GLSL Vertex Shader Special output variables (write)
 
82
  ----------------------------------------------------
 
83
      gl_Position     (must be written to)
 
84
      gl_PointSize    (may be written to)
 
85
      gl_ClipVertex   (may be written to)
 
86
 
 
87
  GLSL Vertex Shader Built-in varying (write)                     GLSL Fragment Shader Built-in varying (read)
 
88
  -------------------------------------------                     -------------------------------------------
 
89
      varying vec4    gl_FrontColor;                     ---->    gl_Color
 
90
      varying vec4    gl_BackColor;                      ---->    gl_Color
 
91
      varying vec4    gl_FrontSecondaryColor;            ---->    gl_SecondaryColor
 
92
      varying vec4    gl_BackSecondaryColor;             ---->    gl_SecondaryColor
 
93
      varying vec4    gl_TexCoord[];                     ---->    gl_TexCoord[]
 
94
      varying float   gl_FogFragCoord;                   ---->    gl_FogFragCoord
 
95
 
 
96
  GLSL Fragment Built-in variables
 
97
  --------------------------------
 
98
      vec4    gl_FragCoord    (read only)
 
99
      bool    gl_FrontFacing  (read only)
 
100
      vec2    gl_PointCoord   (read only)
 
101
 
 
102
  GLSL Fragment Shader Special output variables
 
103
  ---------------------------------------------
 
104
      vec4    gl_FragColor    (may be written to)
 
105
      vec4    gl_FragData[gl_MaxDrawBuffers]  (may be written to)
 
106
      float   gl_FragDepth    (may be written to)
 
107
      vec2    gl_PointCoord   (read only)
 
108
 
 
109
 
 
110
 
 
111
  Binding Semantics for Cg programs
 
112
  Binding Semantics for Varying Input/Output Data
 
113
  -----------------------------------------------
 
114
      Table 23 summarizes the valid binding semantics for varying input parameters
 
115
      in the vp30 profile.
 
116
        One can also use TANGENT and BINORMAL instead of TEXCOORD6 and
 
117
        TEXCOORD7. These binding semantics map to NV_vertex_program2 input
 
118
        attribute parameters. The two sets act as aliases to each other.
 
119
 
 
120
      Table 23 vp30 Varying Input Binding Semantics
 
121
                Binding Semantics                           Name Corresponding Data
 
122
                POSITION, ATTR0                             Input Vertex, Generic Attribute 0
 
123
                BLENDWEIGHT, ATTR1                          Input vertex weight, Generic Attribute 1
 
124
                NORMAL, ATTR2                               Input normal, Generic Attribute 2
 
125
                COLOR0, DIFFUSE, ATTR3                      Input primary color, Generic Attribute 3
 
126
                COLOR1, SPECULAR, ATTR4                     Input secondary color, Generic Attribute 4
 
127
                TESSFACTOR, FOGCOORD, ATTR5                 Input fog coordinate, Generic Attribute 5
 
128
                PSIZE, ATTR6                                Input point size, Generic Attribute 6
 
129
                BLENDINDICES, ATTR7                         Generic Attribute 7
 
130
                TEXCOORD0-TEXCOORD7, ATTR8-ATTR15           Input texture coordinates (texcoord0-texcoord7), Generic Attributes 8�15
 
131
                TANGENT, ATTR14                             Generic Attribute 14
 
132
                BINORMAL, ATTR15                            Generic Attribute 15
 
133
 
 
134
      Table 24 summarizes the valid binding semantics for varying output parameters
 
135
      in the vp30 profile. These binding semantics map to NV_vertex_program2 output registers. The
 
136
      two sets act as aliases to each other.
 
137
 
 
138
 
 
139
      Table 24 vp30 Varying Output Binding Semantics
 
140
                Binding Semantics                           Name Corresponding Data
 
141
                POSITION, HPOS                              Output position
 
142
                PSIZE, PSIZ                                 Output point size
 
143
                FOG, FOGC                                   Output fog coordinate
 
144
                COLOR0, COL0                                Output primary color
 
145
                COLOR1, COL1                                Output secondary color
 
146
                BCOL0                                       Output backface primary color
 
147
                BCOL1                                       Output backface secondary color
 
148
                TEXCOORD0-TEXCOORD7, TEX0-TEX7              Output texture coordinates
 
149
                CLP0-CL5                                    Output Clip distances
 
150
  */
 
151
 
 
152
}