Changeset 7164 in orxonox.OLD for trunk/src/lib/graphics
- Timestamp:
- Feb 18, 2006, 5:32:35 PM (19 years ago)
- Location:
- trunk/src/lib/graphics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/shader.cc
r6645 r7164 22 22 #include <stdio.h> 23 23 #include "debug.h" 24 #include "array.h"25 24 26 25 #include "resource_manager.h" … … 126 125 127 126 128 tArray<char*>* program = fileReadArray(fileName); 129 if (program == NULL) 130 return false; 127 std::vector<char*>* program = fileReadArray(fileName); 131 128 132 129 if (type == SHADER_VERTEX && GLEW_ARB_vertex_shader) … … 149 146 { 150 147 GLint status = 0; 151 glShaderSourceARB(shader, program-> getCount(), (const char**)program->getArray(), NULL);148 glShaderSourceARB(shader, program->size(), (const char**)&(*program)[0], NULL); 152 149 glCompileShaderARB(shader); 153 150 // checking on error. … … 158 155 glAttachObjectARB(this->shaderProgram, shader); 159 156 } 160 for (unsigned int i=0; i< program-> getCount(); i++)161 delete[] program->getArray()[i];157 for (unsigned int i=0; i< program->size(); i++) 158 delete[] (*program)[i]; 162 159 delete program; 163 160 } … … 190 187 191 188 192 tArray<char*>* Shader::fileReadArray(const char* fileName)189 std::vector<char*>* Shader::fileReadArray(const char* fileName) 193 190 { 194 191 FILE* stream; //< The stream we use to read the file. … … 199 196 return NULL; 200 197 } 201 tArray<char*>* file = new tArray<char*>;198 std::vector<char*>* file = new std::vector<char*>; 202 199 203 200 char lineBuffer[PARSELINELENGHT]; … … 207 204 addString = new char[strlen(lineBuffer)+1]; 208 205 strcpy(addString, lineBuffer); 209 file-> addEntry(addString);206 file->push_back(addString); 210 207 } 211 208 fclose(stream); 212 file->finalizeArray();213 209 return file; 214 210 } -
trunk/src/lib/graphics/shader.h
r5390 r7164 9 9 #include "base_object.h" 10 10 #include "glincl.h" 11 #include <vector> 11 12 12 template<class T> class tArray;13 13 14 14 typedef enum … … 38 38 39 39 char* fileRead(const char* fileName); 40 tArray<char*>* fileReadArray(const char* fileName);40 std::vector<char*>* fileReadArray(const char* fileName); 41 41 42 42 static bool checkShaderAbility();
Note: See TracChangeset
for help on using the changeset viewer.