Ticket #1624: galleryopengl2.diff
File galleryopengl2.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)));85 86 83 // -------------------------------------------------------------------- 87 84 88 85 // remove all dirs from m_itemList; … … 179 176 } 180 177 } 181 178 179 int GLSingleView::NearestGLTextureSize(int v) 180 { 181 int n = 0, last = 0; 182 int s; 183 184 for (int s = 0; s < 32; ++s) 185 { 186 if (((v >> s) & 1) == 1) 187 { 188 ++n; 189 last = s; 190 } 191 } 192 193 if (n > 1) 194 s = 1 << (last + 1); 195 else 196 s = 1 << last; 197 198 if (s > m_maxTexDim) 199 s = m_maxTexDim; 200 201 return s; 202 } 203 204 182 205 GLSingleView::~GLSingleView() 183 206 { 184 207 if (m_sequence) … … 220 243 // Enable perspective vision 221 244 glClearDepth(1.0f); 222 245 246 GLint param; 247 glGetIntegerv(GL_MAX_TEXTURE_SIZE, ¶m); 248 m_maxTexDim = param; 249 250 m_w = NearestGLTextureSize(screenwidth); 251 m_h = NearestGLTextureSize(screenheight); 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();