summaryrefslogtreecommitdiff
path: root/indra/llappearanceutility/llbakingwindow.cpp
blob: 8799105932397039c2f141d9c2441a0b20528720 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/**
 * @file llbakingwindow.cpp
 * @brief Implementation of LLBakingWindow class.
 *
 * $LicenseInfo:firstyear=2012&license=viewerlgpl$
 * Second Life Viewer Source Code
 * Copyright (C) 2012, Linden Research, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation;
 * version 2.1 of the License only.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 * $/LicenseInfo$
 */

// linden includes
#include "linden_common.h"

// project includes
#include "llappappearanceutility.h"
#include "llbakingshadermgr.h"
#include "llbakingwindow.h"
#include "llgl.h"
#include "llgltexture.h"
#include "llvertexbuffer.h"

LLBakingWindow::LLBakingWindow(S32 width, S32 height)
{
    const S32 WINDOW_ORIGIN_X = 0;
    const S32 WINDOW_ORIGIN_Y = 0;
    const U32 FLAGS = 32; // *TODO: Why did mapserver use this?  mFlags looks unused.
    const bool NO_FULLSCREEN = false;
    const bool NO_CLEAR_BG = false;
    const bool NO_DISABLE_VSYNC = false;
    const bool NO_IGNORE_PIXEL_DEPTH = false;
    const bool USE_GL = true;
    mWindow = LLWindowManager::createWindow(this,
        "appearanceutility", "Appearance Utility",
        WINDOW_ORIGIN_X, WINDOW_ORIGIN_Y,
        width, height,
        FLAGS,
        NO_FULLSCREEN,
        NO_CLEAR_BG,
        NO_DISABLE_VSYNC, //gSavedSettings.getBOOL("DisableVerticalSync"),
        USE_GL, // not headless
        NO_IGNORE_PIXEL_DEPTH); //gIgnorePixelDepth = false

    if (nullptr == mWindow)
    {
        throw LLAppException(RV_UNABLE_TO_INIT_GL);
    }

    LLVertexBuffer::initClass(mWindow);

    gGL.init(true);

    if (!LLBakingShaderMgr::sInitialized)
    { //immediately initialize shaders
        LLBakingShaderMgr::sInitialized = true;
        LLBakingShaderMgr::instance()->setShaders();
    }

    LLImageGL::initClass(mWindow, LLGLTexture::MAX_GL_IMAGE_CATEGORY, true, false);

    // mWindow->show();
    // mWindow->bringToFront();
    // mWindow->focusClient();
    // mWindow->gatherInput();
}

LLBakingWindow::~LLBakingWindow()
{
    if (mWindow)
    {
        LLWindowManager::destroyWindow(mWindow);
    }
    mWindow = nullptr;
}

void LLBakingWindow::swapBuffers()
{
    mWindow->swapBuffers();
}