Merge #8
This commit is contained in:
		
						commit
						a0a27889a3
					
				
					 22 changed files with 602 additions and 100 deletions
				
			
		| 
						 | 
				
			
			@ -873,7 +873,7 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
 | 
			
		|||
				}
 | 
			
		||||
 | 
			
		||||
				TEX::bind(p->gl.tex);
 | 
			
		||||
				TEX::uploadSubImage(posRect.x, posRect.y, posRect.w, posRect.h, txtSurf->pixels, GL_BGRA_EXT);
 | 
			
		||||
				TEX::uploadSubImage(posRect.x, posRect.y, posRect.w, posRect.h, txtSurf->pixels, GL_BGRA);
 | 
			
		||||
 | 
			
		||||
				PixelStore::reset();
 | 
			
		||||
			}
 | 
			
		||||
| 
						 | 
				
			
			@ -884,7 +884,7 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
 | 
			
		|||
			TEXFBO &gpTF = shState->gpTexFBO(txtSurf->w, txtSurf->h);
 | 
			
		||||
 | 
			
		||||
			TEX::bind(gpTF.tex);
 | 
			
		||||
			TEX::uploadSubImage(0, 0, txtSurf->w, txtSurf->h, txtSurf->pixels, GL_BGRA_EXT);
 | 
			
		||||
			TEX::uploadSubImage(0, 0, txtSurf->w, txtSurf->h, txtSurf->pixels, GL_BGRA);
 | 
			
		||||
 | 
			
		||||
			FBO::bind(gpTF.fbo, FBO::Read);
 | 
			
		||||
			p->bindFBO();
 | 
			
		||||
| 
						 | 
				
			
			@ -917,7 +917,7 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
 | 
			
		|||
		shader.setOpacity(txtAlpha);
 | 
			
		||||
 | 
			
		||||
		shState->bindTex();
 | 
			
		||||
		TEX::uploadSubImage(0, 0, txtSurf->w, txtSurf->h, txtSurf->pixels, GL_BGRA_EXT);
 | 
			
		||||
		TEX::uploadSubImage(0, 0, txtSurf->w, txtSurf->h, txtSurf->pixels, GL_BGRA);
 | 
			
		||||
		TEX::setSmooth(true);
 | 
			
		||||
 | 
			
		||||
		Quad &quad = shState->gpQuad();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,6 +24,7 @@
 | 
			
		|||
#include <boost/program_options/options_description.hpp>
 | 
			
		||||
#include <boost/program_options/parsers.hpp>
 | 
			
		||||
#include <boost/program_options/variables_map.hpp>
 | 
			
		||||
 | 
			
		||||
#include <fstream>
 | 
			
		||||
 | 
			
		||||
#include "debugwriter.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -45,6 +46,7 @@ Config::Config()
 | 
			
		|||
      frameSkip(true),
 | 
			
		||||
      solidFonts(false),
 | 
			
		||||
      gameFolder("."),
 | 
			
		||||
      anyAltToggleFS(false),
 | 
			
		||||
      allowSymlinks(false),
 | 
			
		||||
      pathCache(true)
 | 
			
		||||
{}
 | 
			
		||||
| 
						 | 
				
			
			@ -64,10 +66,15 @@ void Config::read()
 | 
			
		|||
	PO_DESC(frameSkip, bool) \
 | 
			
		||||
	PO_DESC(solidFonts, bool) \
 | 
			
		||||
	PO_DESC(gameFolder, std::string) \
 | 
			
		||||
	PO_DESC(anyAltToggleFS, bool) \
 | 
			
		||||
	PO_DESC(allowSymlinks, bool) \
 | 
			
		||||
	PO_DESC(iconPath, std::string) \
 | 
			
		||||
	PO_DESC(customScript, std::string) \
 | 
			
		||||
	PO_DESC(pathCache, bool)
 | 
			
		||||
 | 
			
		||||
// Not gonna take your shit boost
 | 
			
		||||
#define GUARD_ALL( exp ) try { exp } catch(...) {}
 | 
			
		||||
 | 
			
		||||
#define PO_DESC(key, type) (#key, po::value< type >()->default_value(key))
 | 
			
		||||
 | 
			
		||||
	po::options_description podesc;
 | 
			
		||||
| 
						 | 
				
			
			@ -80,13 +87,15 @@ void Config::read()
 | 
			
		|||
	confFile.open("mkxp.conf");
 | 
			
		||||
 | 
			
		||||
	po::variables_map vm;
 | 
			
		||||
	po::store(po::parse_config_file(confFile, podesc, true), vm);
 | 
			
		||||
	po::notify(vm);
 | 
			
		||||
 | 
			
		||||
	if (confFile)
 | 
			
		||||
	{
 | 
			
		||||
		GUARD_ALL( po::store(po::parse_config_file(confFile, podesc, true), vm); )
 | 
			
		||||
		po::notify(vm);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	confFile.close();
 | 
			
		||||
 | 
			
		||||
// Not gonna take your shit boost
 | 
			
		||||
#define GUARD_ALL( exp ) try { exp } catch(...) {}
 | 
			
		||||
 | 
			
		||||
#undef PO_DESC
 | 
			
		||||
#define PO_DESC(key, type) GUARD_ALL( key = vm[#key].as< type >(); )
 | 
			
		||||
| 
						 | 
				
			
			@ -103,7 +112,10 @@ void Config::readGameINI()
 | 
			
		|||
{
 | 
			
		||||
	if (!customScript.empty())
 | 
			
		||||
	{
 | 
			
		||||
		game.title = basename(customScript.c_str());
 | 
			
		||||
		size_t pos = customScript.find_last_of("/\\");
 | 
			
		||||
		if (pos == customScript.npos)
 | 
			
		||||
			pos = 0;
 | 
			
		||||
		game.title = customScript.substr(pos);
 | 
			
		||||
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -120,7 +132,7 @@ void Config::readGameINI()
 | 
			
		|||
	iniFile.open((iniPath).c_str());
 | 
			
		||||
 | 
			
		||||
	po::variables_map vm;
 | 
			
		||||
	po::store(po::parse_config_file(iniFile, podesc, true), vm);
 | 
			
		||||
	GUARD_ALL( po::store(po::parse_config_file(iniFile, podesc, true), vm); )
 | 
			
		||||
	po::notify(vm);
 | 
			
		||||
 | 
			
		||||
	iniFile.close();
 | 
			
		||||
| 
						 | 
				
			
			@ -131,5 +143,10 @@ void Config::readGameINI()
 | 
			
		|||
	strReplace(game.scripts, '\\', '/');
 | 
			
		||||
 | 
			
		||||
	if (game.title.empty())
 | 
			
		||||
		game.title = basename(gameFolder.c_str());
 | 
			
		||||
	{
 | 
			
		||||
		size_t pos = gameFolder.find_last_of("/\\");
 | 
			
		||||
		if (pos == gameFolder.npos)
 | 
			
		||||
			pos = 0;
 | 
			
		||||
		game.title = gameFolder.substr(pos);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,9 +44,12 @@ struct Config
 | 
			
		|||
	bool solidFonts;
 | 
			
		||||
 | 
			
		||||
	std::string gameFolder;
 | 
			
		||||
	bool anyAltToggleFS;
 | 
			
		||||
	bool allowSymlinks;
 | 
			
		||||
	bool pathCache;
 | 
			
		||||
 | 
			
		||||
	std::string iconPath;
 | 
			
		||||
 | 
			
		||||
	std::string customScript;
 | 
			
		||||
	std::vector<std::string> rtps;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -125,7 +125,7 @@ struct CVertex
 | 
			
		|||
 | 
			
		||||
	static const void *colorOffset()
 | 
			
		||||
	{
 | 
			
		||||
		return (const void*) sizeof(pos);
 | 
			
		||||
		return (const void*) sizeof(Vec2);
 | 
			
		||||
	}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -70,6 +70,7 @@ void EventThread::process(RGSSThreadData &rtData)
 | 
			
		|||
	WindowSizeNotify &windowSizeMsg = rtData.windowSizeMsg;
 | 
			
		||||
 | 
			
		||||
	fullscreen = rtData.config.fullscreen;
 | 
			
		||||
	int toggleFSMod = rtData.config.anyAltToggleFS ? KMOD_ALT : KMOD_LALT;
 | 
			
		||||
 | 
			
		||||
	fps.lastFrame = SDL_GetPerformanceCounter();
 | 
			
		||||
	fps.displaying = false;
 | 
			
		||||
| 
						 | 
				
			
			@ -151,7 +152,7 @@ void EventThread::process(RGSSThreadData &rtData)
 | 
			
		|||
 | 
			
		||||
		case SDL_KEYDOWN :
 | 
			
		||||
			if (event.key.keysym.scancode == SDL_SCANCODE_RETURN &&
 | 
			
		||||
			    (event.key.keysym.mod & KMOD_LALT))
 | 
			
		||||
			    (event.key.keysym.mod & toggleFSMod))
 | 
			
		||||
			{
 | 
			
		||||
				setFullscreen(win, !fullscreen);
 | 
			
		||||
				if (!fullscreen && havePendingTitle)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -179,13 +179,15 @@ struct RGSSThreadData
 | 
			
		|||
 | 
			
		||||
	RGSSThreadData(EventThread *ethread,
 | 
			
		||||
	                 const char *argv0,
 | 
			
		||||
	                 SDL_Window *window)
 | 
			
		||||
	                 SDL_Window *window,
 | 
			
		||||
				     const Config& newconf)
 | 
			
		||||
	    : rqTerm(false),
 | 
			
		||||
	      rqTermAck(false),
 | 
			
		||||
	      ethread(ethread),
 | 
			
		||||
	      argv0(argv0),
 | 
			
		||||
	      window(window),
 | 
			
		||||
	      sizeResoRatio(1, 1),
 | 
			
		||||
	      config(newconf),
 | 
			
		||||
	      rqScreenshot(false)
 | 
			
		||||
	{}
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -109,19 +109,19 @@ namespace RBO
 | 
			
		|||
	inline ID gen()
 | 
			
		||||
	{
 | 
			
		||||
		ID id;
 | 
			
		||||
		glGenRenderbuffersEXT(1, &id.gl);
 | 
			
		||||
		glGenRenderbuffers(1, &id.gl);
 | 
			
		||||
 | 
			
		||||
		return id;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	inline void del(ID id)
 | 
			
		||||
	{
 | 
			
		||||
		glDeleteRenderbuffersEXT(1, &id.gl);
 | 
			
		||||
		glDeleteRenderbuffers(1, &id.gl);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	inline void bind(ID id)
 | 
			
		||||
	{
 | 
			
		||||
		glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, id.gl);
 | 
			
		||||
		glBindRenderbuffer(GL_RENDERBUFFER, id.gl);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	inline void unbind()
 | 
			
		||||
| 
						 | 
				
			
			@ -131,7 +131,7 @@ namespace RBO
 | 
			
		|||
 | 
			
		||||
	inline void allocEmpty(GLsizei width, GLsizei height)
 | 
			
		||||
	{
 | 
			
		||||
		glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA8, width, height);
 | 
			
		||||
		glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, width, height);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -155,25 +155,25 @@ namespace FBO
 | 
			
		|||
	inline ID gen()
 | 
			
		||||
	{
 | 
			
		||||
		ID id;
 | 
			
		||||
		glGenFramebuffersEXT(1, &id.gl);
 | 
			
		||||
		glGenFramebuffers(1, &id.gl);
 | 
			
		||||
 | 
			
		||||
		return id;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	inline void del(ID id)
 | 
			
		||||
	{
 | 
			
		||||
		glDeleteFramebuffersEXT(1, &id.gl);
 | 
			
		||||
		glDeleteFramebuffers(1, &id.gl);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	inline void bind(ID id, Mode mode)
 | 
			
		||||
	{
 | 
			
		||||
		static const GLenum modes[] =
 | 
			
		||||
		{
 | 
			
		||||
			GL_DRAW_FRAMEBUFFER_EXT,
 | 
			
		||||
			GL_READ_FRAMEBUFFER_EXT
 | 
			
		||||
			GL_DRAW_FRAMEBUFFER,
 | 
			
		||||
			GL_READ_FRAMEBUFFER
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
		glBindFramebufferEXT(modes[mode], id.gl);
 | 
			
		||||
		glBindFramebuffer(modes[mode], id.gl);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	inline void unbind(Mode mode)
 | 
			
		||||
| 
						 | 
				
			
			@ -183,12 +183,12 @@ namespace FBO
 | 
			
		|||
 | 
			
		||||
	inline void setTarget(TEX::ID target, unsigned colorAttach = 0)
 | 
			
		||||
	{
 | 
			
		||||
		glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + colorAttach, GL_TEXTURE_2D, target.gl, 0);
 | 
			
		||||
		glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + colorAttach, GL_TEXTURE_2D, target.gl, 0);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	inline void setTarget(RBO::ID target, unsigned colorAttach = 0)
 | 
			
		||||
	{
 | 
			
		||||
		glFramebufferRenderbufferEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + colorAttach, GL_RENDERBUFFER, target.gl);
 | 
			
		||||
		glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + colorAttach, GL_RENDERBUFFER, target.gl);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	inline void blit(int srcX, int srcY,
 | 
			
		||||
| 
						 | 
				
			
			@ -203,9 +203,9 @@ namespace FBO
 | 
			
		|||
			GL_LINEAR
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
		glBlitFramebufferEXT(srcX, srcY, srcX+srcW, srcY+srcH,
 | 
			
		||||
		                     dstX, dstY, dstX+dstW, dstY+dstH,
 | 
			
		||||
		                     GL_COLOR_BUFFER_BIT, modes[mode]);
 | 
			
		||||
		glBlitFramebuffer(srcX, srcY, srcX+srcW, srcY+srcH,
 | 
			
		||||
		                  dstX, dstY, dstX+dstW, dstY+dstH,
 | 
			
		||||
		                  GL_COLOR_BUFFER_BIT, modes[mode]);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	inline void blit(int srcX, int srcY,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -71,21 +71,21 @@ void GLBlendMode::apply(const BlendType &value)
 | 
			
		|||
 | 
			
		||||
	case BlendNormal :
 | 
			
		||||
		glBlendEquation(GL_FUNC_ADD);
 | 
			
		||||
		glBlendFuncSeparateEXT(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,
 | 
			
		||||
		                       GL_ONE,       GL_ONE_MINUS_SRC_ALPHA);
 | 
			
		||||
		glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,
 | 
			
		||||
		                    GL_ONE,       GL_ONE_MINUS_SRC_ALPHA);
 | 
			
		||||
		break;
 | 
			
		||||
 | 
			
		||||
	case BlendAddition :
 | 
			
		||||
		glBlendEquation(GL_FUNC_ADD);
 | 
			
		||||
		glBlendFuncSeparateEXT(GL_SRC_ALPHA, GL_ONE,
 | 
			
		||||
		                       GL_ONE,       GL_ONE);
 | 
			
		||||
		glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE,
 | 
			
		||||
		                    GL_ONE,       GL_ONE);
 | 
			
		||||
		break;
 | 
			
		||||
 | 
			
		||||
	case BlendSubstraction :
 | 
			
		||||
		// FIXME Alpha calculation is untested
 | 
			
		||||
		glBlendEquation(GL_FUNC_REVERSE_SUBTRACT_EXT);
 | 
			
		||||
		glBlendFuncSeparateEXT(GL_SRC_ALPHA, GL_ONE,
 | 
			
		||||
		                       GL_ONE,       GL_ONE);
 | 
			
		||||
		glBlendEquation(GL_FUNC_REVERSE_SUBTRACT);
 | 
			
		||||
		glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE,
 | 
			
		||||
		                    GL_ONE,       GL_ONE);
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -52,6 +52,10 @@ struct GLProperty
 | 
			
		|||
		set(value);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void refresh()
 | 
			
		||||
	{
 | 
			
		||||
		apply(current);
 | 
			
		||||
	}
 | 
			
		||||
private:
 | 
			
		||||
	virtual void apply(const T &value) = 0;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -461,6 +461,8 @@ struct GraphicsPrivate
 | 
			
		|||
	{
 | 
			
		||||
		if (threadData->windowSizeMsg.pollChange(&winSize.x, &winSize.y))
 | 
			
		||||
		{
 | 
			
		||||
			// some GL drivers change the viewport on window resize
 | 
			
		||||
			glState.viewport.refresh();
 | 
			
		||||
			recalculateScreenSize();
 | 
			
		||||
			updateScreenResoRatio();
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										119
									
								
								src/main.cpp
									
										
									
									
									
								
							
							
						
						
									
										119
									
								
								src/main.cpp
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -37,22 +37,7 @@
 | 
			
		|||
 | 
			
		||||
#include "binding.h"
 | 
			
		||||
 | 
			
		||||
static const char *reqExt[] =
 | 
			
		||||
{
 | 
			
		||||
	"GL_ARB_fragment_shader",
 | 
			
		||||
	"GL_ARB_shader_objects",
 | 
			
		||||
	"GL_ARB_vertex_shader",
 | 
			
		||||
	"GL_ARB_shading_language_100",
 | 
			
		||||
	"GL_ARB_texture_non_power_of_two",
 | 
			
		||||
	"GL_ARB_vertex_array_object",
 | 
			
		||||
	"GL_ARB_vertex_buffer_object",
 | 
			
		||||
	"GL_EXT_bgra",
 | 
			
		||||
	"GL_EXT_blend_func_separate",
 | 
			
		||||
	"GL_EXT_blend_subtract",
 | 
			
		||||
	"GL_EXT_framebuffer_object",
 | 
			
		||||
	"GL_EXT_framebuffer_blit",
 | 
			
		||||
	0
 | 
			
		||||
};
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
rgssThreadError(RGSSThreadData *rtData, const std::string &msg)
 | 
			
		||||
| 
						 | 
				
			
			@ -77,6 +62,60 @@ printGLInfo()
 | 
			
		|||
	Debug() << "GLSL Version :" << glGetStringInt(GL_SHADING_LANGUAGE_VERSION);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static bool
 | 
			
		||||
setupOptionalGLExtensions(RGSSThreadData* threadData)
 | 
			
		||||
{
 | 
			
		||||
	if (!GLEW_ARB_framebuffer_object)
 | 
			
		||||
	{
 | 
			
		||||
		if (!GLEW_EXT_framebuffer_object && !GLEW_EXT_framebuffer_blit)
 | 
			
		||||
		{
 | 
			
		||||
			rgssThreadError(threadData, "GL extensions \"GL_ARB_framebuffer_object\" or compatible extensiosns GL_EXT_framebuffer_object and GL_EXT_framebuffer_blit are not present");
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			/* setup compat */
 | 
			
		||||
			/* From EXT_framebuffer_object */
 | 
			
		||||
			glGenRenderbuffers        = glGenRenderbuffersEXT;
 | 
			
		||||
			glDeleteRenderbuffers     = glDeleteRenderbuffersEXT;
 | 
			
		||||
			glBindRenderbuffer        = glBindRenderbufferEXT;
 | 
			
		||||
			glRenderbufferStorage     = glRenderbufferStorageEXT;
 | 
			
		||||
 | 
			
		||||
			glGenFramebuffers         = glGenFramebuffersEXT;
 | 
			
		||||
			glDeleteFramebuffers      = glDeleteFramebuffersEXT;
 | 
			
		||||
			glBindFramebuffer         = glBindFramebufferEXT;
 | 
			
		||||
			glFramebufferTexture2D    = glFramebufferTexture2DEXT;
 | 
			
		||||
			glFramebufferRenderbuffer = glFramebufferRenderbufferEXT;
 | 
			
		||||
 | 
			
		||||
			/* From EXT_framebuffer_blit */
 | 
			
		||||
			glBlitFramebuffer         = glBlitFramebufferEXT;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if (!GLEW_ARB_timer_query && GLEW_EXT_timer_query)
 | 
			
		||||
	{
 | 
			
		||||
		glGetQueryObjecti64v  = glGetQueryObjecti64vEXT;
 | 
			
		||||
		glGetQueryObjectui64v = glGetQueryObjectui64vEXT;
 | 
			
		||||
	}
 | 
			
		||||
	if (!GLEW_ARB_vertex_array_object )
 | 
			
		||||
	{
 | 
			
		||||
		if (!GLEW_APPLE_vertex_array_object)
 | 
			
		||||
		{
 | 
			
		||||
			rgssThreadError(threadData, "GL extensions \"GL_ARB_vertex_array_object\" or compatible extensiosn GL_APPLE_vertex_array_object are not present");
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			/* setup compat */
 | 
			
		||||
			glBindVertexArray    = glBindVertexArrayAPPLE;
 | 
			
		||||
			/* the cast is because apple's uses const GLuint* and ARB doesn't */
 | 
			
		||||
			glGenVertexArrays    = (PFNGLGENVERTEXARRAYSPROC)glGenVertexArraysAPPLE;
 | 
			
		||||
			glDeleteVertexArrays = glDeleteVertexArraysAPPLE;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int rgssThreadFun(void *userdata)
 | 
			
		||||
{
 | 
			
		||||
	RGSSThreadData *threadData = static_cast<RGSSThreadData*>(userdata);
 | 
			
		||||
| 
						 | 
				
			
			@ -120,17 +159,11 @@ int rgssThreadFun(void *userdata)
 | 
			
		|||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Check for required GL extensions */
 | 
			
		||||
	for (int i = 0; reqExt[i]; ++i)
 | 
			
		||||
	/* Setup optional GL extensions */
 | 
			
		||||
	if (!setupOptionalGLExtensions(threadData))
 | 
			
		||||
	{
 | 
			
		||||
		if (!glewIsSupported(reqExt[i]))
 | 
			
		||||
		{
 | 
			
		||||
			rgssThreadError(threadData, std::string("Required GL extension \"")
 | 
			
		||||
			                            + reqExt[i] + "\" not present");
 | 
			
		||||
			SDL_GL_DeleteContext(glCtx);
 | 
			
		||||
 | 
			
		||||
			return 0;
 | 
			
		||||
		}
 | 
			
		||||
		SDL_GL_DeleteContext(glCtx);
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	SDL_GL_SetSwapInterval(threadData->config.vsync ? 1 : 0);
 | 
			
		||||
| 
						 | 
				
			
			@ -193,11 +226,7 @@ int rgssThreadFun(void *userdata)
 | 
			
		|||
 | 
			
		||||
int main(int, char *argv[])
 | 
			
		||||
{
 | 
			
		||||
	Config conf;
 | 
			
		||||
 | 
			
		||||
	conf.read();
 | 
			
		||||
	conf.readGameINI();
 | 
			
		||||
 | 
			
		||||
	/* initialize SDL first */
 | 
			
		||||
	if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0)
 | 
			
		||||
	{
 | 
			
		||||
		Debug() << "Error initializing SDL:" << SDL_GetError();
 | 
			
		||||
| 
						 | 
				
			
			@ -205,6 +234,21 @@ int main(int, char *argv[])
 | 
			
		|||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* set working directory */
 | 
			
		||||
	char *dataDir = SDL_GetBasePath();
 | 
			
		||||
	if (dataDir)
 | 
			
		||||
	{
 | 
			
		||||
		int result = chdir(dataDir);
 | 
			
		||||
		(void)result;
 | 
			
		||||
		SDL_free(dataDir);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* now we load the config */
 | 
			
		||||
	Config conf;
 | 
			
		||||
 | 
			
		||||
	conf.read();
 | 
			
		||||
	conf.readGameINI();
 | 
			
		||||
 | 
			
		||||
	int imgFlags = IMG_INIT_PNG | IMG_INIT_JPG;
 | 
			
		||||
	if (IMG_Init(imgFlags) != imgFlags)
 | 
			
		||||
	{
 | 
			
		||||
| 
						 | 
				
			
			@ -253,9 +297,18 @@ int main(int, char *argv[])
 | 
			
		|||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (!conf.iconPath.empty())
 | 
			
		||||
	{
 | 
			
		||||
		SDL_Surface *iconImg = IMG_Load(conf.iconPath.c_str());
 | 
			
		||||
		if (iconImg)
 | 
			
		||||
		{
 | 
			
		||||
			SDL_SetWindowIcon(win, iconImg);
 | 
			
		||||
			SDL_FreeSurface(iconImg);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	EventThread eventThread;
 | 
			
		||||
	RGSSThreadData rtData(&eventThread, argv[0], win);
 | 
			
		||||
	rtData.config = conf;
 | 
			
		||||
	RGSSThreadData rtData(&eventThread, argv[0], win, conf);
 | 
			
		||||
 | 
			
		||||
	/* Start RGSS thread */
 | 
			
		||||
	SDL_Thread *rgssThread =
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -193,7 +193,7 @@ PerfTimer *createCPUTimer(int iter)
 | 
			
		|||
 | 
			
		||||
PerfTimer *createGPUTimer(int iter)
 | 
			
		||||
{
 | 
			
		||||
	if (GLEW_EXT_timer_query)
 | 
			
		||||
	if (GLEW_ARB_timer_query || GLEW_EXT_timer_query)
 | 
			
		||||
	{
 | 
			
		||||
		return new GPUTimerGLQuery(iter);
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,7 +30,7 @@
 | 
			
		|||
class SceneElement;
 | 
			
		||||
class Viewport;
 | 
			
		||||
class Window;
 | 
			
		||||
class ScanRow;
 | 
			
		||||
struct ScanRow;
 | 
			
		||||
struct TilemapPrivate;
 | 
			
		||||
 | 
			
		||||
class Scene
 | 
			
		||||
| 
						 | 
				
			
			@ -63,7 +63,7 @@ protected:
 | 
			
		|||
 | 
			
		||||
	friend class SceneElement;
 | 
			
		||||
	friend class Window;
 | 
			
		||||
	friend class ScanRow;
 | 
			
		||||
	friend struct ScanRow;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class SceneElement
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue