36 #include "SDL_image.h"
38 #define ALPHA_REF 0.3f
121 static std::string backend_name =
"OpenGLe";
127 Uint32 flags = SDL_INIT_VIDEO;
128 if (SDL_InitSubSystem(flags) < 0)
129 throw SDLException(SDL_GetError());
130 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
131 SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
133 SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
138 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
144 SDL_Surface *img = IMG_Load(icon.c_str());
146 SDL_WM_SetIcon(img, 0);
147 SDL_FreeSurface(img);
151 SDL_WM_SetCaption(title.c_str(), 0);
161 if (bitsPerPixel != 0) {
162 uint16_t bpp = SDL_VideoModeOK(width, height, bitsPerPixel, flags);
164 throw SDLException(
"Selected video mode not supported!");
171 m_screen = SDL_SetVideoMode(width, height, bitsPerPixel, flags);
173 throw SDLException(
"Unable to set video mode selected!");
178 <<
"Videomode " << width <<
"x" << height
179 <<
" at " << int32_t(bitsPerPixel) <<
" bpp");
194 throw SDLException(SDL_GetError());
197 glViewport(0, 0, width, height);
198 glMatrixMode(GL_PROJECTION);
200 glOrtho(0, width, height, 0,
znear,
zfar);
201 glMatrixMode(GL_MODELVIEW);
204 glEnable(GL_CULL_FACE);
208 glPixelStorei(GL_PACK_ALIGNMENT, 1);
209 glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
211 glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
216 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
217 glEnable(GL_ALPHA_TEST);
219 glEnable(GL_DEPTH_TEST);
220 glDepthFunc(GL_LEQUAL);
222 glEnable(GL_SCISSOR_TEST);
224 glEnableClientState(GL_VERTEX_ARRAY);
243 SDL_GL_SwapBuffers();
262 if (32 == surface->format->BitsPerPixel
275 && surface->flags & SDL_SRCALPHA ) {
282 SDL_Surface* conv = SDL_ConvertSurface(surface, &
m_rgba_format, SDL_SWSURFACE | SDL_SRCALPHA);
285 SDL_FreeSurface( surface );
296 if (32 == surface->format->BitsPerPixel
309 && surface->flags & SDL_SRCALPHA ) {
316 SDL_Surface* conv = SDL_ConvertSurface(surface, &
m_rgba_format, SDL_SWSURFACE | SDL_SRCALPHA);
319 SDL_FreeSurface( surface );
324 return new GLeImage(data, width, height);
328 return new GLeImage(name, data, width, height);
335 glDisable(GL_COLOR_MATERIAL);
336 }
else if (lighting != 0) {
340 glColorMaterial(GL_FRONT, GL_DIFFUSE);
341 glEnable(GL_COLOR_MATERIAL);
355 glActiveTexture(GL_TEXTURE0 + texUnit);
359 glEnable(GL_TEXTURE_2D);
361 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
371 glActiveTexture(GL_TEXTURE0 + texUnit);
375 glDisable(GL_TEXTURE_2D);
377 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
388 glActiveTexture(GL_TEXTURE0 + texUnit);
391 glBindTexture(GL_TEXTURE_2D, texId);
398 glBindTexture(GL_TEXTURE_2D, texId);
404 glEnable(GL_LIGHTING);
411 glDisable(GL_LIGHTING);
418 GLfloat lightDiffuse[] = {red, green, blue, 1.0f};
419 glLightfv(GL_LIGHT0, GL_DIFFUSE, lightDiffuse);
429 glEnable(GL_STENCIL_TEST);
436 glDisable(GL_STENCIL_TEST);
458 glClearStencil(buffer);
461 glClear(GL_STENCIL_BUFFER_BIT);
467 glEnable(GL_ALPHA_TEST);
474 glDisable(GL_ALPHA_TEST);
481 glAlphaFunc(GL_GREATER, ref_alpha);
486 glEnable(GL_DEPTH_TEST);
493 glDisable(GL_DEPTH_TEST);
506 glActiveTexture(GL_TEXTURE1);
507 glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, rgbaf);
508 glActiveTexture(GL_TEXTURE0);
515 glEnable(GL_SCISSOR_TEST);
522 glDisable(GL_SCISSOR_TEST);
531 case 0 : src_fact = GL_ZERO;
break;
532 case 1 : src_fact = GL_ONE;
break;
533 case 2 : src_fact = GL_DST_COLOR;
break;
534 case 3 : src_fact = GL_ONE_MINUS_DST_COLOR;
break;
535 case 4 : src_fact = GL_SRC_ALPHA;
break;
536 case 5 : src_fact = GL_ONE_MINUS_SRC_ALPHA;
break;
537 case 6 : src_fact = GL_DST_ALPHA;
break;
538 case 7 : src_fact = GL_ONE_MINUS_DST_ALPHA;
break;
540 default : src_fact = GL_DST_COLOR;
break;
544 case 0 : dst_fact = GL_ZERO;
break;
545 case 1 : dst_fact = GL_ONE;
break;
546 case 2 : dst_fact = GL_SRC_COLOR;
break;
547 case 3 : dst_fact = GL_ONE_MINUS_SRC_COLOR;
break;
548 case 4 : dst_fact = GL_SRC_ALPHA;
break;
549 case 5 : dst_fact = GL_ONE_MINUS_SRC_ALPHA;
break;
550 case 6 : dst_fact = GL_DST_ALPHA;
break;
551 case 7 : dst_fact = GL_ONE_MINUS_DST_ALPHA;
break;
553 default : dst_fact = GL_SRC_ALPHA;
break;
559 glBlendFunc(src_fact, dst_fact);
568 while (count != elements) {
608 glDisableClientState(GL_COLOR_ARRAY);
619 glDrawArrays(GL_QUADS, iter->index, iter->elements);
637 glDrawArrays(GL_QUADS, iter->index, iter->elements);
645 glEnableClientState(GL_COLOR_ARRAY);
651 glActiveTexture(GL_TEXTURE1);
652 glEnable(GL_TEXTURE_2D);
653 glActiveTexture(GL_TEXTURE0);
658 glClientActiveTexture(GL_TEXTURE1);
660 glClientActiveTexture(GL_TEXTURE0);
666 GLsizei elements = 0;
674 if (iter->texture_id != texture_id || memcmp(rgba, iter->rgba,
sizeof(
uint8_t)*4)) {
676 glDrawArrays(GL_QUADS, index, elements);
682 texture_id = iter->texture_id;
683 elements = iter->size;;
684 memcpy(rgba, iter->rgba,
sizeof(
uint8_t)*4);
686 elements += iter->size;
689 glDrawArrays(GL_QUADS, index, elements);
691 glActiveTexture(GL_TEXTURE1);
692 glDisable(GL_TEXTURE_2D);
693 glActiveTexture(GL_TEXTURE0);
708 glClientActiveTexture(GL_TEXTURE0);
714 GLsizei elements = 0;
720 if (iter->texture_id != texture_id) {
722 glDrawArrays(GL_QUADS, index, elements);
727 texture_id = iter->texture_id;
728 elements = iter->size;;
730 elements += iter->size;
733 glDrawArrays(GL_QUADS, index, elements);
747 bool texture =
false;
749 bool blending =
false;
750 bool stencil =
false;
754 glEnableClientState(GL_COLOR_ARRAY);
757 glColorPointer(4, GL_UNSIGNED_BYTE, stride, &
m_render_datas[0].color);
768 GLenum mode = GL_QUADS;
778 if (iter->mode != mode) {
782 if (iter->texture_id != texture_id) {
787 if (iter->src != src || iter->dst != dst) {
806 elements += iter->size;
811 glDrawArrays(mode, index, elements);
815 elements = iter->size;
824 if (iter->texture_id != 0) {
827 texture_id = iter->texture_id;
845 if (iter->stencil_test) {
846 setStencilTest(iter->stencil_ref, iter->stencil_op, iter->stencil_func);
860 glDrawArrays(mode, index, elements);
867 glDisableClientState(GL_COLOR_ARRAY);
874 if ((x < 0) || (x >= (int32_t)
m_target->w) ||
875 (y < 0) || (y >= (int32_t)
m_target->h)) {
879 rd.
vertex[0] =
static_cast<float>(x);
880 rd.
vertex[1] =
static_cast<float>(y);
895 rd.
vertex[0] =
static_cast<float>(p1.
x);
896 rd.
vertex[1] =
static_cast<float>(p1.
y);
903 rd.
vertex[0] =
static_cast<float>(p2.
x);
904 rd.
vertex[1] =
static_cast<float>(p2.
y);
913 rd.
vertex[0] =
static_cast<float>(p1.
x);
914 rd.
vertex[1] =
static_cast<float>(p1.
y);
921 rd.
vertex[0] =
static_cast<float>(p2.
x);
922 rd.
vertex[1] =
static_cast<float>(p2.
y);
925 rd.
vertex[0] =
static_cast<float>(p3.
x);
926 rd.
vertex[1] =
static_cast<float>(p3.
y);
935 rd.
vertex[0] =
static_cast<float>(p.
x);
936 rd.
vertex[1] =
static_cast<float>(p.
y);
942 rd.
vertex[0] =
static_cast<float>(p.
x+w);
945 rd.
vertex[1] =
static_cast<float>(p.
y+h);
948 rd.
vertex[0] =
static_cast<float>(p.
x);
957 rd.
vertex[0] =
static_cast<float>(p.
x);
958 rd.
vertex[1] =
static_cast<float>(p.
y);
965 rd.
vertex[1] =
static_cast<float>(p.
y+h);
968 rd.
vertex[0] =
static_cast<float>(p.
x+w);
971 rd.
vertex[1] =
static_cast<float>(p.
y);
980 rd.
vertex[0] =
static_cast<float>(p1.
x);
981 rd.
vertex[1] =
static_cast<float>(p1.
y);
988 rd.
vertex[0] =
static_cast<float>(p2.
x);
989 rd.
vertex[1] =
static_cast<float>(p2.
y);
992 rd.
vertex[0] =
static_cast<float>(p3.
x);
993 rd.
vertex[1] =
static_cast<float>(p3.
y);
996 rd.
vertex[0] =
static_cast<float>(p4.
x);
997 rd.
vertex[1] =
static_cast<float>(p4.
y);
1006 rd.
vertex[0] =
static_cast<float>(p.
x-size);
1007 rd.
vertex[1] =
static_cast<float>(p.
y+size);
1014 rd.
vertex[0] =
static_cast<float>(p.
x+size);
1017 rd.
vertex[1] =
static_cast<float>(p.
y-size);
1020 rd.
vertex[0] =
static_cast<float>(p.
x-size);
1031 for(
float angle=0; angle<=
Mathf::twoPi(); angle+=step){
1032 rd.
vertex[0] =
static_cast<float>(p.
x);
1033 rd.
vertex[1] =
static_cast<float>(p.
y);
1035 rd.
color[1] = green;
1037 rd.
color[3] = intensity;
1059 rd.
vertex[0] =
static_cast<float>(rect.
x);
1060 rd.
vertex[1] =
static_cast<float>(rect.
y);
1061 rd.
texel[0] = st[0];
1062 rd.
texel[1] = st[1];
1066 rd.
color[3] = alpha;
1069 rd.
vertex[0] =
static_cast<float>(rect.
x);
1070 rd.
vertex[1] =
static_cast<float>(rect.
y+rect.
h);
1071 rd.
texel[1] = st[3];
1074 rd.
vertex[0] =
static_cast<float>(rect.
x+rect.
w);
1075 rd.
vertex[1] =
static_cast<float>(rect.
y+rect.
h);
1076 rd.
texel[0] = st[2];
1079 rd.
vertex[0] =
static_cast<float>(rect.
x+rect.
w);
1080 rd.
vertex[1] =
static_cast<float>(rect.
y);
1081 rd.
texel[1] = st[1];
1089 if (!forceNewBatch) {
1091 if (it->texture_id == texture_id) {
1092 if (it->elements < it->max_size - 4) {
1098 static int last_forced = 0;
1104 obj.
index += last_forced * 4;
1112 if (!forceNewBatch) {
1133 rd->
vertex[0] =
static_cast<float>(rect.
x);
1134 rd->
vertex[1] =
static_cast<float>(rect.
y);
1136 rd->
texel[0] = st[0];
1137 rd->
texel[1] = st[1];
1140 rd->
vertex[0] =
static_cast<float>(rect.
x);
1141 rd->
vertex[1] =
static_cast<float>(rect.
y+rect.
h);
1143 rd->
texel[0] = st[0];
1144 rd->
texel[1] = st[3];
1147 rd->
vertex[0] =
static_cast<float>(rect.
x+rect.
w);
1148 rd->
vertex[1] =
static_cast<float>(rect.
y+rect.
h);
1150 rd->
texel[0] = st[2];
1151 rd->
texel[1] = st[3];
1154 rd->
vertex[0] =
static_cast<float>(rect.
x+rect.
w);
1155 rd->
vertex[1] =
static_cast<float>(rect.
y);
1157 rd->
texel[0] = st[2];
1158 rd->
texel[1] = st[1];
1162 rd.
vertex[0] =
static_cast<float>(rect.
x);
1163 rd.
vertex[1] =
static_cast<float>(rect.
y);
1165 rd.
texel[0] = st[0];
1166 rd.
texel[1] = st[1];
1175 rd.
vertex[0] =
static_cast<float>(rect.
x);
1176 rd.
vertex[1] =
static_cast<float>(rect.
y+rect.
h);
1177 rd.
texel[1] = st[3];
1181 rd.
vertex[0] =
static_cast<float>(rect.
x+rect.
w);
1182 rd.
vertex[1] =
static_cast<float>(rect.
y+rect.
h);
1183 rd.
texel[0] = st[2];
1187 rd.
vertex[0] =
static_cast<float>(rect.
x+rect.
w);
1188 rd.
vertex[1] =
static_cast<float>(rect.
y);
1189 rd.
texel[1] = st[1];
1194 ro.
rgba[0] = rgba[0];
1195 ro.
rgba[1] = rgba[1];
1196 ro.
rgba[2] = rgba[2];
1197 ro.
rgba[3] = rgba[3];
1202 rd.
vertex[0] =
static_cast<float>(rect.
x);
1203 rd.
vertex[1] =
static_cast<float>(rect.
y);
1205 rd.
texel[0] = st[0];
1206 rd.
texel[1] = st[1];
1210 rd.
color[3] = alpha;
1213 rd.
vertex[0] =
static_cast<float>(rect.
x);
1214 rd.
vertex[1] =
static_cast<float>(rect.
y+rect.
h);
1215 rd.
texel[1] = st[3];
1218 rd.
vertex[0] =
static_cast<float>(rect.
x+rect.
w);
1219 rd.
vertex[1] =
static_cast<float>(rect.
y+rect.
h);
1220 rd.
texel[0] = st[2];
1223 rd.
vertex[0] =
static_cast<float>(rect.
x+rect.
w);
1224 rd.
vertex[1] =
static_cast<float>(rect.
y);
1225 rd.
texel[1] = st[1];
1231 ro.
rgba[0] = rgba[0];
1232 ro.
rgba[1] = rgba[1];
1233 ro.
rgba[2] = rgba[2];
1234 ro.
rgba[3] = rgba[3];
1242 glActiveTexture(GL_TEXTURE1);
1243 glEnable(GL_TEXTURE_2D);
1249 uint8_t dummydata[3] = {127, 127, 127};
1251 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
1252 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1253 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
1254 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
1255 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, 1, 1, 0,
1256 GL_RGB, GL_UNSIGNED_BYTE, dummydata);
1263 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
1264 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE);
1265 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE);
1268 glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE0);
1269 glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_TEXTURE0);
1270 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
1271 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
1278 glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_CONSTANT);
1279 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
1283 glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_RGB, GL_CONSTANT);
1284 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA);
1287 glActiveTexture(GL_TEXTURE1);
1288 glDisable(GL_TEXTURE_2D);
1289 glActiveTexture(GL_TEXTURE0);
1300 SDL_Surface *surface = SDL_CreateRGBSurface(SDL_SWSURFACE, swidth, sheight, 24,
1307 SDL_LockSurface(surface);
1308 pixels =
new uint8_t[swidth * sheight * 3];
1309 glReadPixels(0, 0, swidth, sheight, GL_RGB, GL_UNSIGNED_BYTE, reinterpret_cast<GLvoid*>(pixels));
1310 uint8_t *imagepixels =
reinterpret_cast<uint8_t*
>(surface->pixels);
1312 for (int32_t y = (sheight - 1); y >= 0; --y) {
1313 uint8_t *rowbegin = pixels + y * swidth * 3;
1314 uint8_t *rowend = rowbegin + swidth * 3;
1316 std::copy(rowbegin, rowend, imagepixels);
1319 imagepixels += surface->pitch;
1322 SDL_UnlockSurface(surface);
1325 SDL_FreeSurface(surface);
1332 const bool same_size = (width == swidth && height == sheight);
1334 if (width < 1 || height < 1) {
1345 SDL_Surface* src = SDL_CreateRGBSurface(SDL_SWSURFACE, swidth, sheight, 32,
1352 if (SDL_MUSTLOCK(src)) {
1353 SDL_LockSurface(src);
1355 pixels =
new uint8_t[swidth * sheight * 4];
1356 glReadPixels(0, 0, swidth, sheight, GL_RGBA, GL_UNSIGNED_BYTE, reinterpret_cast<GLvoid*>(pixels));
1360 for (int32_t y = (sheight - 1); y >= 0; --y) {
1361 uint8_t *rowbegin = pixels + y * swidth * 4;
1362 uint8_t *rowend = rowbegin + swidth * 4;
1364 std::copy(rowbegin, rowend, imagepixels);
1367 imagepixels += src->pitch;
1371 SDL_Surface* dst = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32,
1375 uint32_t* src_help_pointer = src_pointer;
1378 int32_t x, y, *sx_ca, *sy_ca;
1379 int32_t sx =
static_cast<int32_t
>(0xffff * src->w / dst->w);
1380 int32_t sy =
static_cast<int32_t
>(0xffff * src->h / dst->h);
1385 int32_t* sx_a =
new int32_t[dst->w + 1];
1387 for (x = 0; x <= dst->w; x++) {
1394 int32_t* sy_a =
new int32_t[dst->h + 1];
1396 for (y = 0; y <= dst->h; y++) {
1406 if (SDL_MUSTLOCK(dst)) {
1407 SDL_LockSurface(dst);
1410 for (y = 0; y < dst->h; y++) {
1411 src_pointer = src_help_pointer;
1413 for (x = 0; x < dst->w; x++) {
1414 *dst_pointer = *src_pointer;
1416 src_pointer += (*sx_ca >> 16);
1420 src_help_pointer = (
uint32_t*)((
uint8_t*)src_help_pointer + (*sy_ca >> 16) * src->pitch);
1423 if (SDL_MUSTLOCK(dst)) {
1424 SDL_UnlockSurface(dst);
1426 if (SDL_MUSTLOCK(src)) {
1427 SDL_UnlockSurface(src);
1433 SDL_FreeSurface(src);
1434 SDL_FreeSurface(dst);
1441 glScissor(cliparea.
x,
getHeight() - cliparea.
y - cliparea.
h, cliparea.
w, cliparea.
h);
1447 glClearColor(red, green, blue, 0.0);
1450 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
1467 GLuint targetid = glimage->
getTexId();
1474 GLubyte* pixels =
new GLubyte[w*h*4];
1476 glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
1477 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
1484 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,
m_fbo_id);
1485 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
1486 GL_TEXTURE_2D, targetid, 0);
1489 glViewport(0, 0, w, h);
1490 glMatrixMode(GL_PROJECTION);
1493 glOrtho(0, w, 0, h, -1, 1);
1494 glMatrixMode(GL_MODELVIEW);
1496 glCullFace(GL_FRONT);
1499 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
1516 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
1519 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 0, 0,
1521 glClear(GL_DEPTH_BUFFER_BIT);
1526 glMatrixMode(GL_PROJECTION);
1529 glMatrixMode(GL_MODELVIEW);
1530 glCullFace(GL_BACK);
void disableScissorTest()
Implements an Image using experimental OpenGL.
std::vector< RenderZData2T > m_render_trans_datas
Abstract interface for all the renderbackends.
virtual void detachRenderTarget()
Detaches current render surface.
T * get() const
allows direct access to underlying pointer
void setAlphaTest(float ref_alpha)
virtual void drawRectangle(const Point &p, uint16_t w, uint16_t h, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
Draws an axis parallel rectangle.
virtual void addImageToArray(uint32_t id, const Rect &rec, float const *st, uint8_t alpha, uint8_t const *rgba)
Add the Image data to the array.
virtual void attachRenderTarget(ImagePtr &img, bool discard)
Attaches given image as a new render surface.
static const int buffer_default_size
virtual void init(const std::string &driver)
Initializes the backend.
virtual void drawQuad(const Point &p1, const Point &p2, const Point &p3, const Point &p4, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
Draws quad between given points with given RGBA.
virtual void changeBlending(int32_t scr, int32_t dst)
Change the Blendingmodel.
T h
Height of the rectangle.
void setCompressed(bool compressed)
virtual void createMainScreen(const ScreenMode &mode, const std::string &title, const std::string &icon)
Creates the mainscreen (the display window).
Helper class to create log strings out from separate parts Usage: LMsg("some text") << variable << "...
RenderBackendOpenGLe(const SDL_Color &colorkey)
SDL_PixelFormat m_rgba_format
std::vector< RenderObject > m_render_objects
std::vector< RenderZObject > m_renderZ_objects_forced
virtual Image * createImage(IResourceLoader *loader=0)
uint32_t getHeight() const
uint32_t getSDLFlags() const
Returns the SDL flags used when testing this mode.
static void saveAsPng(const std::string &filename, const SDL_Surface &surface)
Saves the SDL_Surface to png format.
uint16_t getBPP() const
Returns the number of bits per pixel this mode uses.
void enableTextures(uint32_t texUnit)
static Logger _log(LM_AUDIO)
virtual void drawLine(const Point &p1, const Point &p2, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
Draws line between given points with given RGBA.
static const int max_quads_per_texbatch
virtual void renderVertexArrays()
Render the Vertex Arrays, only for primitives (points, lines,...)
struct FIFE::RenderBackendOpenGLe::currentState m_state
void setEnvironmentalColor(const uint8_t *rgba)
void setStencilTest(uint8_t stencil_ref, GLenum stencil_op, GLenum stencil_func)
const Rect & getArea() const
virtual void endFrame()
Called when a frame is finished and ready to be displayed.
virtual void fillRectangle(const Point &p, uint16_t w, uint16_t h, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
Draws a filled axis parallel rectangle.
std::vector< RenderZObject > m_renderZ_objects
virtual void setLighting(float red, float green, float blue)
Set colors for lighting.
uint32_t getHeight() const
virtual const std::string & getName() const
The name of the renderbackend.
SDL_Surface * getSurface()
std::vector< RenderObject > m_render_objects2T
std::vector< RenderZData2T > m_render_datas2T
virtual void startFrame()
Called when a new frame starts.
virtual void resetLighting()
Reset lighting with default values.
virtual void startFrame()
Called when a new frame starts.
virtual void changeRenderInfos(uint16_t elements, int32_t src, int32_t dst, bool light, bool stentest, uint8_t stenref, GLConstants stenop, GLConstants stenfunc)
Dirty helper function to change the render infos.
void prepareForOverlays()
virtual void setScreenMode(const ScreenMode &mode)
Sets the mainscreen display mode.
uint16_t getHeight() const
Returns the height of the screen mode.
virtual bool putPixel(int32_t x, int32_t y, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
Writes pixel to given position.
virtual void drawTriangle(const Point &p1, const Point &p2, const Point &p3, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
Draws triangle between given points with given RGBA.
std::vector< RenderZData > m_renderZ_datas
uint32_t getWidth() const
uint16_t getWidth() const
Returns the width of the screen mode.
virtual void setLightingModel(uint32_t lighting)
Initializes the light.
virtual void addImageToArrayZ(uint32_t id, const Rect &rec, float vertexZ, float const *st, uint8_t alpha, bool forceNewBatch, uint8_t const *rgba)
SDL_Color m_backgroundcolor
#define FL_LOG(logger, msg)
uint32_t getWidth() const
bool isCompressed() const
virtual void drawLightPrimitive(const Point &p, uint8_t intensity, float radius, int32_t subdivisions, float xstretch, float ystretch, uint8_t red, uint8_t green, uint8_t blue)
Draws a light primitive that based on a triangle fan.
virtual void endFrame()
Called when a frame is finished and ready to be displayed.
virtual void captureScreen(const std::string &filename)
Creates a Screenshot and saves it to a file.
virtual void drawVertex(const Point &p, const uint8_t size, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
Draws a quad that represents a vertex with given RGBA.
virtual void clearBackBuffer()
Forces a clear of the backbuffer.
virtual void forceLoadInternal()=0
Forces to load the image into internal memory of GPU.
virtual ~RenderBackendOpenGLe()
std::vector< RenderData > m_render_datas
virtual uint32_t getLightingModel() const
Gets the current light model.
void deinit()
Performs cleanup actions.
void bindTexture(uint32_t texUnit, GLuint texId)
virtual void resetStencilBuffer(uint8_t buffer)
Reset stencil buffer with given value.
RenderObject(GLenum m, uint16_t s, uint32_t t=0)
void disableTextures(uint32_t texUnit)
T w
Width of the rectangle.
virtual void setClipArea(const Rect &cliparea, bool clear)
Sets given clip area into image.
RenderZObject * getRenderBufferObject(GLuint texture_id, bool unlit=false)
std::vector< RenderObject > m_render_trans_objects
void disableStencilTest()