make work on win32 again using GLEW
This commit is contained in:
parent
d67442dc49
commit
d597335135
|
@ -20,11 +20,10 @@ FIND_PACKAGE(Boost COMPONENTS system REQUIRED)
|
|||
IF(USE_OPENGL_ES2)
|
||||
FIND_PACKAGE(OpenGLES2 REQUIRED)
|
||||
FIND_PACKAGE(EGL REQUIRED)
|
||||
SET(OPENGL_INCLUDE_DIR ${OPENGLES_INCLUDE_DIR} ${EGL_INCLUDE_DIR})
|
||||
SET(OPENGL_LIBRARIES ${OPENGLES_LIBRARY} ${EGL_LIBRARY})
|
||||
ADD_DEFINITIONS(-DOPENGL_ES2)
|
||||
ELSE(USE_OPENGL_ES2)
|
||||
FIND_PACKAGE(OpenGL REQUIRED)
|
||||
FIND_PACKAGE(GLEW REQUIRED)
|
||||
ENDIF(USE_OPENGL_ES2)
|
||||
|
||||
FIND_PACKAGE(Lua REQUIRED)
|
||||
|
@ -66,7 +65,9 @@ IF(USE_GCC47)
|
|||
ENDIF(USE_GCC47)
|
||||
|
||||
IF(WIN32)
|
||||
SET(framework_SOURCES ${framework_SOURCES} ${CMAKE_CURRENT_LIST_DIR}/platform/win32window.cpp)
|
||||
SET(framework_SOURCES ${framework_SOURCES}
|
||||
${CMAKE_CURRENT_LIST_DIR}/platform/win32window.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/platform/win32crashhandler.cpp)
|
||||
SET(ADDITIONAL_LIBRARIES ws2_32 mswsock)
|
||||
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
@ -89,13 +90,17 @@ ELSE(WIN32)
|
|||
ADD_DEFINITIONS(-D_GLIBCXX__PTHREADS)
|
||||
ENDIF(USE_GCC47)
|
||||
SET(ADDITIONAL_LIBRARIES X11 dl)
|
||||
SET(framework_SOURCES ${framework_SOURCES} ${CMAKE_CURRENT_LIST_DIR}/platform/x11window.cpp)
|
||||
SET(framework_SOURCES ${framework_SOURCES}
|
||||
${CMAKE_CURRENT_LIST_DIR}/platform/x11window.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/platform/unixcrashhandler.cpp)
|
||||
ENDIF(WIN32)
|
||||
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${OPENGL_INCLUDE_DIR}
|
||||
${EGL_INCLUDE_DIR}
|
||||
${OPENGLES_INCLUDE_DIR}
|
||||
${LUA_INCLUDE_DIR}
|
||||
${PHYSFS_INCLUDE_DIR}
|
||||
${GMP_INCLUDE_DIR}
|
||||
|
@ -105,7 +110,9 @@ INCLUDE_DIRECTORIES(
|
|||
|
||||
SET(framework_LIBRARIES
|
||||
${Boost_LIBRARIES}
|
||||
${GLEW_LIBRARY}
|
||||
${OPENGL_LIBRARIES}
|
||||
${OPENGLES_LIBRARY}
|
||||
${LUA_LIBRARIES}
|
||||
${PHYSFS_LIBRARY}
|
||||
${GMP_LIBRARY}
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <framework/graphics/particlemanager.h>
|
||||
#include <framework/graphics/painter.h>
|
||||
#include <framework/luascript/luainterface.h>
|
||||
#include <framework/platform/crashhandler.h>
|
||||
|
||||
Application *g_app = nullptr;
|
||||
|
||||
|
@ -72,6 +73,10 @@ void Application::init(const std::vector<std::string>& args, int appFlags)
|
|||
signal(SIGTERM, exitSignalHandler);
|
||||
signal(SIGINT, exitSignalHandler);
|
||||
|
||||
#ifdef HANDLE_EXCEPTIONS
|
||||
installCrashHandler();
|
||||
#endif
|
||||
|
||||
// initialize lua
|
||||
g_lua.init();
|
||||
registerLuaFunctions();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# EGL_INCLUDE_DIR - the EGL include directory
|
||||
# EGL_LIBRARY - the EGL library
|
||||
|
||||
FIND_PATH(EGL_INCLUDE_DIR egl.h PATH_SUFFIXES EGL)
|
||||
FIND_PATH(EGL_INCLUDE_DIR NAMES EGL/egl.h)
|
||||
FIND_LIBRARY(EGL_LIBRARY NAMES EGL)
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(EGL DEFAULT_MSG EGL_LIBRARY EGL_INCLUDE_DIR)
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
# Try to find the GLEW librairy
|
||||
# GLEW_FOUND - system has GLEW
|
||||
# GLEW_INCLUDE_DIR - the GLEW include directory
|
||||
# GLEW_LIBRARY - the GLEW library
|
||||
|
||||
FIND_PATH(GLEW_INCLUDE_DIR NAMES GL/glew.h)
|
||||
FIND_LIBRARY(GLEW_LIBRARY NAMES libGLEW.a libglew32.a GLEW glew32)
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLEW DEFAULT_MSG GLEW_LIBRARY GLEW_INCLUDE_DIR)
|
||||
MARK_AS_ADVANCED(GLEW_LIBRARY GLEW_INCLUDE_DIR)
|
|
@ -3,7 +3,7 @@
|
|||
# OPENGLES_INCLUDE_DIR - the OpenGLES include directory
|
||||
# OPENGLES_LIBRARY - the OpenGLES library
|
||||
|
||||
FIND_PATH(OPENGLES_INCLUDE_DIR gl2.h PATH_SUFFIXES GLES2)
|
||||
FIND_PATH(OPENGLES_INCLUDE_DIR NAMES GLES2/gl2.h)
|
||||
FIND_LIBRARY(OPENGLES_LIBRARY NAMES GLESv2)
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenGLES DEFAULT_MSG OPENGLES_LIBRARY OPENGLES_INCLUDE_DIR)
|
||||
|
|
|
@ -24,12 +24,13 @@
|
|||
#ifndef GLUTIL_H
|
||||
#define GLUTIL_H
|
||||
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
|
||||
#ifndef OPENGL_ES2
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
#define GLEW_STATIC
|
||||
#include <GL/glew.h>
|
||||
//#include <GL/gl.h>
|
||||
//#include <GL/glext.h>
|
||||
#else
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GLES2/gl2.h>
|
||||
#include <GLES2/gl2ext.h>
|
||||
#endif
|
||||
|
|
|
@ -30,6 +30,18 @@ Graphics g_graphics;
|
|||
|
||||
void Graphics::init()
|
||||
{
|
||||
#ifndef OPENGL_ES2
|
||||
// init GL extensions
|
||||
GLenum err = glewInit();
|
||||
if(err != GLEW_OK)
|
||||
logFatal("Unable to init GLEW: ", glewGetErrorString(err));
|
||||
if(!GLEW_ARB_vertex_program || !GLEW_ARB_vertex_shader ||
|
||||
!GLEW_ARB_fragment_program || !GLEW_ARB_fragment_shader ||
|
||||
!GLEW_ARB_framebuffer_object ||
|
||||
!GLEW_ARB_multitexture)
|
||||
logFatal("Your video driver is not supported");
|
||||
#endif
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2011 OTClient <https://github.com/edubart/otclient>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef CRASHHANDLER_H
|
||||
#define CRASHHANDLER_H
|
||||
|
||||
void installCrashHandler();
|
||||
|
||||
#endif
|
|
@ -20,11 +20,10 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HANDLE_EXCEPTIONS
|
||||
|
||||
#include <csignal>
|
||||
#include "crashhandler.h"
|
||||
#include <framework/global.h>
|
||||
#include <execinfo.h>
|
||||
#include <framework/application.h>
|
||||
|
||||
#define MAX_BACKTRACE_DEPTH 128
|
||||
#define DEMANGLE_BACKTRACE_SYMBOLS
|
||||
|
@ -38,7 +37,7 @@ void crashHandler(int signum, siginfo_t* info, void* secret)
|
|||
char fileName[128];
|
||||
time(&tnow);
|
||||
tm *ts = localtime(&tnow);
|
||||
strftime(fileName, 128, (x11.appName + "-crash_-%d-%m-%Y_%H:%M:%S.txt").c_str(), ts);
|
||||
strftime(fileName, 128, (g_app->getAppName() + "-crash_-%d-%m-%Y_%H:%M:%S.txt").c_str(), ts);
|
||||
|
||||
std::stringstream ss;
|
||||
ss.flags(std::ios::hex | std::ios::showbase);
|
||||
|
@ -103,10 +102,9 @@ void crashHandler(int signum, siginfo_t* info, void* secret)
|
|||
signal(SIGSEGV, SIG_DFL);
|
||||
signal(SIGFPE, SIG_DFL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HANDLE_EXCEPTIONS
|
||||
void installCrashHandler()
|
||||
{
|
||||
struct sigaction sa;
|
||||
sa.sa_sigaction = &crashHandler;
|
||||
sigemptyset (&sa.sa_mask);
|
||||
|
@ -115,4 +113,4 @@ void crashHandler(int signum, siginfo_t* info, void* secret)
|
|||
sigaction(SIGILL, &sa, NULL); // illegal instruction
|
||||
sigaction(SIGSEGV, &sa, NULL); // segmentation fault
|
||||
sigaction(SIGFPE, &sa, NULL); // floating-point exception
|
||||
#endif
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2011 OTClient <https://github.com/edubart/otclient>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "crashhandler.h"
|
||||
#include <framework/global.h>
|
||||
#include <windows.h>
|
||||
#include <dbghelp.h>
|
||||
#include <framework/application.h>
|
||||
|
||||
typedef BOOL (WINAPI *MINIDUMPWRITEDUMP)(
|
||||
HANDLE hProcess,
|
||||
DWORD ProcessId,
|
||||
HANDLE hFile,
|
||||
MINIDUMP_TYPE DumpType,
|
||||
PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
|
||||
PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
|
||||
PMINIDUMP_CALLBACK_INFORMATION CallbackParam);
|
||||
|
||||
LONG WINAPI crashHandler(EXCEPTION_POINTERS* exceptionPointers)
|
||||
{
|
||||
logError("Application crashed");
|
||||
HMODULE hDbgHelp = LoadLibraryA("DBGHELP.DLL");
|
||||
char fileName[128];
|
||||
|
||||
if(hDbgHelp) {
|
||||
MINIDUMPWRITEDUMP minuDumpWriteDump = (MINIDUMPWRITEDUMP)GetProcAddress(hDbgHelp, "MiniDumpWriteDump");
|
||||
|
||||
SYSTEMTIME systemTime;
|
||||
GetSystemTime(&systemTime);
|
||||
snprintf(fileName, 128, "%s_%02u-%02u-%04u_%02u-%02u-%02u.mdmp", g_app->getAppName().c_str(),
|
||||
systemTime.wDay, systemTime.wMonth, systemTime.wYear,
|
||||
systemTime.wHour, systemTime.wMinute, systemTime.wSecond);
|
||||
|
||||
HANDLE hFile = CreateFileA(fileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if(hFile) {
|
||||
MINIDUMP_EXCEPTION_INFORMATION exceptionInformation;
|
||||
exceptionInformation.ClientPointers = FALSE;
|
||||
exceptionInformation.ExceptionPointers = exceptionPointers;
|
||||
exceptionInformation.ThreadId = GetCurrentThreadId();
|
||||
|
||||
HANDLE hProcess = GetCurrentProcess();
|
||||
DWORD ProcessId = GetProcessId(hProcess);
|
||||
MINIDUMP_TYPE flags = (MINIDUMP_TYPE)(MiniDumpNormal);
|
||||
|
||||
BOOL dumpResult = minuDumpWriteDump(hProcess, ProcessId, hFile, flags, &exceptionInformation, NULL, NULL);
|
||||
if(!dumpResult){
|
||||
logError("Cannot generate minidump: ", GetLastError());
|
||||
CloseHandle(hFile);
|
||||
DeleteFileA(fileName);
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
} else {
|
||||
logInfo("Crash minidump genarated on file ", fileName);
|
||||
}
|
||||
} else {
|
||||
logError("Cannot create dump file: ", GetLastError());
|
||||
}
|
||||
} else {
|
||||
logError("Cannot create dump file: dbghlp.dll not found");
|
||||
}
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
void installCrashHandler()
|
||||
{
|
||||
SetUnhandledExceptionFilter(crashHandler);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -25,9 +25,61 @@
|
|||
|
||||
#include "platformwindow.h"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
struct WindowProcProxy;
|
||||
|
||||
class WIN32Window : public PlatformWindow
|
||||
{
|
||||
//TODO
|
||||
void internalCreateWindow();
|
||||
void internalRegisterWindowClass();
|
||||
|
||||
void internalChooseGLVisual();
|
||||
void internalCreateGLContext();
|
||||
|
||||
void *getExtensionProcAddress(const char *ext);
|
||||
bool isExtensionSupported(const char *ext);
|
||||
|
||||
LRESULT windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
friend class WindowProcProxy;
|
||||
|
||||
public:
|
||||
WIN32Window();
|
||||
|
||||
void init();
|
||||
void terminate();
|
||||
|
||||
void move(const Point& pos);
|
||||
void resize(const Size& size);
|
||||
void show();
|
||||
void hide();
|
||||
void maximize();
|
||||
void poll();
|
||||
void swapBuffers();
|
||||
void showMouse();
|
||||
void hideMouse();
|
||||
|
||||
void setTitle(const std::string& title);
|
||||
void setMinimumSize(const Size& minimumSize);
|
||||
void setFullscreen(bool fullscreen);
|
||||
void setVerticalSync(bool enable);
|
||||
void setIcon(const std::string& iconFile);
|
||||
void setClipboardText(const std::string& text);
|
||||
|
||||
Size getDisplaySize();
|
||||
std::string getClipboardText();
|
||||
|
||||
bool isMaximized() { return m_maximized; }
|
||||
|
||||
private:
|
||||
HWND m_window;
|
||||
HINSTANCE m_instance;
|
||||
HDC m_deviceContext;
|
||||
HGLRC m_glContext;
|
||||
bool m_maximized;
|
||||
Point m_lastWindowPos;
|
||||
std::string m_clipboardText;
|
||||
std::map<int, Fw::Key> m_keyMap;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -26,9 +26,25 @@
|
|||
|
||||
X11Window::X11Window()
|
||||
{
|
||||
m_cursor = None;
|
||||
m_display = 0;
|
||||
m_visual = 0;
|
||||
m_window = 0;
|
||||
m_rootWindow = 0;
|
||||
m_colormap = 0;
|
||||
m_cursor = 0;
|
||||
m_xim = 0;
|
||||
m_xic = 0;
|
||||
m_screen = 0;
|
||||
m_wmDelete = 0;
|
||||
|
||||
#ifndef OPENGL_ES2
|
||||
m_glxContext = 0;
|
||||
#else
|
||||
m_eglConfig = 0;
|
||||
m_eglContext = 0;
|
||||
m_eglDisplay = 0;
|
||||
m_eglSurface = 0;
|
||||
#endif
|
||||
|
||||
m_keyMap[XK_Escape] = Fw::KeyEscape;
|
||||
m_keyMap[XK_Tab] = Fw::KeyTab;
|
||||
|
@ -193,23 +209,37 @@ void X11Window::init()
|
|||
|
||||
void X11Window::terminate()
|
||||
{
|
||||
XDestroyWindow(m_display, m_window);
|
||||
if(m_window) {
|
||||
XDestroyWindow(m_display, m_window);
|
||||
m_window = 0;
|
||||
}
|
||||
|
||||
if(m_colormap)
|
||||
if(m_colormap) {
|
||||
XFreeColormap(m_display, m_colormap);
|
||||
m_colormap = 0;
|
||||
}
|
||||
|
||||
internalDestroyGLContext();
|
||||
|
||||
if(m_visual)
|
||||
if(m_visual) {
|
||||
XFree(m_visual);
|
||||
m_visual = 0;
|
||||
}
|
||||
|
||||
if(m_xic)
|
||||
if(m_xic) {
|
||||
XDestroyIC(m_xic);
|
||||
m_xic = 0;
|
||||
}
|
||||
|
||||
if(m_xim)
|
||||
if(m_xim) {
|
||||
XCloseIM(m_xim);
|
||||
m_xim = 0;
|
||||
}
|
||||
|
||||
XCloseDisplay(m_display);
|
||||
if(m_display) {
|
||||
XCloseDisplay(m_display);
|
||||
m_display = 0;
|
||||
}
|
||||
|
||||
m_visible = false;
|
||||
}
|
||||
|
@ -380,12 +410,24 @@ void X11Window::internalCreateGLContext()
|
|||
void X11Window::internalDestroyGLContext()
|
||||
{
|
||||
#ifndef OPENGL_ES2
|
||||
glXMakeCurrent(m_display, None, NULL);
|
||||
glXDestroyContext(m_display, m_glxContext);
|
||||
if(m_glxContext) {
|
||||
glXMakeCurrent(m_display, None, NULL);
|
||||
glXDestroyContext(m_display, m_glxContext);
|
||||
m_glxContext = 0;
|
||||
}
|
||||
#else
|
||||
eglDestroyContext(m_eglDisplay, m_eglContext);
|
||||
eglDestroySurface(m_eglDisplay, m_eglSurface);
|
||||
eglTerminate(m_eglDisplay);
|
||||
if(m_eglDisplay) {
|
||||
if(m_eglContext) {
|
||||
eglDestroyContext(m_eglDisplay, m_eglContext);
|
||||
m_eglContext = 0;
|
||||
}
|
||||
if(m_eglSurface)
|
||||
eglDestroySurface(m_eglDisplay, m_eglSurface);
|
||||
m_eglSurface = 0;
|
||||
}
|
||||
eglTerminate(m_eglDisplay);
|
||||
m_eglDisplay = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -27,11 +27,13 @@
|
|||
#include "item.h"
|
||||
#include "missile.h"
|
||||
#include "statictext.h"
|
||||
|
||||
#include <framework/graphics/graphics.h>
|
||||
#include <framework/graphics/framebuffer.h>
|
||||
#include <framework/graphics/paintershaderprogram.h>
|
||||
#include <framework/graphics/paintershadersources.h>
|
||||
#include <framework/graphics/texture.h>
|
||||
|
||||
Map g_map;
|
||||
|
||||
Map::Map()
|
||||
|
@ -39,7 +41,6 @@ Map::Map()
|
|||
setVisibleSize(Size(MAP_VISIBLE_WIDTH, MAP_VISIBLE_HEIGHT));
|
||||
}
|
||||
|
||||
PainterShaderProgramPtr program;
|
||||
void Map::draw(const Rect& rect)
|
||||
{
|
||||
if(!m_framebuffer) {
|
||||
|
@ -47,10 +48,10 @@ void Map::draw(const Rect& rect)
|
|||
m_framebuffer = FrameBufferPtr(new FrameBuffer(fboSize));
|
||||
|
||||
|
||||
program = PainterShaderProgramPtr(new PainterShaderProgram);
|
||||
program->addShaderFromSourceCode(Shader::Vertex, glslMainWithTexCoordsVertexShader + glslPositionOnlyVertexShader);
|
||||
program->addShaderFromSourceFile(Shader::Fragment, "/game_shaders/map.frag");
|
||||
assert(program->link());
|
||||
m_shaderProgram = PainterShaderProgramPtr(new PainterShaderProgram);
|
||||
m_shaderProgram->addShaderFromSourceCode(Shader::Vertex, glslMainWithTexCoordsVertexShader + glslPositionOnlyVertexShader);
|
||||
m_shaderProgram->addShaderFromSourceFile(Shader::Fragment, "/game_shaders/map.frag");
|
||||
assert(m_shaderProgram->link());
|
||||
}
|
||||
|
||||
g_painter.setColor(Fw::white);
|
||||
|
@ -95,7 +96,7 @@ void Map::draw(const Rect& rect)
|
|||
m_framebuffer->release();
|
||||
|
||||
|
||||
g_painter.setCustomProgram(program);
|
||||
g_painter.setCustomProgram(m_shaderProgram);
|
||||
g_painter.setColor(Fw::white);
|
||||
m_framebuffer->draw(rect);
|
||||
g_painter.releaseCustomProgram();
|
||||
|
|
|
@ -87,6 +87,7 @@ private:
|
|||
Point m_centralOffset, m_drawOffset;
|
||||
|
||||
FrameBufferPtr m_framebuffer;
|
||||
PainterShaderProgramPtr m_shaderProgram;
|
||||
};
|
||||
|
||||
extern Map g_map;
|
||||
|
|
Loading…
Reference in New Issue