Mercurial > fife-parpg
comparison engine/core/video/opengl/renderbackendopengl.cpp @ 669:46258f467c8c
* Fixed the clear screen problems. The screen is now automatically cleared every frame by the engine if there are no maps loaded. In the process I removed the setClearBackBuffer() function from the RenderBackend.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Mon, 08 Nov 2010 21:36:38 +0000 |
parents | e3140f01749d |
children |
comparison
equal
deleted
inserted
replaced
668:e8a799239384 | 669:46258f467c8c |
---|---|
45 SDL_Surface* testsurface = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCALPHA, 1, 1, 32, | 45 SDL_Surface* testsurface = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCALPHA, 1, 1, 32, |
46 RMASK, GMASK, BMASK ,AMASK); | 46 RMASK, GMASK, BMASK ,AMASK); |
47 | 47 |
48 m_rgba_format = *(testsurface->format); | 48 m_rgba_format = *(testsurface->format); |
49 SDL_FreeSurface(testsurface); | 49 SDL_FreeSurface(testsurface); |
50 m_clear = false; | |
51 m_lightmodel = 0; | 50 m_lightmodel = 0; |
52 m_light_enabled = false; | 51 m_light_enabled = false; |
53 m_stencil_enabled = false; | 52 m_stencil_enabled = false; |
54 m_alpha_enabled = false; | 53 m_alpha_enabled = false; |
55 m_sten_ref = 0; | 54 m_sten_ref = 0; |
160 return m_screen; | 159 return m_screen; |
161 } | 160 } |
162 | 161 |
163 | 162 |
164 void RenderBackendOpenGL::startFrame() { | 163 void RenderBackendOpenGL::startFrame() { |
165 if(m_clear) { | |
166 clearBackBuffer(); | |
167 } | |
168 } | 164 } |
169 | 165 |
170 void RenderBackendOpenGL::endFrame() { | 166 void RenderBackendOpenGL::endFrame() { |
171 SDL_GL_SwapBuffers(); | 167 SDL_GL_SwapBuffers(); |
172 } | 168 } |
348 | 344 |
349 void RenderBackendOpenGL::changeBlending(int src, int dst) { | 345 void RenderBackendOpenGL::changeBlending(int src, int dst) { |
350 GLenum src_fact; | 346 GLenum src_fact; |
351 GLenum dst_fact; | 347 GLenum dst_fact; |
352 | 348 |
353 switch(src) { | 349 switch(src) { |
354 case 0 : src_fact = GL_ZERO; break; | 350 case 0 : src_fact = GL_ZERO; break; |
355 case 1 : src_fact = GL_ONE; break; | 351 case 1 : src_fact = GL_ONE; break; |
356 case 2 : src_fact = GL_DST_COLOR; break; | 352 case 2 : src_fact = GL_DST_COLOR; break; |
357 case 3 : src_fact = GL_ONE_MINUS_DST_COLOR; break; | 353 case 3 : src_fact = GL_ONE_MINUS_DST_COLOR; break; |
358 case 4 : src_fact = GL_SRC_ALPHA; break; | 354 case 4 : src_fact = GL_SRC_ALPHA; break; |
361 case 7 : src_fact = GL_ONE_MINUS_DST_ALPHA; break; | 357 case 7 : src_fact = GL_ONE_MINUS_DST_ALPHA; break; |
362 | 358 |
363 default : src_fact = GL_DST_COLOR; break; | 359 default : src_fact = GL_DST_COLOR; break; |
364 } | 360 } |
365 | 361 |
366 switch(dst) { | 362 switch(dst) { |
367 case 0 : dst_fact = GL_ZERO; break; | 363 case 0 : dst_fact = GL_ZERO; break; |
368 case 1 : dst_fact = GL_ONE; break; | 364 case 1 : dst_fact = GL_ONE; break; |
369 case 2 : dst_fact = GL_SRC_COLOR; break; | 365 case 2 : dst_fact = GL_SRC_COLOR; break; |
370 case 3 : dst_fact = GL_ONE_MINUS_SRC_COLOR; break; | 366 case 3 : dst_fact = GL_ONE_MINUS_SRC_COLOR; break; |
371 case 4 : dst_fact = GL_SRC_ALPHA; break; | 367 case 4 : dst_fact = GL_SRC_ALPHA; break; |
478 } else { | 474 } else { |
479 glColor4ub(0, 0, 0, 255); | 475 glColor4ub(0, 0, 0, 255); |
480 } | 476 } |
481 for(float angle=0; angle<=Mathf::twoPi(); angle+=(Mathf::twoPi()/subdivisions)){ | 477 for(float angle=0; angle<=Mathf::twoPi(); angle+=(Mathf::twoPi()/subdivisions)){ |
482 glVertex2f( radius*Mathf::Cos(angle)*xstretch + p.x, | 478 glVertex2f( radius*Mathf::Cos(angle)*xstretch + p.x, |
483 radius*Mathf::Sin(angle)*ystretch + p.y); | 479 radius*Mathf::Sin(angle)*ystretch + p.y); |
484 } | 480 } |
485 glVertex2f(p.x+radius*xstretch, p.y); | 481 glVertex2f(p.x+radius*xstretch, p.y); |
486 glEnd(); | 482 glEnd(); |
487 } | 483 } |
488 } | 484 } |