move more into OGL_Helpers: pulling in GL.h, GLToString
This commit is contained in:
@@ -1,39 +1,13 @@
|
||||
#include "global.h"
|
||||
|
||||
/* ours may be more up-to-date */
|
||||
#define __glext_h_
|
||||
|
||||
#if defined(WIN32)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if !defined(MACOSX)
|
||||
# include <GL/gl.h>
|
||||
# include <GL/glu.h>
|
||||
#else
|
||||
# include <OpenGL/gl.h>
|
||||
# include <OpenGL/glu.h>
|
||||
#endif
|
||||
|
||||
#undef __glext_h_
|
||||
#include "glext.h"
|
||||
#include "RageDisplay_OGL.h"
|
||||
#include "RageDisplay_OGL_Helpers.h"
|
||||
using namespace RageDisplay_OGL_Helpers;
|
||||
|
||||
#include "RageSurface.h"
|
||||
#include "RageSurfaceUtils.h"
|
||||
|
||||
/* Windows's broken gl.h defines GL_EXT_paletted_texture incompletely: */
|
||||
#ifndef GL_TEXTURE_INDEX_SIZE_EXT
|
||||
#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED
|
||||
#endif
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
|
||||
#include "RageDisplay.h"
|
||||
#include "RageDisplay_OGL.h"
|
||||
#include "RageDisplay_OGL_Helpers.h"
|
||||
#include "RageUtil.h"
|
||||
#include "RageLog.h"
|
||||
#include "RageTimer.h"
|
||||
#include "RageException.h"
|
||||
#include "RageTextureManager.h"
|
||||
#include "RageMath.h"
|
||||
@@ -41,7 +15,6 @@
|
||||
#include "RageUtil.h"
|
||||
#include "EnumHelper.h"
|
||||
#include "Foreach.h"
|
||||
#include "ProductInfo.h"
|
||||
#include "DisplayResolutions.h"
|
||||
#include "LocalizedString.h"
|
||||
|
||||
@@ -49,6 +22,9 @@
|
||||
|
||||
#include "arch/arch.h"
|
||||
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma comment(lib, "opengl32.lib")
|
||||
#pragma comment(lib, "glu32.lib")
|
||||
@@ -143,30 +119,6 @@ static RageDisplay::PixelFormatDesc PIXEL_FORMAT_DESC[NUM_PixelFormat] = {
|
||||
}
|
||||
};
|
||||
|
||||
static map<GLenum, RString> g_Strings;
|
||||
static void InitStringMap()
|
||||
{
|
||||
static bool Initialized = false;
|
||||
if(Initialized) return;
|
||||
Initialized = true;
|
||||
#define X(a) g_Strings[a] = #a;
|
||||
X(GL_RGBA8); X(GL_RGBA4); X(GL_RGB5_A1); X(GL_RGB5); X(GL_RGBA); X(GL_RGB);
|
||||
X(GL_BGR); X(GL_BGRA);
|
||||
X(GL_COLOR_INDEX8_EXT); X(GL_COLOR_INDEX4_EXT); X(GL_COLOR_INDEX);
|
||||
X(GL_UNSIGNED_BYTE); X(GL_UNSIGNED_SHORT_4_4_4_4); X(GL_UNSIGNED_SHORT_5_5_5_1);
|
||||
X(GL_UNSIGNED_SHORT_1_5_5_5_REV);
|
||||
X(GL_INVALID_ENUM); X(GL_INVALID_VALUE); X(GL_INVALID_OPERATION);
|
||||
X(GL_STACK_OVERFLOW); X(GL_STACK_UNDERFLOW); X(GL_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
static RString GLToString( GLenum e )
|
||||
{
|
||||
if( g_Strings.find(e) != g_Strings.end() )
|
||||
return g_Strings[e];
|
||||
|
||||
return ssprintf( "%i", int(e) );
|
||||
}
|
||||
|
||||
/* g_GLPixFmtInfo is used for both texture formats and surface formats. For example,
|
||||
* it's fine to ask for a PixelFormat_RGB5 texture, but to supply a surface matching
|
||||
* PixelFormat_RGB8. OpenGL will simply discard the extra bits.
|
||||
@@ -289,7 +241,7 @@ RageDisplay_OGL::RageDisplay_OGL()
|
||||
LOG->MapLog("renderer", "Current renderer: OpenGL");
|
||||
|
||||
FixLittleEndian();
|
||||
InitStringMap();
|
||||
RageDisplay_OGL_Helpers::Init();
|
||||
|
||||
g_pWind = NULL;
|
||||
g_bTextureMatrixShader = 0;
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#ifndef RAGEDISPLAY_OGL_H
|
||||
#define RAGEDISPLAY_OGL_H
|
||||
|
||||
#include "RageDisplay.h"
|
||||
|
||||
class RageDisplay_OGL: public RageDisplay
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -1,29 +1,50 @@
|
||||
#include "global.h"
|
||||
|
||||
#define __glext_h_
|
||||
|
||||
#if defined(WIN32)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <set>
|
||||
|
||||
#if !defined(MACOSX)
|
||||
# include <GL/gl.h>
|
||||
# include <GL/glu.h>
|
||||
#else
|
||||
# include <OpenGL/gl.h>
|
||||
# include <OpenGL/glu.h>
|
||||
#endif
|
||||
|
||||
#undef __glext_h_
|
||||
#include "glext.h"
|
||||
|
||||
#include "RageDisplay_OGL_Helpers.h"
|
||||
#include "RageUtil.h"
|
||||
|
||||
#include "RageLog.h"
|
||||
#include "RageUtil.h"
|
||||
#include "arch/LowLevelWindow/LowLevelWindow.h"
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
namespace
|
||||
{
|
||||
map<GLenum, RString> g_Strings;
|
||||
void InitStringMap()
|
||||
{
|
||||
static bool bInitialized = false;
|
||||
if( bInitialized )
|
||||
return;
|
||||
bInitialized = true;
|
||||
|
||||
#define X(a) g_Strings[a] = #a;
|
||||
X(GL_RGBA8); X(GL_RGBA4); X(GL_RGB5_A1); X(GL_RGB5); X(GL_RGBA); X(GL_RGB);
|
||||
X(GL_BGR); X(GL_BGRA);
|
||||
X(GL_COLOR_INDEX8_EXT); X(GL_COLOR_INDEX4_EXT); X(GL_COLOR_INDEX);
|
||||
X(GL_UNSIGNED_BYTE); X(GL_UNSIGNED_SHORT_4_4_4_4); X(GL_UNSIGNED_SHORT_5_5_5_1);
|
||||
X(GL_UNSIGNED_SHORT_1_5_5_5_REV);
|
||||
X(GL_INVALID_ENUM); X(GL_INVALID_VALUE); X(GL_INVALID_OPERATION);
|
||||
X(GL_STACK_OVERFLOW); X(GL_STACK_UNDERFLOW); X(GL_OUT_OF_MEMORY);
|
||||
#undef X
|
||||
}
|
||||
};
|
||||
|
||||
void RageDisplay_OGL_Helpers::Init()
|
||||
{
|
||||
InitStringMap();
|
||||
}
|
||||
|
||||
RString RageDisplay_OGL_Helpers::GLToString( GLenum e )
|
||||
{
|
||||
if( g_Strings.find(e) != g_Strings.end() )
|
||||
return g_Strings[e];
|
||||
|
||||
return ssprintf( "%i", int(e) );
|
||||
}
|
||||
|
||||
|
||||
GLExt_t GLExt;
|
||||
|
||||
/* Available extensions: */
|
||||
@@ -192,7 +213,7 @@ void GLExt_t::Load( LowLevelWindow *pWind )
|
||||
}
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002-2005 Glenn Maynard
|
||||
* Copyright (c) 2001-2005 Chris Danford, Glenn Maynard
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
|
||||
@@ -1,11 +1,38 @@
|
||||
/* RageDisplay_OGL_Extensions - OpenGL extension helpers. */
|
||||
#ifndef RAGE_DISPLAY_OGL_HELPERS_H
|
||||
#define RAGE_DISPLAY_OGL_HELPERS_H
|
||||
|
||||
#ifndef RAGE_DISPLAY_OGL_EXTENSIONS_H
|
||||
#define RAGE_DISPLAY_OGL_EXTENSIONS_H
|
||||
/* ours may be more up-to-date */
|
||||
#define __glext_h_
|
||||
|
||||
#if defined(WIN32)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if !defined(MACOSX)
|
||||
# include <GL/gl.h>
|
||||
# include <GL/glu.h>
|
||||
#else
|
||||
# include <OpenGL/gl.h>
|
||||
# include <OpenGL/glu.h>
|
||||
#endif
|
||||
|
||||
#undef __glext_h_
|
||||
#include "glext.h"
|
||||
|
||||
/* Windows defines GL_EXT_paletted_texture incompletely: */
|
||||
#ifndef GL_TEXTURE_INDEX_SIZE_EXT
|
||||
#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED
|
||||
#endif
|
||||
|
||||
/* Not in glext.h: */
|
||||
typedef bool (APIENTRY * PWSWAPINTERVALEXTPROC) (int interval);
|
||||
|
||||
namespace RageDisplay_OGL_Helpers
|
||||
{
|
||||
void Init();
|
||||
RString GLToString( GLenum e );
|
||||
};
|
||||
|
||||
class LowLevelWindow;
|
||||
struct GLExt_t
|
||||
{
|
||||
@@ -61,7 +88,7 @@ extern GLExt_t GLExt;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003-2005 Glenn Maynard
|
||||
* Copyright (c) 2001-2004 Chris Danford, Glenn Maynard
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
|
||||
Reference in New Issue
Block a user