Mercurial > fife-parpg
comparison engine/core/video/opengl/renderbackendopengl.cpp @ 417:14e8087cde2c
Fixed the problem where the opengl renderer was leaving traces on the screen after closing maps in the editor. [t:392]
Removed a member variable in SDLImage that was not being used.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Wed, 03 Feb 2010 20:04:39 +0000 |
parents | 66db8ce5dfa2 |
children | ad7969d9460b |
comparison
equal
deleted
inserted
replaced
416:a8bb57884723 | 417:14e8087cde2c |
---|---|
130 m_screen = new GLImage(screen); | 130 m_screen = new GLImage(screen); |
131 return m_screen; | 131 return m_screen; |
132 } | 132 } |
133 | 133 |
134 void RenderBackendOpenGL::startFrame() { | 134 void RenderBackendOpenGL::startFrame() { |
135 glDisable(GL_SCISSOR_TEST); | |
135 glClear(GL_COLOR_BUFFER_BIT); | 136 glClear(GL_COLOR_BUFFER_BIT); |
137 glEnable(GL_SCISSOR_TEST); | |
136 } | 138 } |
137 | 139 |
138 void RenderBackendOpenGL::endFrame() { | 140 void RenderBackendOpenGL::endFrame() { |
139 SDL_GL_SwapBuffers(); | 141 SDL_GL_SwapBuffers(); |
140 } | 142 } |
171 } | 173 } |
172 | 174 |
173 Image* RenderBackendOpenGL::createImage(const uint8_t* data, unsigned int width, unsigned int height) { | 175 Image* RenderBackendOpenGL::createImage(const uint8_t* data, unsigned int width, unsigned int height) { |
174 return new GLImage(data, width, height); | 176 return new GLImage(data, width, height); |
175 } | 177 } |
176 | 178 |
177 bool RenderBackendOpenGL::putPixel(int x, int y, int r, int g, int b) { | 179 bool RenderBackendOpenGL::putPixel(int x, int y, int r, int g, int b) { |
178 if ((x < 0) || (x >= (int)getWidth()) || (y < 0) || (y >= (int)getHeight())) { | 180 if ((x < 0) || (x >= (int)getWidth()) || (y < 0) || (y >= (int)getHeight())) { |
179 return false; | 181 return false; |
180 } | 182 } |
181 glColor4ub(r, g, b, 255); | 183 glColor4ub(r, g, b, 255); |
182 glBegin(GL_POINTS); | 184 glBegin(GL_POINTS); |
183 glVertex2i(x, y); | 185 glVertex2i(x, y); |
184 glEnd(); | 186 glEnd(); |
185 return true; | 187 return true; |
186 } | 188 } |
187 | 189 |
188 void RenderBackendOpenGL::drawLine(const Point& p1, const Point& p2, int r, int g, int b) { | 190 void RenderBackendOpenGL::drawLine(const Point& p1, const Point& p2, int r, int g, int b) { |
189 glColor4ub(r, g, b, 255); | 191 glColor4ub(r, g, b, 255); |
190 glBegin(GL_LINES); | 192 glBegin(GL_LINES); |
191 glVertex3f(p1.x+0.5f, p1.y+0.5f, 0); | 193 glVertex3f(p1.x+0.5f, p1.y+0.5f, 0); |
192 glVertex3f(p2.x+0.5f, p2.y+0.5f, 0); | 194 glVertex3f(p2.x+0.5f, p2.y+0.5f, 0); |
194 | 196 |
195 glBegin(GL_POINTS); | 197 glBegin(GL_POINTS); |
196 glVertex3f(p2.x+0.5f, p2.y+0.5f, 0); | 198 glVertex3f(p2.x+0.5f, p2.y+0.5f, 0); |
197 glEnd(); | 199 glEnd(); |
198 } | 200 } |
199 | 201 |
200 void RenderBackendOpenGL::drawQuad(const Point& p1, const Point& p2, const Point& p3, const Point& p4, int r, int g, int b) { | 202 void RenderBackendOpenGL::drawQuad(const Point& p1, const Point& p2, const Point& p3, const Point& p4, int r, int g, int b) { |
201 glColor4ub(r, g, b, 165); | 203 glColor4ub(r, g, b, 165); |
202 glBegin(GL_QUADS); | 204 glBegin(GL_QUADS); |
203 glVertex3f(p1.x, p1.y, 0); | 205 glVertex3f(p1.x, p1.y, 0); |
204 glVertex3f(p2.x, p2.y, 0); | 206 glVertex3f(p2.x, p2.y, 0); |
205 glVertex3f(p3.x, p3.y, 0); | 207 glVertex3f(p3.x, p3.y, 0); |
206 glVertex3f(p4.x, p4.y, 0); | 208 glVertex3f(p4.x, p4.y, 0); |
207 glEnd(); | 209 glEnd(); |
208 } | 210 } |
209 | 211 |
210 } | 212 } |