Ticket #1624: galleryopengl.diff
File galleryopengl.diff, 1.9 KB (added by , 20 years ago) |
---|
-
glsingleview.cpp
80 80 gContext->GetScreenSettings(xbase, screenwidth, wmult, 81 81 ybase, screenheight, hmult); 82 82 83 m_w = min(1024, 1 << (int)ceil(log((float)screenwidth)/log((float)2)));84 m_h = min(1024, 1 << (int)ceil(log((float)screenheight)/log((float)2)));83 m_w = NearestGLTextureSize(screenwidth); 84 m_h = NearestGLTextureSize(screenheight); 85 85 86 86 // -------------------------------------------------------------------- 87 87 … … 179 179 } 180 180 } 181 181 182 int GLSingleView::NearestGLTextureSize(int v) 183 { 184 int n = 0, last = 0; 185 int s; 186 187 for (int s = 0; s < 32; ++s) 188 { 189 if (((v >> s) & 1) == 1) 190 { 191 ++n; 192 last = s; 193 } 194 } 195 196 if (n > 1) 197 s = 1 << (last + 1); 198 else 199 s = 1 << last; 200 201 if (s > m_maxTexDim) 202 s = m_maxTexDim; 203 204 return s; 205 } 206 207 182 208 GLSingleView::~GLSingleView() 183 209 { 184 210 if (m_sequence) … … 220 246 // Enable perspective vision 221 247 glClearDepth(1.0f); 222 248 249 GLint param; 250 glGetIntegerv(GL_MAX_TEXTURE_SIZE, ¶m); 251 m_maxTexDim = param; 252 223 253 loadImage(); 224 254 } 225 255 -
glsingleview.h
102 102 103 103 GLuint m_texInfo; 104 104 bool m_showInfo; 105 105 int m_maxTexDim; 106 106 107 int m_i; 107 108 int m_dir; 108 109 float m_points[40][40][3]; … … 114 115 SequenceBase *m_sequence; 115 116 116 117 private: 117 118 119 int NearestGLTextureSize(int); 118 120 void advanceFrame(); 119 121 void retreatFrame(); 120 122 void loadImage();