~ubuntu-branches/ubuntu/trusty/manaplus/trusty-proposed

« back to all changes in this revision

Viewing changes to src/nullopenglgraphics.cpp

  • Committer: Package Import Robot
  • Author(s): Patrick Matthäi
  • Date: 2013-09-17 10:35:51 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20130917103551-az7p3nz9jgxwqjfn
Tags: 1.3.9.15-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  The ManaPlus Client
3
 
 *  Copyright (C) 2004-2009  The Mana World Development Team
4
 
 *  Copyright (C) 2009-2010  The Mana Developers
5
 
 *  Copyright (C) 2011-2013  The ManaPlus Developers
6
 
 *
7
 
 *  This file is part of The ManaPlus Client.
8
 
 *
9
 
 *  This program is free software; you can redistribute it and/or modify
10
 
 *  it under the terms of the GNU General Public License as published by
11
 
 *  the Free Software Foundation; either version 2 of the License, or
12
 
 *  any later version.
13
 
 *
14
 
 *  This program is distributed in the hope that it will be useful,
15
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 
 *  GNU General Public License for more details.
18
 
 *
19
 
 *  You should have received a copy of the GNU General Public License
20
 
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
 
 */
22
 
 
23
 
#include "main.h"
24
 
#if defined USE_OPENGL
25
 
 
26
 
#include "nullopenglgraphics.h"
27
 
 
28
 
#include "configuration.h"
29
 
#include "graphicsmanager.h"
30
 
#include "graphicsvertexes.h"
31
 
#include "logger.h"
32
 
 
33
 
#include "resources/image.h"
34
 
#include "resources/openglimagehelper.h"
35
 
 
36
 
#include "utils/stringutils.h"
37
 
 
38
 
#include <SDL.h>
39
 
 
40
 
#include "debug.h"
41
 
 
42
 
GLuint NullOpenGLGraphics::mLastImage = 0;
43
 
#ifdef DEBUG_DRAW_CALLS
44
 
unsigned int NullOpenGLGraphics::mDrawCalls = 0;
45
 
unsigned int NullOpenGLGraphics::mLastDrawCalls = 0;
46
 
#endif
47
 
 
48
 
NullOpenGLGraphics::NullOpenGLGraphics():
49
 
    mFloatTexArray(nullptr),
50
 
    mIntTexArray(nullptr),
51
 
    mIntVertArray(nullptr),
52
 
    mTexture(false),
53
 
    mIsByteColor(false),
54
 
    mByteColor(),
55
 
    mFloatColor(1.0f),
56
 
    mMaxVertices(500),
57
 
    mColorAlpha(false),
58
 
#ifdef DEBUG_BIND_TEXTURE
59
 
    mOldTexture(),
60
 
    mOldTextureId(0),
61
 
#endif
62
 
    mFbo()
63
 
{
64
 
    mOpenGL = 100;
65
 
    mName = "null OpenGL";
66
 
}
67
 
 
68
 
NullOpenGLGraphics::~NullOpenGLGraphics()
69
 
{
70
 
    delete [] mFloatTexArray;
71
 
    delete [] mIntTexArray;
72
 
    delete [] mIntVertArray;
73
 
}
74
 
 
75
 
void NullOpenGLGraphics::initArrays()
76
 
{
77
 
    mMaxVertices = graphicsManager.getMaxVertices();
78
 
    if (mMaxVertices < 500)
79
 
        mMaxVertices = 500;
80
 
    else if (mMaxVertices > 1024)
81
 
        mMaxVertices = 1024;
82
 
 
83
 
    // need alocate small size, after if limit reached reallocate to double size
84
 
    vertexBufSize = mMaxVertices;
85
 
    const int sz = mMaxVertices * 4 + 30;
86
 
    mFloatTexArray = new GLfloat[sz];
87
 
    mIntTexArray = new GLint[sz];
88
 
    mIntVertArray = new GLint[sz];
89
 
}
90
 
 
91
 
bool NullOpenGLGraphics::setVideoMode(const int w, const int h,
92
 
                                      const int bpp, const bool fs,
93
 
                                      const bool hwaccel, const bool resize,
94
 
                                      const bool noFrame)
95
 
{
96
 
    setMainFlags(w, h, bpp, fs, hwaccel, resize, noFrame);
97
 
 
98
 
    return setOpenGLMode();
99
 
}
100
 
 
101
 
static inline void drawQuad(const Image *const image A_UNUSED,
102
 
                            const int srcX A_UNUSED, const int srcY A_UNUSED,
103
 
                            const int dstX A_UNUSED, const int dstY A_UNUSED,
104
 
                            const int width A_UNUSED,
105
 
                            const int height A_UNUSED)
106
 
{
107
 
    if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D)
108
 
    {
109
 
#ifdef DEBUG_DRAW_CALLS
110
 
        NullOpenGLGraphics::mDrawCalls ++;
111
 
#endif
112
 
    }
113
 
    else
114
 
    {
115
 
#ifdef DEBUG_DRAW_CALLS
116
 
        NullOpenGLGraphics::mDrawCalls ++;
117
 
#endif
118
 
    }
119
 
}
120
 
 
121
 
static inline void drawRescaledQuad(const Image *const image A_UNUSED,
122
 
                                    const int srcX A_UNUSED,
123
 
                                    const int srcY A_UNUSED,
124
 
                                    const int dstX A_UNUSED,
125
 
                                    const int dstY A_UNUSED,
126
 
                                    const int width A_UNUSED,
127
 
                                    const int height A_UNUSED,
128
 
                                    const int desiredWidth A_UNUSED,
129
 
                                    const int desiredHeight A_UNUSED)
130
 
{
131
 
    if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D)
132
 
    {
133
 
#ifdef DEBUG_DRAW_CALLS
134
 
        NullOpenGLGraphics::mDrawCalls ++;
135
 
#endif
136
 
    }
137
 
    else
138
 
    {
139
 
#ifdef DEBUG_DRAW_CALLS
140
 
        NullOpenGLGraphics::mDrawCalls ++;
141
 
#endif
142
 
    }
143
 
}
144
 
 
145
 
 
146
 
bool NullOpenGLGraphics::drawImage2(const Image *const image,
147
 
                                    int srcX, int srcY,
148
 
                                    int dstX, int dstY,
149
 
                                    const int width, const int height,
150
 
                                    const bool useColor)
151
 
{
152
 
    FUNC_BLOCK("Graphics::drawImage2", 1)
153
 
    if (!image)
154
 
        return false;
155
 
 
156
 
    const SDL_Rect &imageRect = image->mBounds;
157
 
    srcX += imageRect.x;
158
 
    srcY += imageRect.y;
159
 
 
160
 
    if (!useColor)
161
 
        setColorAlpha(image->mAlpha);
162
 
 
163
 
#ifdef DEBUG_BIND_TEXTURE
164
 
    debugBindTexture(image);
165
 
#endif
166
 
    bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
167
 
 
168
 
    setTexturingAndBlending(true);
169
 
 
170
 
    drawQuad(image, srcX, srcY, dstX, dstY, width, height);
171
 
 
172
 
    return true;
173
 
}
174
 
 
175
 
bool NullOpenGLGraphics::drawRescaledImage(const Image *const image,
176
 
                                           int srcX, int srcY,
177
 
                                           int dstX, int dstY,
178
 
                                           const int width, const int height,
179
 
                                           const int desiredWidth,
180
 
                                           const int desiredHeight,
181
 
                                           const bool useColor)
182
 
{
183
 
    return drawRescaledImage(image, srcX, srcY,
184
 
                             dstX, dstY,
185
 
                             width, height,
186
 
                             desiredWidth, desiredHeight,
187
 
                             useColor, true);
188
 
}
189
 
 
190
 
bool NullOpenGLGraphics::drawRescaledImage(const Image *const image,
191
 
                                           int srcX, int srcY,
192
 
                                           int dstX, int dstY,
193
 
                                           const int width, const int height,
194
 
                                           const int desiredWidth,
195
 
                                           const int desiredHeight,
196
 
                                           const bool useColor,
197
 
                                           bool smooth)
198
 
{
199
 
    FUNC_BLOCK("Graphics::drawRescaledImage", 1)
200
 
    if (!image)
201
 
        return false;
202
 
 
203
 
    // Just draw the image normally when no resizing is necessary,
204
 
    if (width == desiredWidth && height == desiredHeight)
205
 
    {
206
 
        return drawImage2(image, srcX, srcY, dstX, dstY,
207
 
                          width, height, useColor);
208
 
    }
209
 
 
210
 
    // When the desired image is smaller than the current one,
211
 
    // disable smooth effect.
212
 
    if (width > desiredWidth && height > desiredHeight)
213
 
        smooth = false;
214
 
 
215
 
    const SDL_Rect &imageRect = image->mBounds;
216
 
    srcX += imageRect.x;
217
 
    srcY += imageRect.y;
218
 
 
219
 
    if (!useColor)
220
 
        setColorAlpha(image->mAlpha);
221
 
 
222
 
#ifdef DEBUG_BIND_TEXTURE
223
 
    debugBindTexture(image);
224
 
#endif
225
 
    bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
226
 
 
227
 
    setTexturingAndBlending(true);
228
 
 
229
 
    // Draw a textured quad.
230
 
    drawRescaledQuad(image, srcX, srcY, dstX, dstY, width, height,
231
 
                     desiredWidth, desiredHeight);
232
 
 
233
 
    if (smooth)  // A basic smooth effect...
234
 
    {
235
 
        setColorAlpha(0.2f);
236
 
        drawRescaledQuad(image, srcX, srcY, dstX - 1, dstY - 1, width, height,
237
 
                         desiredWidth + 1, desiredHeight + 1);
238
 
        drawRescaledQuad(image, srcX, srcY, dstX + 1, dstY + 1, width, height,
239
 
                         desiredWidth - 1, desiredHeight - 1);
240
 
 
241
 
        drawRescaledQuad(image, srcX, srcY, dstX + 1, dstY, width, height,
242
 
                         desiredWidth - 1, desiredHeight);
243
 
        drawRescaledQuad(image, srcX, srcY, dstX, dstY + 1, width, height,
244
 
                         desiredWidth, desiredHeight - 1);
245
 
    }
246
 
 
247
 
    return true;
248
 
}
249
 
 
250
 
void NullOpenGLGraphics::drawImagePattern(const Image *const image,
251
 
                                          const int x, const int y,
252
 
                                          const int w, const int h)
253
 
{
254
 
    FUNC_BLOCK("Graphics::drawImagePattern", 1)
255
 
    if (!image)
256
 
        return;
257
 
 
258
 
    const SDL_Rect &imageRect = image->mBounds;
259
 
    const int srcX = imageRect.x;
260
 
    const int srcY = imageRect.y;
261
 
    const int iw = imageRect.w;
262
 
    const int ih = imageRect.h;
263
 
 
264
 
    if (iw == 0 || ih == 0)
265
 
        return;
266
 
 
267
 
    const float tw = static_cast<float>(image->mTexWidth);
268
 
    const float th = static_cast<float>(image->mTexHeight);
269
 
 
270
 
    setColorAlpha(image->mAlpha);
271
 
 
272
 
#ifdef DEBUG_BIND_TEXTURE
273
 
    debugBindTexture(image);
274
 
#endif
275
 
    bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
276
 
 
277
 
    setTexturingAndBlending(true);
278
 
 
279
 
    unsigned int vp = 0;
280
 
    const unsigned int vLimit = mMaxVertices * 4;
281
 
    // Draw a set of textured rectangles
282
 
    if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D)
283
 
    {
284
 
        const float texX1 = static_cast<float>(srcX) / tw;
285
 
        const float texY1 = static_cast<float>(srcY) / th;
286
 
 
287
 
        for (int py = 0; py < h; py += ih)
288
 
        {
289
 
            const int height = (py + ih >= h) ? h - py : ih;
290
 
            const int dstY = y + py;
291
 
            const float texY2 = static_cast<float>(srcY + height) / th;
292
 
            for (int px = 0; px < w; px += iw)
293
 
            {
294
 
                const int width = (px + iw >= w) ? w - px : iw;
295
 
                const int dstX = x + px;
296
 
 
297
 
                const float texX2 = static_cast<float>(srcX + width) / tw;
298
 
 
299
 
                mFloatTexArray[vp + 0] = texX1;
300
 
                mFloatTexArray[vp + 1] = texY1;
301
 
 
302
 
                mFloatTexArray[vp + 2] = texX2;
303
 
                mFloatTexArray[vp + 3] = texY1;
304
 
 
305
 
                mFloatTexArray[vp + 4] = texX2;
306
 
                mFloatTexArray[vp + 5] = texY2;
307
 
 
308
 
                mFloatTexArray[vp + 6] = texX1;
309
 
                mFloatTexArray[vp + 7] = texY2;
310
 
 
311
 
                mIntVertArray[vp + 0] = dstX;
312
 
                mIntVertArray[vp + 1] = dstY;
313
 
 
314
 
                mIntVertArray[vp + 2] = dstX + width;
315
 
                mIntVertArray[vp + 3] = dstY;
316
 
 
317
 
                mIntVertArray[vp + 4] = dstX + width;
318
 
                mIntVertArray[vp + 5] = dstY + height;
319
 
 
320
 
                mIntVertArray[vp + 6] = dstX;
321
 
                mIntVertArray[vp + 7] = dstY + height;
322
 
 
323
 
                vp += 8;
324
 
                if (vp >= vLimit)
325
 
                {
326
 
                    drawQuadArrayfi(vp);
327
 
                    vp = 0;
328
 
                }
329
 
            }
330
 
        }
331
 
        if (vp > 0)
332
 
            drawQuadArrayfi(vp);
333
 
    }
334
 
    else
335
 
    {
336
 
        for (int py = 0; py < h; py += ih)
337
 
        {
338
 
            const int height = (py + ih >= h) ? h - py : ih;
339
 
            const int dstY = y + py;
340
 
            for (int px = 0; px < w; px += iw)
341
 
            {
342
 
                const int width = (px + iw >= w) ? w - px : iw;
343
 
                const int dstX = x + px;
344
 
 
345
 
                mIntTexArray[vp + 0] = srcX;
346
 
                mIntTexArray[vp + 1] = srcY;
347
 
 
348
 
                mIntTexArray[vp + 2] = srcX + width;
349
 
                mIntTexArray[vp + 3] = srcY;
350
 
 
351
 
                mIntTexArray[vp + 4] = srcX + width;
352
 
                mIntTexArray[vp + 5] = srcY + height;
353
 
 
354
 
                mIntTexArray[vp + 6] = srcX;
355
 
                mIntTexArray[vp + 7] = srcY + height;
356
 
 
357
 
                mIntVertArray[vp + 0] = dstX;
358
 
                mIntVertArray[vp + 1] = dstY;
359
 
 
360
 
                mIntVertArray[vp + 2] = dstX + width;
361
 
                mIntVertArray[vp + 3] = dstY;
362
 
 
363
 
                mIntVertArray[vp + 4] = dstX + width;
364
 
                mIntVertArray[vp + 5] = dstY + height;
365
 
 
366
 
                mIntVertArray[vp + 6] = dstX;
367
 
                mIntVertArray[vp + 7] = dstY + height;
368
 
 
369
 
                vp += 8;
370
 
                if (vp >= vLimit)
371
 
                {
372
 
                    drawQuadArrayii(vp);
373
 
                    vp = 0;
374
 
                }
375
 
            }
376
 
        }
377
 
        if (vp > 0)
378
 
            drawQuadArrayii(vp);
379
 
    }
380
 
}
381
 
 
382
 
void NullOpenGLGraphics::drawRescaledImagePattern(const Image *const image,
383
 
                                                  const int x, const int y,
384
 
                                                  const int w, const int h,
385
 
                                                  const int scaledWidth,
386
 
                                                  const int scaledHeight)
387
 
{
388
 
    if (!image)
389
 
        return;
390
 
 
391
 
    if (scaledWidth == 0 || scaledHeight == 0)
392
 
        return;
393
 
 
394
 
    const SDL_Rect &imageRect = image->mBounds;
395
 
    const int iw = imageRect.w;
396
 
    const int ih = imageRect.h;
397
 
    if (iw == 0 || ih == 0)
398
 
        return;
399
 
 
400
 
    const int srcX = imageRect.x;
401
 
    const int srcY = imageRect.y;
402
 
 
403
 
    setColorAlpha(image->mAlpha);
404
 
 
405
 
#ifdef DEBUG_BIND_TEXTURE
406
 
    debugBindTexture(image);
407
 
#endif
408
 
    bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
409
 
 
410
 
    setTexturingAndBlending(true);
411
 
 
412
 
    unsigned int vp = 0;
413
 
    const unsigned int vLimit = mMaxVertices * 4;
414
 
 
415
 
    // Draw a set of textured rectangles
416
 
    if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D)
417
 
    {
418
 
        const float tw = static_cast<float>(image->mTexWidth);
419
 
        const float th = static_cast<float>(image->mTexHeight);
420
 
 
421
 
        const float texX1 = static_cast<float>(srcX) / tw;
422
 
        const float texY1 = static_cast<float>(srcY) / th;
423
 
 
424
 
        const float tFractionW = iw / tw;
425
 
        const float tFractionH = ih / th;
426
 
 
427
 
        for (int py = 0; py < h; py += scaledHeight)
428
 
        {
429
 
            const int height = (py + scaledHeight >= h)
430
 
                ? h - py : scaledHeight;
431
 
            const int dstY = y + py;
432
 
            const float visibleFractionH = static_cast<float>(height)
433
 
                / scaledHeight;
434
 
            const float texY2 = texY1 + tFractionH * visibleFractionH;
435
 
            for (int px = 0; px < w; px += scaledWidth)
436
 
            {
437
 
                const int width = (px + scaledWidth >= w)
438
 
                    ? w - px : scaledWidth;
439
 
                const int dstX = x + px;
440
 
                const float visibleFractionW = static_cast<float>(width)
441
 
                    / scaledWidth;
442
 
                const float texX2 = texX1 + tFractionW * visibleFractionW;
443
 
 
444
 
                mFloatTexArray[vp + 0] = texX1;
445
 
                mFloatTexArray[vp + 1] = texY1;
446
 
 
447
 
                mFloatTexArray[vp + 2] = texX2;
448
 
                mFloatTexArray[vp + 3] = texY1;
449
 
 
450
 
                mFloatTexArray[vp + 4] = texX2;
451
 
                mFloatTexArray[vp + 5] = texY2;
452
 
 
453
 
                mFloatTexArray[vp + 6] = texX1;
454
 
                mFloatTexArray[vp + 7] = texY2;
455
 
 
456
 
                mIntVertArray[vp + 0] = dstX;
457
 
                mIntVertArray[vp + 1] = dstY;
458
 
 
459
 
                mIntVertArray[vp + 2] = dstX + width;
460
 
                mIntVertArray[vp + 3] = dstY;
461
 
 
462
 
                mIntVertArray[vp + 4] = dstX + width;
463
 
                mIntVertArray[vp + 5] = dstY + height;
464
 
 
465
 
                mIntVertArray[vp + 6] = dstX;
466
 
                mIntVertArray[vp + 7] = dstY + height;
467
 
 
468
 
                vp += 8;
469
 
                if (vp >= vLimit)
470
 
                {
471
 
                    drawQuadArrayfi(vp);
472
 
                    vp = 0;
473
 
                }
474
 
            }
475
 
        }
476
 
        if (vp > 0)
477
 
            drawQuadArrayfi(vp);
478
 
    }
479
 
    else
480
 
    {
481
 
        const float scaleFactorW = static_cast<float>(scaledWidth) / iw;
482
 
        const float scaleFactorH = static_cast<float>(scaledHeight) / ih;
483
 
 
484
 
        for (int py = 0; py < h; py += scaledHeight)
485
 
        {
486
 
            const int height = (py + scaledHeight >= h)
487
 
                ? h - py : scaledHeight;
488
 
            const int dstY = y + py;
489
 
            const int scaledY = srcY + height / scaleFactorH;
490
 
            for (int px = 0; px < w; px += scaledWidth)
491
 
            {
492
 
                const int width = (px + scaledWidth >= w)
493
 
                    ? w - px : scaledWidth;
494
 
                const int dstX = x + px;
495
 
                const int scaledX = srcX + width / scaleFactorW;
496
 
 
497
 
                mIntTexArray[vp + 0] = srcX;
498
 
                mIntTexArray[vp + 1] = srcY;
499
 
 
500
 
                mIntTexArray[vp + 2] = scaledX;
501
 
                mIntTexArray[vp + 3] = srcY;
502
 
 
503
 
                mIntTexArray[vp + 4] = scaledX;
504
 
                mIntTexArray[vp + 5] = scaledY;
505
 
 
506
 
                mIntTexArray[vp + 6] = srcX;
507
 
                mIntTexArray[vp + 7] = scaledY;
508
 
 
509
 
                mIntVertArray[vp + 0] = dstX;
510
 
                mIntVertArray[vp + 1] = dstY;
511
 
 
512
 
                mIntVertArray[vp + 2] = dstX + width;
513
 
                mIntVertArray[vp + 3] = dstY;
514
 
 
515
 
                mIntVertArray[vp + 4] = dstX + width;
516
 
                mIntVertArray[vp + 5] = dstY + height;
517
 
 
518
 
                mIntVertArray[vp + 6] = dstX;
519
 
                mIntVertArray[vp + 7] = dstY + height;
520
 
 
521
 
                vp += 8;
522
 
                if (vp >= vLimit)
523
 
                {
524
 
                    drawQuadArrayii(vp);
525
 
                    vp = 0;
526
 
                }
527
 
            }
528
 
        }
529
 
        if (vp > 0)
530
 
            drawQuadArrayii(vp);
531
 
    }
532
 
}
533
 
 
534
 
inline void NullOpenGLGraphics::drawVertexes(const
535
 
                                             NormalOpenGLGraphicsVertexes
536
 
                                             &ogl)
537
 
{
538
 
    const std::vector<GLint*> &intVertPool = ogl.mIntVertPool;
539
 
    std::vector<GLint*>::const_iterator iv;
540
 
    const std::vector<GLint*>::const_iterator iv_end = intVertPool.end();
541
 
    const std::vector<int> &vp = ogl.mVp;
542
 
    std::vector<int>::const_iterator ivp;
543
 
    const std::vector<int>::const_iterator ivp_end = vp.end();
544
 
 
545
 
    // Draw a set of textured rectangles
546
 
    if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D)
547
 
    {
548
 
        const std::vector<GLfloat*> &floatTexPool = ogl.mFloatTexPool;
549
 
        std::vector<GLfloat*>::const_iterator ft;
550
 
        const std::vector<GLfloat*>::const_iterator
551
 
            ft_end = floatTexPool.end();
552
 
 
553
 
        for (iv = intVertPool.begin(), ft = floatTexPool.begin(),
554
 
             ivp = vp.begin();
555
 
             iv != iv_end && ft != ft_end && ivp != ivp_end;
556
 
             ++ iv, ++ ft, ++ ivp)
557
 
        {
558
 
            drawQuadArrayfi(*iv, *ft, *ivp);
559
 
        }
560
 
    }
561
 
    else
562
 
    {
563
 
        const std::vector<GLint*> &intTexPool = ogl.mIntTexPool;
564
 
        std::vector<GLint*>::const_iterator it;
565
 
        const std::vector<GLint*>::const_iterator it_end = intTexPool.end();
566
 
 
567
 
        for (iv = intVertPool.begin(), it = intTexPool.begin(),
568
 
             ivp = vp.begin();
569
 
             iv != iv_end && it != it_end && ivp != ivp_end;
570
 
             ++ iv, ++ it, ++ ivp)
571
 
        {
572
 
            drawQuadArrayii(*iv, *it, *ivp);
573
 
        }
574
 
    }
575
 
}
576
 
 
577
 
void NullOpenGLGraphics::calcImagePattern(ImageVertexes* const vert,
578
 
                                          const Image *const image,
579
 
                                          const int x, const int y,
580
 
                                          const int w, const int h) const
581
 
{
582
 
    if (!image)
583
 
        return;
584
 
 
585
 
    const SDL_Rect &imageRect = image->mBounds;
586
 
    const int iw = imageRect.w;
587
 
    const int ih = imageRect.h;
588
 
 
589
 
    if (iw == 0 || ih == 0)
590
 
        return;
591
 
 
592
 
    const int srcX = imageRect.x;
593
 
    const int srcY = imageRect.y;
594
 
    const float tw = static_cast<float>(image->mTexWidth);
595
 
    const float th = static_cast<float>(image->mTexHeight);
596
 
 
597
 
    const unsigned int vLimit = mMaxVertices * 4;
598
 
 
599
 
    NormalOpenGLGraphicsVertexes &ogl = vert->ogl;
600
 
    unsigned int vp = ogl.continueVp();
601
 
 
602
 
    // Draw a set of textured rectangles
603
 
    if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D)
604
 
    {
605
 
        const float texX1 = static_cast<float>(srcX) / tw;
606
 
        const float texY1 = static_cast<float>(srcY) / th;
607
 
 
608
 
        GLfloat *floatTexArray = ogl.continueFloatTexArray();
609
 
        GLint *intVertArray = ogl.continueIntVertArray();
610
 
 
611
 
        for (int py = 0; py < h; py += ih)
612
 
        {
613
 
            const int height = (py + ih >= h) ? h - py : ih;
614
 
            const int dstY = y + py;
615
 
            const float texY2 = static_cast<float>(srcY + height) / th;
616
 
            for (int px = 0; px < w; px += iw)
617
 
            {
618
 
                const int width = (px + iw >= w) ? w - px : iw;
619
 
                const int dstX = x + px;
620
 
                const float texX2 = static_cast<float>(srcX + width) / tw;
621
 
 
622
 
                floatTexArray[vp + 0] = texX1;
623
 
                floatTexArray[vp + 1] = texY1;
624
 
 
625
 
                floatTexArray[vp + 2] = texX2;
626
 
                floatTexArray[vp + 3] = texY1;
627
 
 
628
 
                floatTexArray[vp + 4] = texX2;
629
 
                floatTexArray[vp + 5] = texY2;
630
 
 
631
 
                floatTexArray[vp + 6] = texX1;
632
 
                floatTexArray[vp + 7] = texY2;
633
 
 
634
 
                intVertArray[vp + 0] = dstX;
635
 
                intVertArray[vp + 1] = dstY;
636
 
 
637
 
                intVertArray[vp + 2] = dstX + width;
638
 
                intVertArray[vp + 3] = dstY;
639
 
 
640
 
                intVertArray[vp + 4] = dstX + width;
641
 
                intVertArray[vp + 5] = dstY + height;
642
 
 
643
 
                intVertArray[vp + 6] = dstX;
644
 
                intVertArray[vp + 7] = dstY + height;
645
 
 
646
 
                vp += 8;
647
 
                if (vp >= vLimit)
648
 
                {
649
 
                    floatTexArray = ogl.switchFloatTexArray();
650
 
                    intVertArray = ogl.switchIntVertArray();
651
 
                    ogl.switchVp(vp);
652
 
                    vp = 0;
653
 
                }
654
 
            }
655
 
        }
656
 
    }
657
 
    else
658
 
    {
659
 
        GLint *intTexArray = ogl.continueIntTexArray();
660
 
        GLint *intVertArray = ogl.continueIntVertArray();
661
 
 
662
 
        for (int py = 0; py < h; py += ih)
663
 
        {
664
 
            const int height = (py + ih >= h) ? h - py : ih;
665
 
            const int dstY = y + py;
666
 
            for (int px = 0; px < w; px += iw)
667
 
            {
668
 
                const int width = (px + iw >= w) ? w - px : iw;
669
 
                const int dstX = x + px;
670
 
 
671
 
                intTexArray[vp + 0] = srcX;
672
 
                intTexArray[vp + 1] = srcY;
673
 
 
674
 
                intTexArray[vp + 2] = srcX + width;
675
 
                intTexArray[vp + 3] = srcY;
676
 
 
677
 
                intTexArray[vp + 4] = srcX + width;
678
 
                intTexArray[vp + 5] = srcY + height;
679
 
 
680
 
                intTexArray[vp + 6] = srcX;
681
 
                intTexArray[vp + 7] = srcY + height;
682
 
 
683
 
                intVertArray[vp + 0] = dstX;
684
 
                intVertArray[vp + 1] = dstY;
685
 
 
686
 
                intVertArray[vp + 2] = dstX + width;
687
 
                intVertArray[vp + 3] = dstY;
688
 
 
689
 
                intVertArray[vp + 4] = dstX + width;
690
 
                intVertArray[vp + 5] = dstY + height;
691
 
 
692
 
                intVertArray[vp + 6] = dstX;
693
 
                intVertArray[vp + 7] = dstY + height;
694
 
 
695
 
                vp += 8;
696
 
                if (vp >= vLimit)
697
 
                {
698
 
                    intTexArray = ogl.switchIntTexArray();
699
 
                    intVertArray = ogl.switchIntVertArray();
700
 
                    ogl.switchVp(vp);
701
 
                    vp = 0;
702
 
                }
703
 
            }
704
 
        }
705
 
    }
706
 
    ogl.switchVp(vp);
707
 
}
708
 
 
709
 
void NullOpenGLGraphics::calcTile(ImageCollection *const vertCol,
710
 
                                  const Image *const image,
711
 
                                  int x, int y)
712
 
{
713
 
    if (vertCol->currentGLImage != image->mGLImage)
714
 
    {
715
 
        ImageVertexes *const vert = new ImageVertexes();
716
 
        vertCol->currentGLImage = image->mGLImage;
717
 
        vertCol->currentVert = vert;
718
 
        vert->image = image;
719
 
        vertCol->draws.push_back(vert);
720
 
        calcTile(vert, image, x, y);
721
 
    }
722
 
    else
723
 
    {
724
 
        calcTile(vertCol->currentVert, image, x, y);
725
 
    }
726
 
}
727
 
 
728
 
void NullOpenGLGraphics::drawTile(const ImageCollection *const vertCol)
729
 
{
730
 
    const ImageVertexesVector &draws = vertCol->draws;
731
 
    const ImageCollectionCIter it_end = draws.end();
732
 
    for (ImageCollectionCIter it = draws.begin(); it != it_end; ++ it)
733
 
    {
734
 
        const ImageVertexes *const vert = *it;
735
 
        const Image *const image = vert->image;
736
 
 
737
 
        setColorAlpha(image->mAlpha);
738
 
#ifdef DEBUG_BIND_TEXTURE
739
 
        debugBindTexture(image);
740
 
#endif
741
 
        bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
742
 
        setTexturingAndBlending(true);
743
 
        drawVertexes(vert->ogl);
744
 
    }
745
 
}
746
 
 
747
 
void NullOpenGLGraphics::calcImagePattern(ImageCollection* const vertCol,
748
 
                                          const Image *const image,
749
 
                                          const int x, const int y,
750
 
                                          const int w, const int h) const
751
 
{
752
 
    ImageVertexes *vert = nullptr;
753
 
    if (vertCol->currentGLImage != image->mGLImage)
754
 
    {
755
 
        vert = new ImageVertexes();
756
 
        vertCol->currentGLImage = image->mGLImage;
757
 
        vertCol->currentVert = vert;
758
 
        vert->image = image;
759
 
        vertCol->draws.push_back(vert);
760
 
    }
761
 
    else
762
 
    {
763
 
        vert = vertCol->currentVert;
764
 
    }
765
 
 
766
 
    calcImagePattern(vert, image, x, y, w, h);
767
 
}
768
 
 
769
 
void NullOpenGLGraphics::calcTile(ImageVertexes *const vert,
770
 
                                  const Image *const image,
771
 
                                  int dstX, int dstY) const
772
 
{
773
 
    if (!vert || !image)
774
 
        return;
775
 
 
776
 
    const SDL_Rect &imageRect = image->mBounds;
777
 
    const int w = imageRect.w;
778
 
    const int h = imageRect.h;
779
 
 
780
 
    if (w == 0 || h == 0)
781
 
        return;
782
 
 
783
 
    const int srcX = imageRect.x;
784
 
    const int srcY = imageRect.y;
785
 
 
786
 
    const float tw = static_cast<float>(image->mTexWidth);
787
 
    const float th = static_cast<float>(image->mTexHeight);
788
 
 
789
 
    const unsigned int vLimit = mMaxVertices * 4;
790
 
 
791
 
    NormalOpenGLGraphicsVertexes &ogl = vert->ogl;
792
 
 
793
 
//    std::vector<int> *vps = ogl.getVp();
794
 
    unsigned int vp = ogl.continueVp();
795
 
 
796
 
    // Draw a set of textured rectangles
797
 
    if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D)
798
 
    {
799
 
        const float texX1 = static_cast<float>(srcX) / tw;
800
 
        const float texY1 = static_cast<float>(srcY) / th;
801
 
 
802
 
        const float texX2 = static_cast<float>(srcX + w) / tw;
803
 
        const float texY2 = static_cast<float>(srcY + h) / th;
804
 
 
805
 
        GLfloat *const floatTexArray = ogl.continueFloatTexArray();
806
 
        GLint *const intVertArray = ogl.continueIntVertArray();
807
 
 
808
 
        floatTexArray[vp + 0] = texX1;
809
 
        floatTexArray[vp + 1] = texY1;
810
 
 
811
 
        floatTexArray[vp + 2] = texX2;
812
 
        floatTexArray[vp + 3] = texY1;
813
 
 
814
 
        floatTexArray[vp + 4] = texX2;
815
 
        floatTexArray[vp + 5] = texY2;
816
 
 
817
 
        floatTexArray[vp + 6] = texX1;
818
 
        floatTexArray[vp + 7] = texY2;
819
 
 
820
 
        intVertArray[vp + 0] = dstX;
821
 
        intVertArray[vp + 1] = dstY;
822
 
 
823
 
        intVertArray[vp + 2] = dstX + w;
824
 
        intVertArray[vp + 3] = dstY;
825
 
 
826
 
        intVertArray[vp + 4] = dstX + w;
827
 
        intVertArray[vp + 5] = dstY + h;
828
 
 
829
 
        intVertArray[vp + 6] = dstX;
830
 
        intVertArray[vp + 7] = dstY + h;
831
 
 
832
 
        vp += 8;
833
 
        if (vp >= vLimit)
834
 
        {
835
 
            ogl.switchFloatTexArray();
836
 
            ogl.switchIntVertArray();
837
 
            ogl.switchVp(vp);
838
 
            vp = 0;
839
 
        }
840
 
    }
841
 
    else
842
 
    {
843
 
        GLint *const intTexArray = ogl.continueIntTexArray();
844
 
        GLint *const intVertArray = ogl.continueIntVertArray();
845
 
 
846
 
        intTexArray[vp + 0] = srcX;
847
 
        intTexArray[vp + 1] = srcY;
848
 
 
849
 
        intTexArray[vp + 2] = srcX + w;
850
 
        intTexArray[vp + 3] = srcY;
851
 
 
852
 
        intTexArray[vp + 4] = srcX + w;
853
 
        intTexArray[vp + 5] = srcY + h;
854
 
 
855
 
        intTexArray[vp + 6] = srcX;
856
 
        intTexArray[vp + 7] = srcY + h;
857
 
 
858
 
        intVertArray[vp + 0] = dstX;
859
 
        intVertArray[vp + 1] = dstY;
860
 
 
861
 
        intVertArray[vp + 2] = dstX + w;
862
 
        intVertArray[vp + 3] = dstY;
863
 
 
864
 
        intVertArray[vp + 4] = dstX + w;
865
 
        intVertArray[vp + 5] = dstY + h;
866
 
 
867
 
        intVertArray[vp + 6] = dstX;
868
 
        intVertArray[vp + 7] = dstY + h;
869
 
 
870
 
        vp += 8;
871
 
        if (vp >= vLimit)
872
 
        {
873
 
            ogl.switchIntTexArray();
874
 
            ogl.switchIntVertArray();
875
 
            ogl.switchVp(vp);
876
 
            vp = 0;
877
 
        }
878
 
    }
879
 
    ogl.switchVp(vp);
880
 
}
881
 
 
882
 
void NullOpenGLGraphics::drawTile(const ImageVertexes *const vert)
883
 
{
884
 
    if (!vert)
885
 
        return;
886
 
    const Image *const image = vert->image;
887
 
 
888
 
    setColorAlpha(image->mAlpha);
889
 
#ifdef DEBUG_BIND_TEXTURE
890
 
    debugBindTexture(image);
891
 
#endif
892
 
    bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
893
 
    setTexturingAndBlending(true);
894
 
    drawVertexes(vert->ogl);
895
 
}
896
 
 
897
 
bool NullOpenGLGraphics::calcWindow(ImageCollection *const vertCol,
898
 
                                    const int x, const int y,
899
 
                                    const int w, const int h,
900
 
                                    const ImageRect &imgRect)
901
 
{
902
 
    ImageVertexes *vert = nullptr;
903
 
    Image *const image = imgRect.grid[4];
904
 
    if (!image)
905
 
        return false;
906
 
    if (vertCol->currentGLImage != image->mGLImage)
907
 
    {
908
 
        vert = new ImageVertexes();
909
 
        vertCol->currentGLImage = image->mGLImage;
910
 
        vertCol->currentVert = vert;
911
 
        vert->image = image;
912
 
        vertCol->draws.push_back(vert);
913
 
    }
914
 
    else
915
 
    {
916
 
        vert = vertCol->currentVert;
917
 
    }
918
 
 
919
 
    return calcImageRect(vert, x, y, w, h,
920
 
        imgRect.grid[0], imgRect.grid[2], imgRect.grid[6], imgRect.grid[8],
921
 
        imgRect.grid[1], imgRect.grid[5], imgRect.grid[7], imgRect.grid[3],
922
 
        imgRect.grid[4]);
923
 
}
924
 
 
925
 
void NullOpenGLGraphics::updateScreen()
926
 
{
927
 
    BLOCK_START("Graphics::updateScreen")
928
 
#ifdef DEBUG_DRAW_CALLS
929
 
    mLastDrawCalls = mDrawCalls;
930
 
    mDrawCalls = 0;
931
 
#endif
932
 
    BLOCK_END("Graphics::updateScreen")
933
 
}
934
 
 
935
 
void NullOpenGLGraphics::_beginDraw()
936
 
{
937
 
    pushClipArea(gcn::Rectangle(0, 0, 640, 480));
938
 
}
939
 
 
940
 
void NullOpenGLGraphics::_endDraw()
941
 
{
942
 
    popClipArea();
943
 
}
944
 
 
945
 
void NullOpenGLGraphics::prepareScreenshot()
946
 
{
947
 
}
948
 
 
949
 
SDL_Surface* NullOpenGLGraphics::getScreenshot()
950
 
{
951
 
    return nullptr;
952
 
}
953
 
 
954
 
bool NullOpenGLGraphics::pushClipArea(gcn::Rectangle area)
955
 
{
956
 
    int transX = 0;
957
 
    int transY = 0;
958
 
 
959
 
    if (!mClipStack.empty())
960
 
    {
961
 
        const gcn::ClipRectangle &clipArea = mClipStack.top();
962
 
        transX = -clipArea.xOffset;
963
 
        transY = -clipArea.yOffset;
964
 
    }
965
 
 
966
 
    const bool result = gcn::Graphics::pushClipArea(area);
967
 
 
968
 
    const gcn::ClipRectangle &clipArea = mClipStack.top();
969
 
    transX += clipArea.xOffset;
970
 
    transY += clipArea.yOffset;
971
 
 
972
 
    return result;
973
 
}
974
 
 
975
 
void NullOpenGLGraphics::popClipArea()
976
 
{
977
 
    gcn::Graphics::popClipArea();
978
 
 
979
 
    if (mClipStack.empty())
980
 
        return;
981
 
}
982
 
 
983
 
void NullOpenGLGraphics::drawPoint(int x A_UNUSED, int y A_UNUSED)
984
 
{
985
 
    setTexturingAndBlending(false);
986
 
    restoreColor();
987
 
}
988
 
 
989
 
void NullOpenGLGraphics::drawLine(int x1, int y1,
990
 
                                  int x2, int y2)
991
 
{
992
 
    setTexturingAndBlending(false);
993
 
    restoreColor();
994
 
 
995
 
    mFloatTexArray[0] = static_cast<float>(x1) + 0.5f;
996
 
    mFloatTexArray[1] = static_cast<float>(y1) + 0.5f;
997
 
    mFloatTexArray[2] = static_cast<float>(x2) + 0.5f;
998
 
    mFloatTexArray[3] = static_cast<float>(y2) + 0.5f;
999
 
 
1000
 
    drawLineArrayf(4);
1001
 
}
1002
 
 
1003
 
void NullOpenGLGraphics::drawRectangle(const gcn::Rectangle& rect)
1004
 
{
1005
 
    drawRectangle(rect, false);
1006
 
}
1007
 
 
1008
 
void NullOpenGLGraphics::fillRectangle(const gcn::Rectangle& rect)
1009
 
{
1010
 
    drawRectangle(rect, true);
1011
 
}
1012
 
 
1013
 
void NullOpenGLGraphics::setTargetPlane(int width A_UNUSED,
1014
 
                                        int height A_UNUSED)
1015
 
{
1016
 
}
1017
 
 
1018
 
void NullOpenGLGraphics::setTexturingAndBlending(const bool enable)
1019
 
{
1020
 
    if (enable)
1021
 
    {
1022
 
        if (!mTexture)
1023
 
            mTexture = true;
1024
 
 
1025
 
        if (!mAlpha)
1026
 
            mAlpha = true;
1027
 
    }
1028
 
    else
1029
 
    {
1030
 
        mLastImage = 0;
1031
 
        if (mAlpha && !mColorAlpha)
1032
 
            mAlpha = false;
1033
 
        else if (!mAlpha && mColorAlpha)
1034
 
            mAlpha = true;
1035
 
 
1036
 
        if (mTexture)
1037
 
            mTexture = false;
1038
 
    }
1039
 
}
1040
 
 
1041
 
void NullOpenGLGraphics::drawRectangle(const gcn::Rectangle& rect A_UNUSED,
1042
 
                                       const bool filled A_UNUSED)
1043
 
{
1044
 
    BLOCK_START("Graphics::drawRectangle")
1045
 
    setTexturingAndBlending(false);
1046
 
    restoreColor();
1047
 
 
1048
 
#ifdef DEBUG_DRAW_CALLS
1049
 
        mDrawCalls ++;
1050
 
#endif
1051
 
    BLOCK_END("Graphics::drawRectangle")
1052
 
}
1053
 
 
1054
 
bool NullOpenGLGraphics::drawNet(const int x1, const int y1,
1055
 
                                 const int x2, const int y2,
1056
 
                                 const int width, const int height)
1057
 
{
1058
 
    unsigned int vp = 0;
1059
 
    const unsigned int vLimit = mMaxVertices * 4;
1060
 
 
1061
 
    setTexturingAndBlending(false);
1062
 
    restoreColor();
1063
 
 
1064
 
    const float xf1 = static_cast<float>(x1);
1065
 
    const float xf2 = static_cast<float>(x2);
1066
 
    const float yf1 = static_cast<float>(y1);
1067
 
    const float yf2 = static_cast<float>(y2);
1068
 
 
1069
 
    for (int y = y1; y < y2; y += height)
1070
 
    {
1071
 
        mFloatTexArray[vp + 0] = xf1;
1072
 
        mFloatTexArray[vp + 1] = static_cast<float>(y);
1073
 
 
1074
 
        mFloatTexArray[vp + 2] = xf2;
1075
 
        mFloatTexArray[vp + 3] = static_cast<float>(y);
1076
 
 
1077
 
        vp += 4;
1078
 
        if (vp >= vLimit)
1079
 
        {
1080
 
            drawLineArrayf(vp);
1081
 
            vp = 0;
1082
 
        }
1083
 
    }
1084
 
 
1085
 
    for (int x = x1; x < x2; x += width)
1086
 
    {
1087
 
        mFloatTexArray[vp + 0] = static_cast<float>(x);
1088
 
        mFloatTexArray[vp + 1] = yf1;
1089
 
 
1090
 
        mFloatTexArray[vp + 2] = static_cast<float>(x);
1091
 
        mFloatTexArray[vp + 3] = yf2;
1092
 
 
1093
 
        vp += 4;
1094
 
        if (vp >= vLimit)
1095
 
        {
1096
 
            drawLineArrayf(vp);
1097
 
            vp = 0;
1098
 
        }
1099
 
    }
1100
 
 
1101
 
    if (vp > 0)
1102
 
        drawLineArrayf(vp);
1103
 
 
1104
 
    return true;
1105
 
}
1106
 
 
1107
 
void NullOpenGLGraphics::bindTexture(const GLenum target A_UNUSED,
1108
 
                                     const GLuint texture)
1109
 
{
1110
 
    if (mLastImage != texture)
1111
 
        mLastImage = texture;
1112
 
}
1113
 
 
1114
 
inline void NullOpenGLGraphics::drawQuadArrayfi(const int size A_UNUSED)
1115
 
{
1116
 
#ifdef DEBUG_DRAW_CALLS
1117
 
    mDrawCalls ++;
1118
 
#endif
1119
 
}
1120
 
 
1121
 
inline void NullOpenGLGraphics::drawQuadArrayfi(const GLint *const
1122
 
                                                intVertArray A_UNUSED,
1123
 
                                                const GLfloat *const
1124
 
                                                floatTexArray A_UNUSED,
1125
 
                                                const int size A_UNUSED)
1126
 
{
1127
 
#ifdef DEBUG_DRAW_CALLS
1128
 
    mDrawCalls ++;
1129
 
#endif
1130
 
}
1131
 
 
1132
 
inline void NullOpenGLGraphics::drawQuadArrayii(const int size A_UNUSED)
1133
 
{
1134
 
#ifdef DEBUG_DRAW_CALLS
1135
 
    mDrawCalls ++;
1136
 
#endif
1137
 
}
1138
 
 
1139
 
inline void NullOpenGLGraphics::drawQuadArrayii(const GLint *const
1140
 
                                                intVertArray A_UNUSED,
1141
 
                                                const GLint *const
1142
 
                                                intTexArray A_UNUSED,
1143
 
                                                const int size A_UNUSED)
1144
 
{
1145
 
#ifdef DEBUG_DRAW_CALLS
1146
 
    mDrawCalls ++;
1147
 
#endif
1148
 
}
1149
 
 
1150
 
inline void NullOpenGLGraphics::drawLineArrayi(const int size A_UNUSED)
1151
 
{
1152
 
#ifdef DEBUG_DRAW_CALLS
1153
 
    mDrawCalls ++;
1154
 
#endif
1155
 
}
1156
 
 
1157
 
inline void NullOpenGLGraphics::drawLineArrayf(const int size A_UNUSED)
1158
 
{
1159
 
#ifdef DEBUG_DRAW_CALLS
1160
 
    mDrawCalls ++;
1161
 
#endif
1162
 
}
1163
 
 
1164
 
void NullOpenGLGraphics::dumpSettings()
1165
 
{
1166
 
}
1167
 
 
1168
 
void NullOpenGLGraphics::setColorAlpha(const float alpha)
1169
 
{
1170
 
    if (!mIsByteColor && mFloatColor == alpha)
1171
 
        return;
1172
 
 
1173
 
    mIsByteColor = false;
1174
 
    mFloatColor = alpha;
1175
 
}
1176
 
 
1177
 
void NullOpenGLGraphics::restoreColor()
1178
 
{
1179
 
    if (mIsByteColor && mByteColor == mColor)
1180
 
        return;
1181
 
 
1182
 
    mIsByteColor = true;
1183
 
    mByteColor = mColor;
1184
 
}
1185
 
 
1186
 
#ifdef DEBUG_BIND_TEXTURE
1187
 
void NullOpenGLGraphics::debugBindTexture(const Image *const image)
1188
 
{
1189
 
    const std::string texture = image->getIdPath();
1190
 
    if (mOldTexture != texture)
1191
 
    {
1192
 
        if ((!mOldTexture.empty() || !texture.empty())
1193
 
            && mOldTextureId != image->mGLImage)
1194
 
        {
1195
 
            logger->log("bind: %s (%d) to %s (%d)", mOldTexture.c_str(),
1196
 
                mOldTextureId, texture.c_str(), image->mGLImage);
1197
 
        }
1198
 
        mOldTextureId = image->mGLImage;
1199
 
        mOldTexture = texture;
1200
 
    }
1201
 
}
1202
 
#else
1203
 
void NullOpenGLGraphics::debugBindTexture(const Image *const image A_UNUSED)
1204
 
{
1205
 
}
1206
 
#endif
1207
 
 
1208
 
#endif  // USE_OPENGL