Commit 7b20b4e5ad32b82df7c34bd1f29396daf276cd8f

Authored by david
1 parent c512fb94

fixed image stack loading errors in gl_texture

Showing 2 changed files with 15 additions and 4 deletions   Show diff stats
stim/gl/gl_texture.h
@@ -210,14 +210,25 @@ class gl_texture : public virtual image_stack<T, F> @@ -210,14 +210,25 @@ class gl_texture : public virtual image_stack<T, F>
210 wrap = twrap; //store the wrap type 210 wrap = twrap; //store the wrap type
211 } 211 }
212 212
213 - ///@param string path to the directory with the image files.  
214 - ///Creates an instance of the gl_texture object with a path to the data. 213 + ///@param is a mask indicating the files to load
  214 + ///Creates an instance of the gl_texture object and initializes it with a file list
215 215
216 gl_texture(std::string file_mask, GLint interp = GL_LINEAR, GLint twrap = GL_REPEAT){ 216 gl_texture(std::string file_mask, GLint interp = GL_LINEAR, GLint twrap = GL_REPEAT){
217 init(); 217 init();
218 interpolation = interp; //store interpolation type 218 interpolation = interp; //store interpolation type
219 wrap = twrap; //store wrap type 219 wrap = twrap; //store wrap type
220 - load(file_mask); 220 + load_images(file_mask);
  221 + }
  222 +
  223 + ///Creates an instance of gl_texture and initializes with a file list
  224 + ///@param file_list is a list of files
  225 + ///@param interp is the type of texture interpolation (GL_LINEAR, GL_NEAREST)
  226 + ///@param twrap is the type of texture wrapping
  227 + gl_texture(std::vector<std::string> file_list, GLint interp = GL_LINEAR, GLint twrap = GL_REPEAT){
  228 + init();
  229 + interpolation = interp;
  230 + wrap = twrap;
  231 + load_images(file_list);
221 } 232 }
222 233
223 ///Attaches the texture to the current OpenGL context and makes it ready to render 234 ///Attaches the texture to the current OpenGL context and makes it ready to render
stim/grids/image_stack.h
@@ -80,7 +80,7 @@ public: @@ -80,7 +80,7 @@ public:
80 R[2] = I.height(); 80 R[2] = I.height();
81 R[3] = string_list.size(); //set the stack z-resolution based on the number of images 81 R[3] = string_list.size(); //set the stack z-resolution based on the number of images
82 82
83 - ptr = (T*)malloc(bytes()); //allocate storage space 83 + ptr = (T*)malloc(grid<T, 4, F>::bytes()); //allocate storage space
84 84
85 //load and copy each image into the grid 85 //load and copy each image into the grid
86 for(unsigned int i = 0; i<R[3]; i++){ //for each image in the list 86 for(unsigned int i = 0; i<R[3]; i++){ //for each image in the list