annotate src/vertex-attribute.c @ 2:105513a2e3c9

Import liboggplayer source.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 05 Aug 2013 13:50:20 +0300
parents 785057719d9b
children 217cd6863772
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /* ============================================================================
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 * Freetype GL - A C OpenGL Freetype engine
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 * Platform: Any
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 * WWW: http://code.google.com/p/freetype-gl/
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 * ----------------------------------------------------------------------------
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 * Copyright 2011,2012 Nicolas P. Rougier. All rights reserved.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 * Redistribution and use in source and binary forms, with or without
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 * modification, are permitted provided that the following conditions are met:
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 * 1. Redistributions of source code must retain the above copyright notice,
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 * this list of conditions and the following disclaimer.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 * 2. Redistributions in binary form must reproduce the above copyright
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 * notice, this list of conditions and the following disclaimer in the
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 * documentation and/or other materials provided with the distribution.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18 * THIS SOFTWARE IS PROVIDED BY NICOLAS P. ROUGIER ''AS IS'' AND ANY EXPRESS OR
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21 * EVENT SHALL NICOLAS P. ROUGIER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29 * The views and conclusions contained in the software and documentation are
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30 * those of the authors and should not be interpreted as representing official
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 * policies, either expressed or implied, of Nicolas P. Rougier.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32 * ============================================================================
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34 #include <assert.h>
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 #include <string.h>
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 #include <stdlib.h>
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37 #include <stdio.h>
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 #include "vec234.h"
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 #include "platform.h"
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40 #include "vertex-attribute.h"
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45 // ----------------------------------------------------------------------------
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46 vertex_attribute_t *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 vertex_attribute_new( GLchar * name,
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48 GLint size,
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49 GLenum type,
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50 GLboolean normalized,
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51 GLsizei stride,
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52 GLvoid *pointer )
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53 {
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54 vertex_attribute_t *attribute =
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55 (vertex_attribute_t *) malloc (sizeof(vertex_attribute_t));
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57 assert( size > 0 );
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59 attribute->name = (GLchar *) strdup( name );
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60 attribute->index = -1;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
61 attribute->size = size;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62 attribute->type = type;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63 attribute->normalized = normalized;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64 attribute->stride = stride;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65 attribute->pointer = pointer;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
66 return attribute;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67 }
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
71 // ----------------------------------------------------------------------------
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72 void
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
73 vertex_attribute_delete( vertex_attribute_t * self )
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
74 {
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75 assert( self );
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
77 free( self->name );
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
78 free( self );
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79 }
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81 #include "ansidecl.h"
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82 #include <stddef.h>
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84 extern size_t strlen (const char*);
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85 extern PTR malloc (size_t);
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86 extern PTR memcpy (PTR, const PTR, size_t);
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88 char *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89 strndup (const char *s, size_t n)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
90 {
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91 char *result;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92 size_t len = strlen (s);
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
93
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
94 if (n < len)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
95 len = n;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
97 result = (char *) malloc (len + 1);
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98 if (!result)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99 return 0;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
100
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
101 result[len] = '\0';
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
102 return (char *) memcpy (result, s, len);
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
103 }
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
104
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
105
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
106 // ----------------------------------------------------------------------------
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
107 vertex_attribute_t *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
108 vertex_attribute_parse( char *format )
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
109 {
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
110 GLenum type = 0;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
111 int size;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
112 int normalized = 0;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
113 char ctype;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
114 char *name;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
115 vertex_attribute_t *attr;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
116 char *p = strchr(format, ':');
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
117 if( p != NULL)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
118 {
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
119 name = strndup(format, p-format);
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
120 if( *(++p) == '\0' )
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
121 {
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
122 fprintf( stderr, "No size specified for '%s' attribute\n", name );
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
123 free( name );
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
124 return 0;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
125 }
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
126 size = *p - '0';
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
127
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
128 if( *(++p) == '\0' )
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
129 {
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
130 fprintf( stderr, "No format specified for '%s' attribute\n", name );
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
131 free( name );
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
132 return 0;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
133 }
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
134 ctype = *p;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
135
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
136 if( *(++p) != '\0' )
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
137 {
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
138 if( *p == 'n' )
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
139 {
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
140 normalized = 1;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
141 }
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
142 }
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
144 }
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145 else
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
146 {
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
147 fprintf(stderr, "Vertex attribute format not understood ('%s')\n", format );
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
148 return 0;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
149 }
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
150
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
151 switch( ctype )
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
152 {
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
153 case 'b': type = GL_BYTE; break;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
154 case 'B': type = GL_UNSIGNED_BYTE; break;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
155 case 's': type = GL_SHORT; break;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
156 case 'S': type = GL_UNSIGNED_SHORT; break;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
157 case 'i': type = GL_INT; break;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
158 case 'I': type = GL_UNSIGNED_INT; break;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
159 case 'f': type = GL_FLOAT; break;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
160 default: type = 0; break;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
161 }
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
162
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
163
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
164 attr = vertex_attribute_new( name, size, type, normalized, 0, 0 );
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
165 free( name );
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
166 return attr;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
167 }
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
168
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
169
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
170
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
171 // ----------------------------------------------------------------------------
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
172 void
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
173 vertex_attribute_enable( vertex_attribute_t *attr )
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
174 {
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
175 if( attr->index == -1 )
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
176 {
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
177 GLint program;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
178 glGetIntegerv( GL_CURRENT_PROGRAM, &program );
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
179 if( program == 0)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
180 {
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
181 return;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
182 }
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
183 attr->index = glGetAttribLocation( program, attr->name );
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
184 if( attr->index == -1 )
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
185 {
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
186 return;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
187 }
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
188 }
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
189 glEnableVertexAttribArray( attr->index );
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
190 glVertexAttribPointer( attr->index, attr->size, attr->type,
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
191 attr->normalized, attr->stride, attr->pointer );
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
192 }