153 updateCameraFrontAndUp(); |
154 updateCameraFrontAndUp(); |
154 } |
155 } |
155 |
156 |
156 } initialCtx, ctx; |
157 } initialCtx, ctx; |
157 |
158 |
158 const struct { |
159 class Texture { |
159 int width = 640; |
160 public: |
160 int height = 398; |
161 GLuint id; |
161 GLfloat ratio = (GLfloat) width / (GLfloat) height; |
162 std::string fileName; |
162 } TEX; |
163 int width; |
|
164 int height; |
|
165 |
|
166 GLfloat getRatio() const { |
|
167 return (GLfloat) width / (GLfloat) height; |
|
168 } |
|
169 }; |
|
170 |
|
171 ImageLoader imageLoader; |
|
172 |
|
173 std::vector<Texture> textures; |
163 |
174 |
164 Configuration cfg; |
175 Configuration cfg; |
165 std::ostream& logOutput = std::cerr; |
176 std::ostream& logOutput = std::cerr; |
166 |
177 |
167 void renderImmediateMode(); |
178 void renderImmediateMode(); |
168 void runShaders(GLuint program); |
179 void runShaders(GLuint program); |
169 Window getRootWindow(Window defaultValue); |
180 Window getRootWindow(Window defaultValue); |
170 void log(LogLevel level, std::string message); |
181 void log(LogLevel level, std::string message); |
171 int setNonBlocking(int fd); |
182 int setNonBlocking(int fd); |
172 void loadVertices(); |
183 void loadVertices(); |
173 GLuint loadTexture(const std::string& fileName, int width, int height); |
184 Texture loadTexture(const std::string& fileName); |
174 void loadTextures(GLuint shaderProgram); |
185 void loadTextures(GLuint shaderProgram); |
175 GLuint loadShaders(); |
186 GLuint loadShaders(); |
176 public: |
187 public: |
177 Shark(const Configuration& cfg); |
188 Shark(const Configuration& cfg); |
178 virtual ~Shark(); |
189 virtual ~Shark(); |