Commit 63fcb5c8a420daa9261623df18565b18ddbdbe61
1 parent
a4042c24
added some temporary get methods to gl_texture.h for debugging purposes
Showing
2 changed files
with
19 additions
and
5 deletions
Show diff stats
gl/gl_texture.h
... | ... | @@ -17,7 +17,7 @@ includes not necessary (yet) |
17 | 17 | #include <iostream> |
18 | 18 | #include <vector> |
19 | 19 | #include "../grids/image_stack.h" |
20 | -#include <GL/glut.h> | |
20 | +//#include <GL/glut.h> | |
21 | 21 | #include <GL/glext.h> |
22 | 22 | #include "./error.h" |
23 | 23 | namespace stim{ |
... | ... | @@ -114,6 +114,7 @@ class gl_texture : public virtual image_stack<T> |
114 | 114 | |
115 | 115 | image_stack<T>::load_images(path.append("/*.jpg")); |
116 | 116 | |
117 | + glPixelStorei(GL_UNPACK_ALIGNMENT,1); | |
117 | 118 | glGenTextures(1, &texID); |
118 | 119 | CHECK_OPENGL_ERROR |
119 | 120 | glBindTexture(GL_TEXTURE_3D, texID); |
... | ... | @@ -132,21 +133,22 @@ class gl_texture : public virtual image_stack<T> |
132 | 133 | GL_TEXTURE_WRAP_T, GL_REPEAT); |
133 | 134 | glTexParameteri(GL_TEXTURE_3D, |
134 | 135 | GL_TEXTURE_WRAP_R, GL_REPEAT); |
135 | - | |
136 | 136 | CHECK_OPENGL_ERROR |
137 | 137 | glTexImage3D(GL_TEXTURE_3D, |
138 | 138 | 0, |
139 | - // GL_RGB8, | |
139 | + // GL_RGB16, | |
140 | 140 | 1, |
141 | 141 | R[1], |
142 | 142 | R[2], |
143 | 143 | R[3], |
144 | 144 | 0, |
145 | 145 | GL_LUMINANCE, |
146 | + // GL_RGB, | |
146 | 147 | GL_UNSIGNED_BYTE, |
147 | 148 | ptr); |
148 | 149 | //GL_UNSIGNED_BYTE can be TYPES, convert to GL equivalents |
149 | 150 | CHECK_OPENGL_ERROR |
151 | + glPixelStorei(GL_PACK_ALIGNMENT,1); | |
150 | 152 | } |
151 | 153 | //Binds the texture |
152 | 154 | void |
... | ... | @@ -154,6 +156,19 @@ class gl_texture : public virtual image_stack<T> |
154 | 156 | { |
155 | 157 | glBindTexture(GL_TEXTURE_3D, texID); |
156 | 158 | } |
159 | + | |
160 | + stim::vec<unsigned long,4> | |
161 | + getDims() | |
162 | + { | |
163 | + return R; | |
164 | + } | |
165 | + | |
166 | + T* | |
167 | + getData() | |
168 | + { | |
169 | + return ptr; | |
170 | + } | |
171 | + | |
157 | 172 | |
158 | 173 | //TO DO:::add methods for handling the cases of T and convert them to GL equivalent. |
159 | 174 | ... | ... |
image/image.h
1 | 1 | #ifndef STIM_IMAGE_H |
2 | 2 | #define STIM_IMAGE_H |
3 | - | |
3 | +#define cimg_use_jpeg //necessary for JPG files | |
4 | 4 | #include "CImg.h" |
5 | 5 | |
6 | 6 | #include <iostream> |
7 | - | |
8 | 7 | namespace stim{ |
9 | 8 | //This static class provides the STIM interface for loading images |
10 | 9 | // Use this interface for all image management - that way the actual library can be changed without problems | ... | ... |