mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-02 09:03:37 +00:00
Finaly remove OpenGL.h, OpenGL.cpp and other obsolete files.
This commit is contained in:
parent
81702f0e5d
commit
3fdbed8f5e
|
@ -337,13 +337,8 @@
|
|||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\mupenplus\OpenGL_mupenplus.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\N64.cpp" />
|
||||
<ClCompile Include="..\..\src\NoiseTexture.cpp" />
|
||||
<ClCompile Include="..\..\src\OpenGL.cpp" />
|
||||
<ClCompile Include="..\..\src\PaletteTexture.cpp" />
|
||||
<ClCompile Include="..\..\src\Performance.cpp" />
|
||||
<ClCompile Include="..\..\src\PostProcessor.cpp" />
|
||||
|
@ -352,9 +347,7 @@
|
|||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_mupenplus|Win32'">false</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\RSP.cpp" />
|
||||
<ClCompile Include="..\..\src\ShaderUtils.cpp" />
|
||||
<ClCompile Include="..\..\src\SoftwareRender.cpp" />
|
||||
<ClCompile Include="..\..\src\TextDrawer.cpp" />
|
||||
<ClCompile Include="..\..\src\TextureFilterHandler.cpp" />
|
||||
<ClCompile Include="..\..\src\Textures.cpp" />
|
||||
<ClCompile Include="..\..\src\Turbo3D.cpp" />
|
||||
|
@ -384,11 +377,6 @@
|
|||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_mupenplus_uniformset|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_mupenplus|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\windows\OpenGL_windows.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_mupenplus|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_mupenplus_uniformset|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_mupenplus|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\windows\ZilmarAPIImpl_windows.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_mupenplus|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_mupenplus_uniformset|Win32'">true</ExcludedFromBuild>
|
||||
|
@ -473,7 +461,6 @@
|
|||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\N64.h" />
|
||||
<ClInclude Include="..\..\src\NoiseTexture.h" />
|
||||
<ClInclude Include="..\..\src\OpenGL.h" />
|
||||
<ClInclude Include="..\..\src\PaletteTexture.h" />
|
||||
<ClInclude Include="..\..\src\Performance.h" />
|
||||
<ClInclude Include="..\..\src\Platform.h" />
|
||||
|
@ -482,9 +469,7 @@
|
|||
<ClInclude Include="..\..\src\RDP.h" />
|
||||
<ClInclude Include="..\..\src\GraphicsDrawer.h" />
|
||||
<ClInclude Include="..\..\src\RSP.h" />
|
||||
<ClInclude Include="..\..\src\ShaderUtils.h" />
|
||||
<ClInclude Include="..\..\src\SoftwareRender.h" />
|
||||
<ClInclude Include="..\..\src\TextDrawer.h" />
|
||||
<ClInclude Include="..\..\src\TextureFilterHandler.h" />
|
||||
<ClInclude Include="..\..\src\Textures.h" />
|
||||
<ClInclude Include="..\..\src\Turbo3D.h" />
|
||||
|
|
|
@ -98,9 +98,6 @@
|
|||
<ClCompile Include="..\..\src\N64.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\OpenGL.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\RDP.CPP">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -164,18 +161,12 @@
|
|||
<ClCompile Include="..\..\src\mupenplus\MupenPlusAPIImpl.cpp">
|
||||
<Filter>Source Files\mupenplus</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\mupenplus\OpenGL_mupenplus.cpp">
|
||||
<Filter>Source Files\mupenplus</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\windows\CommonAPIImpl_windows.cpp">
|
||||
<Filter>Source Files\windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\windows\GLideN64_windows.cpp">
|
||||
<Filter>Source Files\windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\windows\OpenGL_windows.cpp">
|
||||
<Filter>Source Files\windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\windows\ZilmarAPIImpl_windows.cpp">
|
||||
<Filter>Source Files\windows</Filter>
|
||||
</ClCompile>
|
||||
|
@ -194,9 +185,6 @@
|
|||
<ClCompile Include="..\..\src\ZSort.cpp">
|
||||
<Filter>Source Files\uCodes</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\TextDrawer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\PostProcessor.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -206,9 +194,6 @@
|
|||
<ClCompile Include="..\..\src\Keys.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ShaderUtils.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\FrameBufferInfo.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -385,9 +370,6 @@
|
|||
<ClInclude Include="..\..\src\N64.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\OpenGL.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\RDP.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -460,18 +442,12 @@
|
|||
<ClInclude Include="..\..\src\GLideNHQ\Ext_TxFilter.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\TextDrawer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\PostProcessor.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\Keys.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ShaderUtils.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\wst.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
@ -38,7 +38,6 @@ set(GLideN64_SOURCES
|
|||
Log.cpp
|
||||
N64.cpp
|
||||
NoiseTexture.cpp
|
||||
OpenGL.cpp
|
||||
PaletteTexture.cpp
|
||||
Performance.cpp
|
||||
PostProcessor.cpp
|
||||
|
@ -46,9 +45,7 @@ set(GLideN64_SOURCES
|
|||
RSP.cpp
|
||||
S2DEX2.cpp
|
||||
S2DEX.cpp
|
||||
ShaderUtils.cpp
|
||||
SoftwareRender.cpp
|
||||
TextDrawerStub.cpp
|
||||
TextureFilterHandler.cpp
|
||||
Textures.cpp
|
||||
Turbo3D.cpp
|
||||
|
@ -69,6 +66,7 @@ set(GLideN64_SOURCES
|
|||
Graphics/OpenGLContext/opengl_CachedFunctions.cpp
|
||||
Graphics/OpenGLContext/opengl_ColorBufferReaderWithBufferStorage.cpp
|
||||
Graphics/OpenGLContext/opengl_ColorBufferReaderWithPixelBuffer.cpp
|
||||
Graphics/OpenGLContext/opengl_ColorBufferReaderWithEGLImage.cpp
|
||||
Graphics/OpenGLContext/opengl_ContextImpl.cpp
|
||||
Graphics/OpenGLContext/opengl_GLInfo.cpp
|
||||
Graphics/OpenGLContext/opengl_Parameters.cpp
|
||||
|
@ -119,11 +117,10 @@ if(MUPENPLUSAPI)
|
|||
mupenplus/Config_mupenplus.cpp
|
||||
mupenplus/CommonAPIImpl_mupenplus.cpp
|
||||
mupenplus/MupenPlusAPIImpl.cpp
|
||||
mupenplus/OpenGL_mupenplus.cpp
|
||||
Graphics/OpenGLContext/mupen64plus/mupen64plus_DisplayWindow.cpp
|
||||
)
|
||||
|
||||
set(GLideN64_SOURCES_WIN ${GLideN64_SOURCES_UNIX}
|
||||
common/GLFunctions.cpp
|
||||
)
|
||||
set(GLideN64_DLL_NAME mupen64plus-video-GLideN64)
|
||||
else(MUPENPLUSAPI)
|
||||
|
@ -136,8 +133,8 @@ else(MUPENPLUSAPI)
|
|||
windows/CommonAPIImpl_windows.cpp
|
||||
windows/GLideN64_windows.cpp
|
||||
common/GLFunctions.cpp
|
||||
windows/OpenGL_windows.cpp
|
||||
windows/ZilmarAPIImpl_windows.cpp
|
||||
Graphics/OpenGLContext/windows/windows_DisplayWindow.cpp
|
||||
)
|
||||
set(GLideN64_DLL_NAME GLideN64)
|
||||
endif(MUPENPLUSAPI)
|
||||
|
|
|
@ -910,7 +910,7 @@ bool texturedRectShadowMap(const GraphicsDrawer::TexturedRectParams &)
|
|||
return false;
|
||||
}
|
||||
|
||||
//u32 rectDepthBufferCopyFrame = 0xFFFFFFFF;
|
||||
u32 rectDepthBufferCopyFrame = 0xFFFFFFFF;
|
||||
static
|
||||
bool texturedRectDepthBufferCopy(const GraphicsDrawer::TexturedRectParams & _params)
|
||||
{
|
||||
|
|
2371
src/OpenGL.cpp
2371
src/OpenGL.cpp
File diff suppressed because it is too large
Load Diff
333
src/OpenGL.h
333
src/OpenGL.h
|
@ -1,333 +0,0 @@
|
|||
#ifndef OPENGL_H
|
||||
#define OPENGL_H
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#ifdef OS_WINDOWS
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include "winlnxdefs.h"
|
||||
#endif
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
#include <glsm/glsmsym.h>
|
||||
#include <GLideN64_libretro.h>
|
||||
#elif GLES2
|
||||
#include <GLES2/gl2.h>
|
||||
#include <GLES2/gl2ext.h>
|
||||
#define GL_DRAW_FRAMEBUFFER GL_FRAMEBUFFER
|
||||
#define GL_READ_FRAMEBUFFER GL_FRAMEBUFFER
|
||||
#define NO_BLIT_BUFFER_COPY
|
||||
#define GLESX
|
||||
#ifdef PANDORA
|
||||
typedef char GLchar;
|
||||
#endif
|
||||
#elif defined(GLES3)
|
||||
#include <GLES3/gl3.h>
|
||||
#define GLESX
|
||||
#elif defined(GLES3_1)
|
||||
#include <GLES3/gl31.h>
|
||||
#define GLESX
|
||||
#define GL_IMAGE_TEXTURES_SUPPORT
|
||||
#define GL_MULTISAMPLING_SUPPORT
|
||||
#elif defined(EGL)
|
||||
#include <GL/glcorearb.h>
|
||||
#include "common/GLFunctions.h"
|
||||
#include <GL/glext.h>
|
||||
#define GL_IMAGE_TEXTURES_SUPPORT
|
||||
#define GL_MULTISAMPLING_SUPPORT
|
||||
#else
|
||||
#if defined(OS_MAC_OS_X)
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <OpenGL/OpenGL.h>
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glext.h>
|
||||
#elif defined(OS_LINUX)
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
#define GL_IMAGE_TEXTURES_SUPPORT
|
||||
#define GL_MULTISAMPLING_SUPPORT
|
||||
#elif defined(OS_WINDOWS)
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
#include "common/GLFunctions.h"
|
||||
#define GL_IMAGE_TEXTURES_SUPPORT
|
||||
#define GL_MULTISAMPLING_SUPPORT
|
||||
//#define NO_BLIT_BUFFER_COPY
|
||||
#endif // OS_MAC_OS_X
|
||||
#endif // GLES2
|
||||
|
||||
#ifdef GLESX
|
||||
#define GET_PROGRAM_BINARY_EXTENSION "GL_OES_get_program_binary"
|
||||
#else
|
||||
#define GET_PROGRAM_BINARY_EXTENSION "GL_ARB_get_program_binary"
|
||||
#endif
|
||||
|
||||
#ifdef USE_SDL
|
||||
#include <SDL.h>
|
||||
#endif // USE_SDL
|
||||
|
||||
#ifndef GL_EXT_texture_filter_anisotropic
|
||||
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
||||
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
|
||||
#endif
|
||||
|
||||
#include "gSP.h"
|
||||
#include <Graphics/ShaderProgram.h>
|
||||
|
||||
#define VERTBUFF_SIZE 256U
|
||||
#define ELEMBUFF_SIZE 1024U
|
||||
|
||||
struct CachedTexture;
|
||||
class OGLRender
|
||||
{
|
||||
public:
|
||||
void addTriangle(int _v0, int _v1, int _v2);
|
||||
void drawTriangles();
|
||||
void drawScreenSpaceTriangle(u32 _numVtx);
|
||||
void drawDMATriangles(u32 _numVtx);
|
||||
void drawLine(int _v0, int _v1, float _width);
|
||||
void drawRect(int _ulx, int _uly, int _lrx, int _lry, float * _pColor);
|
||||
struct TexturedRectParams
|
||||
{
|
||||
float ulx, uly, lrx, lry;
|
||||
float uls, ult, lrs, lrt;
|
||||
float dsdx, dtdy;
|
||||
bool flip, forceAjustScale, texrectCmd;
|
||||
const FrameBuffer * pBuffer;
|
||||
TexturedRectParams(float _ulx, float _uly, float _lrx, float _lry,
|
||||
float _uls, float _ult, float _lrs, float _lrt,
|
||||
float _dsdx, float _dtdy,
|
||||
bool _flip, bool _forceAjustScale, bool _texrectCmd,
|
||||
const FrameBuffer * _pBuffer
|
||||
) :
|
||||
ulx(_ulx), uly(_uly), lrx(_lrx), lry(_lry),
|
||||
uls(_uls), ult(_ult), lrs(_lrs), lrt(_lrt),
|
||||
dsdx(_dsdx), dtdy(_dtdy),
|
||||
flip(_flip), forceAjustScale(_forceAjustScale), texrectCmd(_texrectCmd),
|
||||
pBuffer(_pBuffer)
|
||||
{}
|
||||
private:
|
||||
friend class OGLRender;
|
||||
TexturedRectParams() :
|
||||
ulx(0), uly(0), lrx(0), lry(0)
|
||||
{};
|
||||
};
|
||||
void correctTexturedRectParams(TexturedRectParams & _params);
|
||||
void drawTexturedRect(const TexturedRectParams & _params);
|
||||
void copyTexturedRect(GLint _srcX0, GLint _srcY0, GLint _srcX1, GLint _srcY1,
|
||||
GLuint _srcWidth, GLuint _srcHeight, GLuint _srcTex,
|
||||
GLint _dstX0, GLint _dstY0, GLint _dstX1, GLint _dstY1,
|
||||
GLuint _dstWidth, GLuint _dstHeight, GLenum _filter, GLuint _program = 0);
|
||||
void drawText(const char *_pText, float x, float y);
|
||||
void drawOSD();
|
||||
void clearDepthBuffer(u32 _ulx, u32 _uly, u32 _lrx, u32 _lry);
|
||||
void clearColorBuffer( float * _pColor );
|
||||
|
||||
int getTrianglesCount() const {return triangles.num;}
|
||||
bool isClipped(s32 _v0, s32 _v1, s32 _v2) const
|
||||
{
|
||||
return (triangles.vertices[_v0].clip & triangles.vertices[_v1].clip & triangles.vertices[_v2].clip) != 0;
|
||||
}
|
||||
bool isImageTexturesSupported() const {return m_bImageTexture;}
|
||||
SPVertex & getVertex(u32 _v) {return triangles.vertices[_v];}
|
||||
void setDMAVerticesSize(u32 _size) { if (m_dmaVertices.size() < _size) m_dmaVertices.resize(_size); }
|
||||
SPVertex * getDMAVerticesData() { return m_dmaVertices.data(); }
|
||||
void updateScissor(FrameBuffer * _pBuffer) const;
|
||||
void flush() { m_texrectDrawer.draw(); }
|
||||
|
||||
enum RENDER_STATE {
|
||||
rsNone = 0,
|
||||
rsLine = 1,
|
||||
rsTriangle = 2,
|
||||
rsRect = 3,
|
||||
rsTexRect = 4,
|
||||
};
|
||||
RENDER_STATE getRenderState() const {return m_renderState;}
|
||||
|
||||
enum OGL_RENDERER {
|
||||
glrOther,
|
||||
glrAdreno
|
||||
};
|
||||
OGL_RENDERER getRenderer() const { return m_oglRenderer; }
|
||||
|
||||
void dropRenderState() {m_renderState = rsNone;}
|
||||
|
||||
private:
|
||||
OGLRender()
|
||||
: m_oglRenderer(glrOther)
|
||||
, m_modifyVertices(0)
|
||||
, m_bImageTexture(false)
|
||||
, m_bFlatColors(false) {
|
||||
}
|
||||
OGLRender(const OGLRender &);
|
||||
friend class OGLVideo;
|
||||
|
||||
void _initExtensions();
|
||||
void _initStates();
|
||||
void _initData();
|
||||
void _destroyData();
|
||||
|
||||
void _setSpecialTexrect() const;
|
||||
|
||||
void _setColorArray() const;
|
||||
void _setTexCoordArrays() const;
|
||||
void _setBlendMode() const;
|
||||
void _legacySetBlendMode() const;
|
||||
void _updateCullFace() const;
|
||||
void _updateViewport() const;
|
||||
void _updateScreenCoordsViewport() const;
|
||||
void _updateDepthUpdate() const;
|
||||
void _updateDepthCompare() const;
|
||||
void _updateTextures(RENDER_STATE _renderState) const;
|
||||
void _updateStates(RENDER_STATE _renderState) const;
|
||||
void _prepareDrawTriangle(bool _dma);
|
||||
bool _canDraw() const;
|
||||
void _drawThickLine(int _v0, int _v1, float _width);
|
||||
|
||||
void _getTextSize(const char *_pText, float & _w, float & _h) const;
|
||||
void _drawOSD(const char *_pText, float _x, float & _y);
|
||||
|
||||
class TexrectDrawer
|
||||
{
|
||||
public:
|
||||
TexrectDrawer();
|
||||
void init();
|
||||
void destroy();
|
||||
void add();
|
||||
bool draw();
|
||||
bool isEmpty();
|
||||
private:
|
||||
u32 m_numRects;
|
||||
u64 m_otherMode;
|
||||
u64 m_mux;
|
||||
f32 m_ulx, m_lrx, m_uly, m_lry, m_Z;
|
||||
f32 m_max_lrx, m_max_lry;
|
||||
GLuint m_FBO;
|
||||
gDPScissor m_scissor;
|
||||
CachedTexture * m_pTexture;
|
||||
FrameBuffer * m_pBuffer;
|
||||
std::unique_ptr<graphics::TexDrawerShaderProgram> m_programDraw;
|
||||
std::unique_ptr<graphics::ShaderProgram> m_programClear;
|
||||
|
||||
struct RectCoords {
|
||||
f32 x, y;
|
||||
};
|
||||
std::vector<RectCoords> m_vecRectCoords;
|
||||
};
|
||||
|
||||
struct GLVertex
|
||||
{
|
||||
float x, y, z, w;
|
||||
float s0, t0, s1, t1;
|
||||
};
|
||||
|
||||
RENDER_STATE m_renderState;
|
||||
OGL_RENDERER m_oglRenderer;
|
||||
TexturedRectParams m_texrectParams;
|
||||
|
||||
struct {
|
||||
SPVertex vertices[VERTBUFF_SIZE];
|
||||
GLubyte elements[ELEMBUFF_SIZE];
|
||||
int num;
|
||||
} triangles;
|
||||
std::vector<SPVertex> m_dmaVertices;
|
||||
GLVertex m_rect[4];
|
||||
|
||||
u32 m_modifyVertices;
|
||||
GLfloat m_maxLineWidth;
|
||||
bool m_bImageTexture;
|
||||
bool m_bFlatColors;
|
||||
bool m_bDmaVertices;
|
||||
TexrectDrawer m_texrectDrawer;
|
||||
|
||||
GLuint m_programCopyTex;
|
||||
};
|
||||
|
||||
class OGLVideo
|
||||
{
|
||||
public:
|
||||
void start();
|
||||
void stop();
|
||||
void restart();
|
||||
void swapBuffers();
|
||||
void saveScreenshot();
|
||||
bool changeWindow();
|
||||
bool resizeWindow();
|
||||
void setWindowSize(u32 _width, u32 _height);
|
||||
void setCaptureScreen(const char * const _strDirectory);
|
||||
void setToggleFullscreen() {m_bToggleFullscreen = true;}
|
||||
void readScreen(void **_pDest, long *_pWidth, long *_pHeight );
|
||||
void readScreen2(void * _dest, int * _width, int * _height, int _front);
|
||||
|
||||
void updateScale();
|
||||
f32 getScaleX() const {return m_scaleX;}
|
||||
f32 getScaleY() const {return m_scaleY;}
|
||||
f32 getAdjustScale() const {return m_adjustScale;}
|
||||
u32 getBuffersSwapCount() const {return m_buffersSwapCount;}
|
||||
u32 getWidth() const { return m_width; }
|
||||
u32 getHeight() const {return m_height;}
|
||||
u32 getScreenWidth() const {return m_screenWidth;}
|
||||
u32 getScreenHeight() const {return m_screenHeight;}
|
||||
u32 getHeightOffset() const {return m_heightOffset;}
|
||||
bool isFullscreen() const {return m_bFullscreen;}
|
||||
bool isAdjustScreen() const {return m_bAdjustScreen;}
|
||||
bool isResizeWindow() const {return m_bResizeWindow;}
|
||||
|
||||
OGLRender & getRender() {return m_render;}
|
||||
|
||||
static OGLVideo & get();
|
||||
static bool isExtensionSupported(const char * extension);
|
||||
|
||||
protected:
|
||||
OGLVideo() :
|
||||
m_bCaptureScreen(false), m_bToggleFullscreen(false), m_bResizeWindow(false), m_bFullscreen(false), m_bAdjustScreen(false),
|
||||
m_buffersSwapCount(0), m_width(0), m_height(0), m_heightOffset(0),
|
||||
m_screenWidth(0), m_screenHeight(0), m_resizeWidth(0), m_resizeHeight(0),
|
||||
m_scaleX(0), m_scaleY(0), m_adjustScale(0)
|
||||
{}
|
||||
|
||||
void _setBufferSize();
|
||||
|
||||
bool m_bCaptureScreen;
|
||||
bool m_bToggleFullscreen;
|
||||
bool m_bResizeWindow;
|
||||
bool m_bFullscreen;
|
||||
bool m_bAdjustScreen;
|
||||
|
||||
u32 m_buffersSwapCount;
|
||||
u32 m_width, m_height, m_heightOffset;
|
||||
u32 m_screenWidth, m_screenHeight;
|
||||
u32 m_resizeWidth, m_resizeHeight;
|
||||
f32 m_scaleX, m_scaleY;
|
||||
f32 m_adjustScale;
|
||||
|
||||
wchar_t m_strScreenDirectory[PLUGIN_PATH_SIZE];
|
||||
|
||||
private:
|
||||
OGLRender m_render;
|
||||
|
||||
virtual bool _start() = 0;
|
||||
virtual void _stop() = 0;
|
||||
virtual void _swapBuffers() = 0;
|
||||
virtual void _saveScreenshot() = 0;
|
||||
virtual void _changeWindow() = 0;
|
||||
virtual bool _resizeWindow() = 0;
|
||||
};
|
||||
|
||||
inline
|
||||
OGLVideo & video()
|
||||
{
|
||||
return OGLVideo::get();
|
||||
}
|
||||
|
||||
//void initGLFunctions();
|
||||
bool checkFBO();
|
||||
bool isGLError();
|
||||
|
||||
#endif
|
|
@ -1,88 +0,0 @@
|
|||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include "ShaderUtils.h"
|
||||
#include "Config.h"
|
||||
#include "Log.h"
|
||||
|
||||
#ifdef VC
|
||||
#include "RaspberryPi/ShaderUtils_VC.h"
|
||||
#endif
|
||||
|
||||
static const GLsizei nShaderLogSize = 1024;
|
||||
bool checkShaderCompileStatus(GLuint obj)
|
||||
{
|
||||
GLint status;
|
||||
glGetShaderiv(obj, GL_COMPILE_STATUS, &status);
|
||||
if (status == GL_FALSE) {
|
||||
GLchar shader_log[nShaderLogSize];
|
||||
GLsizei nLogSize = nShaderLogSize;
|
||||
glGetShaderInfoLog(obj, nShaderLogSize, &nLogSize, shader_log);
|
||||
shader_log[nLogSize] = 0;
|
||||
LOG(LOG_ERROR, "shader_compile error: %s\n", shader_log);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool checkProgramLinkStatus(GLuint obj)
|
||||
{
|
||||
GLint status;
|
||||
glGetProgramiv(obj, GL_LINK_STATUS, &status);
|
||||
if (status == GL_FALSE) {
|
||||
GLsizei nLogSize = nShaderLogSize;
|
||||
GLchar shader_log[nShaderLogSize];
|
||||
glGetProgramInfoLog(obj, nShaderLogSize, &nLogSize, shader_log);
|
||||
LOG(LOG_ERROR, "shader_link error: %s\n", shader_log);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void logErrorShader(GLenum _shaderType, const std::string & _strShader)
|
||||
{
|
||||
LOG(LOG_ERROR, "Error in %s shader", _shaderType == GL_VERTEX_SHADER ? "vertex" : "fragment");
|
||||
|
||||
const int max = 800;
|
||||
int pos = 0;
|
||||
|
||||
while(pos < _strShader.length() ) {
|
||||
|
||||
if (_strShader.length() - pos < max) {
|
||||
LOG(LOG_ERROR, "%s", _strShader.substr(pos).data());
|
||||
} else {
|
||||
LOG(LOG_ERROR, "%s", _strShader.substr(pos, max).data());
|
||||
}
|
||||
pos += max;
|
||||
}
|
||||
}
|
||||
|
||||
GLuint createRectShaderProgram(const char * _strVertex, const char * _strFragment)
|
||||
{
|
||||
GLuint vertex_shader_object = glCreateShader(GL_VERTEX_SHADER);
|
||||
glShaderSource(vertex_shader_object, 1, &_strVertex, nullptr);
|
||||
glCompileShader(vertex_shader_object);
|
||||
assert(checkShaderCompileStatus(vertex_shader_object));
|
||||
|
||||
if (!checkShaderCompileStatus(vertex_shader_object))
|
||||
logErrorShader(GL_VERTEX_SHADER, _strVertex);
|
||||
|
||||
GLuint fragment_shader_object = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
glShaderSource(fragment_shader_object, 1, &_strFragment, nullptr);
|
||||
glCompileShader(fragment_shader_object);
|
||||
assert(checkShaderCompileStatus(fragment_shader_object));
|
||||
|
||||
if (!checkShaderCompileStatus(fragment_shader_object))
|
||||
logErrorShader(GL_VERTEX_SHADER, _strFragment);
|
||||
|
||||
GLuint program = glCreateProgram();
|
||||
glBindAttribLocation(program, SC_RECT_POSITION, "aRectPosition");
|
||||
glBindAttribLocation(program, SC_TEXCOORD0, "aTexCoord0");
|
||||
glBindAttribLocation(program, SC_TEXCOORD1, "aTexCoord1");
|
||||
glAttachShader(program, vertex_shader_object);
|
||||
glAttachShader(program, fragment_shader_object);
|
||||
glLinkProgram(program);
|
||||
glDeleteShader(vertex_shader_object);
|
||||
glDeleteShader(fragment_shader_object);
|
||||
assert(checkProgramLinkStatus(program));
|
||||
return program;
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
#ifndef SHADER_UTILS_H
|
||||
#define SHADER_UTILS_H
|
||||
|
||||
#include "OpenGL.h"
|
||||
#include "Combiner.h"
|
||||
|
||||
GLuint createRectShaderProgram(const char * _strVertex, const char * _strFragment);
|
||||
bool checkShaderCompileStatus(GLuint obj);
|
||||
bool checkProgramLinkStatus(GLuint obj);
|
||||
void logErrorShader(GLenum _shaderType, const std::string & _strShader);
|
||||
|
||||
#endif // SHADER_UTILS_H
|
|
@ -1,407 +0,0 @@
|
|||
/* Draw text on screen.
|
||||
* Requires freetype library.
|
||||
* Code is taken from "OpenGL source examples from the OpenGL Programming wikibook:
|
||||
* http://en.wikibooks.org/wiki/OpenGL_Programming"
|
||||
*/
|
||||
|
||||
#define NOMINMAX
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
#include <assert.h>
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
|
||||
#include "TextDrawer.h"
|
||||
#include "RSP.h"
|
||||
#include "Config.h"
|
||||
#include "ShaderUtils.h"
|
||||
#include "Log.h"
|
||||
|
||||
#include <Graphics/Context.h>
|
||||
#include <Graphics/Parameters.h>
|
||||
#include "DisplayWindow.h"
|
||||
|
||||
struct point {
|
||||
GLfloat x;
|
||||
GLfloat y;
|
||||
GLfloat s;
|
||||
GLfloat t;
|
||||
point() : x(0), y(0), s(0), t(0) {}
|
||||
point(GLfloat _x, GLfloat _y, GLfloat _s, GLfloat _t) : x(_x), y(_y), s(_s), t(_t) {}
|
||||
};
|
||||
|
||||
// Maximum texture width
|
||||
#define MAXWIDTH 1024
|
||||
|
||||
#if defined(GLES3_1)
|
||||
#define SHADER_VERSION "#version 310 es \n"
|
||||
#elif defined(GLES3)
|
||||
#define SHADER_VERSION "#version 300 es \n"
|
||||
#elif defined(GLES2)
|
||||
#define SHADER_VERSION "#version 100 \n"
|
||||
#else
|
||||
#define SHADER_VERSION "#version 330 core \n"
|
||||
#endif
|
||||
|
||||
#ifdef GLES2
|
||||
const GLenum monohromeformat = GL_LUMINANCE;
|
||||
const GLenum monohromeInternalformat = GL_LUMINANCE;
|
||||
#else
|
||||
const GLenum monohromeformat = GL_RED;
|
||||
const GLenum monohromeInternalformat = GL_R8;
|
||||
#endif // GLES2
|
||||
|
||||
static
|
||||
const char * strDrawTextVertexShader =
|
||||
SHADER_VERSION
|
||||
"#if (__VERSION__ > 120) \n"
|
||||
"# define IN in \n"
|
||||
"# define OUT out \n"
|
||||
"#else \n"
|
||||
"# define IN attribute \n"
|
||||
"# define OUT varying \n"
|
||||
"#endif // __VERSION \n"
|
||||
"IN highp vec4 aRectPosition; \n"
|
||||
"OUT mediump vec2 texpos; \n"
|
||||
"void main(void) { \n"
|
||||
" gl_Position = vec4(aRectPosition.xy, 0, 1); \n"
|
||||
" texpos = aRectPosition.zw; \n"
|
||||
"} \n"
|
||||
;
|
||||
|
||||
static
|
||||
const char * strDrawTextFragmentShader =
|
||||
SHADER_VERSION
|
||||
"#if (__VERSION__ > 120) \n"
|
||||
"# define IN in \n"
|
||||
"# define OUT out \n"
|
||||
"# define texture2D texture \n"
|
||||
"#else \n"
|
||||
"# define IN varying \n"
|
||||
"# define OUT \n"
|
||||
"#endif // __VERSION __ \n"
|
||||
"IN mediump vec2 texpos; \n"
|
||||
"uniform sampler2D uTex; \n"
|
||||
"uniform lowp vec4 uColor; \n"
|
||||
"OUT lowp vec4 fragColor; \n"
|
||||
"void main(void) { \n"
|
||||
" fragColor = texture2D(uTex, texpos).r * uColor; \n"
|
||||
#ifdef GLES2
|
||||
" gl_FragColor = fragColor; \n"
|
||||
#endif
|
||||
"} \n"
|
||||
;
|
||||
|
||||
/**
|
||||
* The atlas struct holds a texture that contains the visible US-ASCII characters
|
||||
* of a certain font rendered with a certain character height.
|
||||
* It also contains an array that contains all the information necessary to
|
||||
* generate the appropriate vertex and texture coordinates for each character.
|
||||
*
|
||||
* After the constructor is run, you don't need to use any FreeType functions anymore.
|
||||
*/
|
||||
struct Atlas {
|
||||
GLuint tex; // texture object
|
||||
|
||||
int w; // width of texture in pixels
|
||||
int h; // height of texture in pixels
|
||||
|
||||
struct {
|
||||
float ax; // advance.x
|
||||
float ay; // advance.y
|
||||
|
||||
float bw; // bitmap.width;
|
||||
float bh; // bitmap.height;
|
||||
|
||||
float bl; // bitmap_left;
|
||||
float bt; // bitmap_top;
|
||||
|
||||
float tx; // x offset of glyph in texture coordinates
|
||||
float ty; // y offset of glyph in texture coordinates
|
||||
} c[128]; // character information
|
||||
|
||||
Atlas(FT_Face face, int height) {
|
||||
FT_Set_Pixel_Sizes(face, 0, height);
|
||||
FT_GlyphSlot g = face->glyph;
|
||||
|
||||
int roww = 0;
|
||||
int rowh = 0;
|
||||
w = 0;
|
||||
h = 0;
|
||||
|
||||
memset(c, 0, sizeof c);
|
||||
|
||||
/* Find minimum size for a texture holding all visible ASCII characters */
|
||||
for (int i = 32; i < 128; i++) {
|
||||
if (FT_Load_Char(face, i, FT_LOAD_RENDER)) {
|
||||
fprintf(stderr, "Loading character %c failed!\n", i);
|
||||
continue;
|
||||
}
|
||||
if (roww + g->bitmap.width + 1 >= MAXWIDTH) {
|
||||
w = std::max(w, roww);
|
||||
h += rowh;
|
||||
roww = 0;
|
||||
rowh = 0;
|
||||
}
|
||||
roww += g->bitmap.width + 1;
|
||||
rowh = std::max(rowh, (int)g->bitmap.rows);
|
||||
}
|
||||
|
||||
w = std::max(w, roww);
|
||||
h += rowh;
|
||||
|
||||
/* Create a texture that will be used to hold all ASCII glyphs */
|
||||
|
||||
graphics::ObjectHandle texHandle = gfxContext.createTexture(graphics::target::TEXTURE_2D);
|
||||
tex = GLuint(texHandle);
|
||||
|
||||
graphics::Context::InitTextureParams initParams;
|
||||
initParams.handle = texHandle;
|
||||
initParams.width = w;
|
||||
initParams.height = h;
|
||||
initParams.internalFormat = monohromeInternalformat;
|
||||
initParams.format = monohromeformat;
|
||||
initParams.dataType = graphics::datatype::UNSIGNED_BYTE;
|
||||
gfxContext.init2DTexture(initParams);
|
||||
|
||||
/* We require 1 byte alignment when uploading texture data */
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
|
||||
graphics::Context::TexParameters setParams;
|
||||
setParams.handle = texHandle;
|
||||
setParams.target = graphics::target::TEXTURE_2D;
|
||||
setParams.minFilter = graphics::textureParameters::FILTER_LINEAR;
|
||||
setParams.magFilter = graphics::textureParameters::FILTER_LINEAR;
|
||||
setParams.wrapS = graphics::textureParameters::WRAP_CLAMP_TO_EDGE;
|
||||
setParams.wrapT = graphics::textureParameters::WRAP_CLAMP_TO_EDGE;
|
||||
gfxContext.setTextureParameters(setParams);
|
||||
|
||||
/* Paste all glyph bitmaps into the texture, remembering the offset */
|
||||
int ox = 0;
|
||||
int oy = 0;
|
||||
|
||||
rowh = 0;
|
||||
|
||||
for (int i = 32; i < 128; i++) {
|
||||
if (FT_Load_Char(face, i, FT_LOAD_RENDER)) {
|
||||
fprintf(stderr, "Loading character %c failed!\n", i);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ox + g->bitmap.width + 1 >= MAXWIDTH) {
|
||||
oy += rowh;
|
||||
rowh = 0;
|
||||
ox = 0;
|
||||
}
|
||||
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, ox, oy, g->bitmap.width, g->bitmap.rows, monohromeformat, GL_UNSIGNED_BYTE, g->bitmap.buffer);
|
||||
c[i].ax = _FIXED2FLOAT(g->advance.x, 6);
|
||||
c[i].ay = _FIXED2FLOAT(g->advance.y, 6);
|
||||
|
||||
c[i].bw = (float)g->bitmap.width;
|
||||
c[i].bh = (float)g->bitmap.rows;
|
||||
|
||||
c[i].bl = (float)g->bitmap_left;
|
||||
c[i].bt = (float)g->bitmap_top;
|
||||
|
||||
c[i].tx = ox / (float)w;
|
||||
c[i].ty = oy / (float)h;
|
||||
|
||||
rowh = std::max(rowh, (int)g->bitmap.rows);
|
||||
ox += g->bitmap.width + 1;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Generated a %d x %d (%d kb) texture atlas\n", w, h, w * h / 1024);
|
||||
}
|
||||
|
||||
~Atlas() {
|
||||
gfxContext.deleteTexture(graphics::ObjectHandle(tex));
|
||||
}
|
||||
};
|
||||
|
||||
TextDrawer::TextDrawer() :
|
||||
m_pAtlas(nullptr), m_program(0), m_uTex(0), m_uColor(0), m_vbo(0)
|
||||
{}
|
||||
|
||||
TextDrawer & TextDrawer::get() {
|
||||
static TextDrawer drawer;
|
||||
return drawer;
|
||||
}
|
||||
|
||||
static
|
||||
bool getFontFileName(char * _strName)
|
||||
{
|
||||
#ifdef OS_WINDOWS
|
||||
char * pSysPath = getenv("WINDIR");
|
||||
if (pSysPath == nullptr)
|
||||
return false;
|
||||
sprintf(_strName, "%s/Fonts/%s", pSysPath, config.font.name.c_str());
|
||||
#elif defined (ANDROID)
|
||||
sprintf(_strName, "/system/fonts/%s", config.font.name.c_str());
|
||||
#elif defined (PANDORA)
|
||||
sprintf(_strName, "/usr/share/fonts/truetype/%s", config.font.name.c_str());
|
||||
#else
|
||||
sprintf(_strName, "/usr/share/fonts/truetype/freefont/%s", config.font.name.c_str());
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
FT_Library ft;
|
||||
FT_Face face;
|
||||
|
||||
void TextDrawer::init()
|
||||
{
|
||||
if (m_pAtlas != nullptr)
|
||||
return;
|
||||
|
||||
char strBuffer[PLUGIN_PATH_SIZE];
|
||||
const char *fontfilename;
|
||||
if (getFontFileName(strBuffer))
|
||||
fontfilename = strBuffer;
|
||||
else
|
||||
return;
|
||||
|
||||
/* Initialize the FreeType2 library */
|
||||
if (FT_Init_FreeType(&ft)) {
|
||||
fprintf(stderr, "Could not init freetype library\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Load a font */
|
||||
if (FT_New_Face(ft, fontfilename, 0, &face)) {
|
||||
fprintf(stderr, "Could not open font %s\n", fontfilename);
|
||||
return;
|
||||
}
|
||||
|
||||
m_program = createRectShaderProgram(strDrawTextVertexShader, strDrawTextFragmentShader);
|
||||
if(m_program == 0)
|
||||
return;
|
||||
|
||||
m_uTex = glGetUniformLocation(m_program, "uTex");
|
||||
m_uColor = glGetUniformLocation(m_program, "uColor");
|
||||
|
||||
if(m_uTex == -1 || m_uColor == -1)
|
||||
return;
|
||||
|
||||
// Create the vertex buffer object
|
||||
glGenBuffers(1, &m_vbo);
|
||||
|
||||
/* Create texture atlas for selected font size */
|
||||
m_pAtlas = new Atlas(face, config.font.size);
|
||||
}
|
||||
|
||||
void TextDrawer::destroy()
|
||||
{
|
||||
if (m_pAtlas == nullptr)
|
||||
return;
|
||||
delete m_pAtlas;
|
||||
m_pAtlas = nullptr;
|
||||
glDeleteBuffers(1, &m_vbo);
|
||||
m_vbo = 0;
|
||||
glDeleteProgram(m_program);
|
||||
m_program = 0;
|
||||
FT_Done_Face(face);
|
||||
FT_Done_FreeType(ft);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render text using the currently loaded font and currently set font size.
|
||||
* Rendering starts at coordinates (x, y), z is always 0.
|
||||
* The pixel coordinates that the FreeType2 library uses are scaled by (sx, sy).
|
||||
*/
|
||||
void TextDrawer::renderText(const char *_pText, float _x, float _y) const
|
||||
{
|
||||
if (m_pAtlas == nullptr)
|
||||
return;
|
||||
DisplayWindow & wnd = dwnd();
|
||||
const float sx = 2.0f / wnd.getWidth();
|
||||
const float sy = 2.0f / wnd.getHeight();
|
||||
|
||||
const u8 *p;
|
||||
|
||||
glUseProgram(m_program);
|
||||
|
||||
/* Enable blending, necessary for our alpha texture */
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glDisable(GL_CULL_FACE);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDepthMask(GL_FALSE);
|
||||
|
||||
/* Set color */
|
||||
glUniform4fv(m_uColor, 1, config.font.colorf);
|
||||
|
||||
/* Use the texture containing the atlas */
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, m_pAtlas->tex);
|
||||
glUniform1i(m_uTex, 0);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
#ifndef GLES2
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
|
||||
#endif
|
||||
|
||||
/* Set up the VBO for our vertex data */
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_vbo);
|
||||
glVertexAttribPointer(SC_RECT_POSITION, 4, GL_FLOAT, GL_FALSE, 0, 0);
|
||||
|
||||
std::vector<point> coords(6 * strlen(_pText));
|
||||
int c = 0;
|
||||
|
||||
/* Loop through all characters */
|
||||
for (p = (const u8 *)_pText; *p; ++p) {
|
||||
/* Calculate the vertex and texture coordinates */
|
||||
float x2 = _x + m_pAtlas->c[*p].bl * sx;
|
||||
float y2 = -_y - m_pAtlas->c[*p].bt * sy;
|
||||
float w = m_pAtlas->c[*p].bw * sx;
|
||||
float h = m_pAtlas->c[*p].bh * sy;
|
||||
|
||||
/* Advance the cursor to the start of the next character */
|
||||
_x += m_pAtlas->c[*p].ax * sx;
|
||||
_y += m_pAtlas->c[*p].ay * sy;
|
||||
|
||||
/* Skip glyphs that have no pixels */
|
||||
if (!w || !h)
|
||||
continue;
|
||||
|
||||
coords[c++] = point(x2, -y2, m_pAtlas->c[*p].tx, m_pAtlas->c[*p].ty);
|
||||
coords[c++] = point(x2 + w, -y2, m_pAtlas->c[*p].tx + m_pAtlas->c[*p].bw / m_pAtlas->w, m_pAtlas->c[*p].ty);
|
||||
coords[c++] = point(x2, -y2 - h, m_pAtlas->c[*p].tx, m_pAtlas->c[*p].ty + m_pAtlas->c[*p].bh / m_pAtlas->h);
|
||||
coords[c++] = point(x2 + w, -y2, m_pAtlas->c[*p].tx + m_pAtlas->c[*p].bw / m_pAtlas->w, m_pAtlas->c[*p].ty);
|
||||
coords[c++] = point(x2, -y2 - h, m_pAtlas->c[*p].tx, m_pAtlas->c[*p].ty + m_pAtlas->c[*p].bh / m_pAtlas->h);
|
||||
coords[c++] = point(x2 + w, -y2 - h, m_pAtlas->c[*p].tx + m_pAtlas->c[*p].bw / m_pAtlas->w, m_pAtlas->c[*p].ty + m_pAtlas->c[*p].bh / m_pAtlas->h);
|
||||
}
|
||||
|
||||
/* Draw all the character on the screen in one go */
|
||||
glBufferData(GL_ARRAY_BUFFER, coords.size()*sizeof(point), coords.data(), GL_DYNAMIC_DRAW);
|
||||
glDrawArrays(GL_TRIANGLES, 0, c);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
void TextDrawer::getTextSize(const char *_pText, float & _w, float & _h) const
|
||||
{
|
||||
_w = _h = 0;
|
||||
if (m_pAtlas == nullptr)
|
||||
return;
|
||||
DisplayWindow & wnd = dwnd();
|
||||
const float sx = 2.0f / wnd.getWidth();
|
||||
const float sy = 2.0f / wnd.getHeight();
|
||||
float bw, bh;
|
||||
|
||||
for (const u8 *p = (const u8 *)_pText; *p; ++p) {
|
||||
bw = m_pAtlas->c[*p].bw * sx;
|
||||
bh = m_pAtlas->c[*p].bh * sy;
|
||||
|
||||
_w += m_pAtlas->c[*p].ax * sx;
|
||||
_h += m_pAtlas->c[*p].ay * sy;
|
||||
}
|
||||
_w += bw;
|
||||
_h += bh;
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
#ifndef TEXTDRAWER_H
|
||||
#define TEXTDRAWER_H
|
||||
#include "OpenGL.h"
|
||||
|
||||
class TextDrawer
|
||||
{
|
||||
void init();
|
||||
void destroy();
|
||||
void renderText(const char *_pText, float x, float y) const;
|
||||
void getTextSize(const char *_pText, float & _w, float & _h) const;
|
||||
static TextDrawer & get();
|
||||
|
||||
private:
|
||||
TextDrawer();
|
||||
TextDrawer(const TextDrawer &);
|
||||
friend class OGLRender;
|
||||
struct Atlas * m_pAtlas;
|
||||
GLuint m_program;
|
||||
GLint m_uTex;
|
||||
GLint m_uColor;
|
||||
GLuint m_vbo;
|
||||
};
|
||||
|
||||
#endif // TEXTDRAWER_H
|
|
@ -1,12 +0,0 @@
|
|||
#include "TextDrawer.h"
|
||||
|
||||
TextDrawer::TextDrawer() {}
|
||||
void TextDrawer::init() {}
|
||||
void TextDrawer::destroy() {}
|
||||
void TextDrawer::renderText(const char * /*_pText*/, float /*x*/, float /*y*/) const {}
|
||||
void TextDrawer::getTextSize(const char *_pText, float & _w, float & _h) const {}
|
||||
TextDrawer & TextDrawer::get() {
|
||||
static TextDrawer drawer;
|
||||
return drawer;
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#include "GLideN64_mupenplus.h"
|
||||
#include <algorithm>
|
||||
#include <Platform.h>
|
||||
#include "../PluginAPI.h"
|
||||
#include "../OpenGL.h"
|
||||
#include "../RSP.h"
|
||||
|
||||
int PluginAPI::InitiateGFX(const GFX_INFO & _gfxInfo)
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
#include "../Config.h"
|
||||
#include "../GLideN64.h"
|
||||
#include "../OpenGL.h"
|
||||
#include "../GBI.h"
|
||||
#include "../RSP.h"
|
||||
#include "../Log.h"
|
||||
|
|
|
@ -1,187 +0,0 @@
|
|||
#include "GLideN64_mupenplus.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../GLideN64.h"
|
||||
#include "../OpenGL.h"
|
||||
#include "../gDP.h"
|
||||
#include "../Config.h"
|
||||
#include "../Revision.h"
|
||||
#include "../Log.h"
|
||||
|
||||
#ifdef VC
|
||||
#include <bcm_host.h>
|
||||
#endif
|
||||
|
||||
#ifndef EGL
|
||||
#if !defined(OS_WINDOWS) || defined(GLESX)
|
||||
|
||||
static
|
||||
void initGLFunctions()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
class OGLVideoMupenPlus : public OGLVideo
|
||||
{
|
||||
public:
|
||||
OGLVideoMupenPlus() {}
|
||||
|
||||
private:
|
||||
void _setAttributes();
|
||||
void _getDisplaySize();
|
||||
|
||||
virtual bool _start();
|
||||
virtual void _stop();
|
||||
virtual void _swapBuffers();
|
||||
virtual void _saveScreenshot();
|
||||
virtual bool _resizeWindow();
|
||||
virtual void _changeWindow();
|
||||
};
|
||||
|
||||
OGLVideo & OGLVideo::get()
|
||||
{
|
||||
static OGLVideoMupenPlus video;
|
||||
return video;
|
||||
}
|
||||
|
||||
void OGLVideoMupenPlus::_setAttributes()
|
||||
{
|
||||
|
||||
#ifdef GLES2
|
||||
CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_MAJOR_VERSION, 2);
|
||||
CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_MINOR_VERSION, 0);
|
||||
LOG(LOG_VERBOSE, "[gles2GlideN64]: _setAttributes\n");
|
||||
#elif defined(GLES3)
|
||||
CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_MAJOR_VERSION, 3);
|
||||
CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_MINOR_VERSION, 0);
|
||||
#elif defined(GLES3_1)
|
||||
CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_MAJOR_VERSION, 3);
|
||||
CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_MINOR_VERSION, 1);
|
||||
#elif defined(OS_MAC_OS_X)
|
||||
CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_MAJOR_VERSION, 3);
|
||||
CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_MINOR_VERSION, 2);
|
||||
#else
|
||||
// Do nothing
|
||||
#endif
|
||||
|
||||
#ifndef GLES2
|
||||
CoreVideo_GL_SetAttribute(M64P_GL_RED_SIZE, 8);
|
||||
CoreVideo_GL_SetAttribute(M64P_GL_GREEN_SIZE, 8);
|
||||
CoreVideo_GL_SetAttribute(M64P_GL_BLUE_SIZE, 8);
|
||||
CoreVideo_GL_SetAttribute(M64P_GL_ALPHA_SIZE, 8);
|
||||
#endif
|
||||
|
||||
CoreVideo_GL_SetAttribute(M64P_GL_DOUBLEBUFFER, 1);
|
||||
CoreVideo_GL_SetAttribute(M64P_GL_SWAP_CONTROL, config.video.verticalSync);
|
||||
CoreVideo_GL_SetAttribute(M64P_GL_BUFFER_SIZE, 32);
|
||||
CoreVideo_GL_SetAttribute(M64P_GL_DEPTH_SIZE, 16);
|
||||
if (config.video.multisampling > 0 && config.frameBufferEmulation.enable == 0) {
|
||||
CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLEBUFFERS, 1);
|
||||
if (config.video.multisampling <= 2)
|
||||
CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLESAMPLES, 2);
|
||||
else if (config.video.multisampling <= 4)
|
||||
CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLESAMPLES, 4);
|
||||
else if (config.video.multisampling <= 8)
|
||||
CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLESAMPLES, 8);
|
||||
else
|
||||
CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLESAMPLES, 16);
|
||||
}
|
||||
}
|
||||
|
||||
bool OGLVideoMupenPlus::_start()
|
||||
{
|
||||
CoreVideo_Init();
|
||||
_setAttributes();
|
||||
|
||||
m_bFullscreen = config.video.fullscreen > 0;
|
||||
m_screenWidth = config.video.windowedWidth;
|
||||
m_screenHeight = config.video.windowedHeight;
|
||||
_getDisplaySize();
|
||||
_setBufferSize();
|
||||
|
||||
printf("(II) Setting video mode %dx%d...\n", m_screenWidth, m_screenHeight);
|
||||
const m64p_video_flags flags = M64VIDEOFLAG_SUPPORT_RESIZING;
|
||||
if (CoreVideo_SetVideoMode(m_screenWidth, m_screenHeight, 0, m_bFullscreen ? M64VIDEO_FULLSCREEN : M64VIDEO_WINDOWED, flags) != M64ERR_SUCCESS) {
|
||||
//printf("(EE) Error setting videomode %dx%d\n", m_screenWidth, m_screenHeight);
|
||||
LOG(LOG_ERROR, "[gles2GlideN64]: Error setting videomode %dx%d\n", m_screenWidth, m_screenHeight);
|
||||
CoreVideo_Quit();
|
||||
return false;
|
||||
}
|
||||
LOG(LOG_VERBOSE, "[gles2GlideN64]: Create setting videomode %dx%d\n", m_screenWidth, m_screenHeight);
|
||||
|
||||
char caption[128];
|
||||
# ifdef _DEBUG
|
||||
sprintf(caption, "%s debug. Revision %s", pluginName, PLUGIN_REVISION);
|
||||
# else // _DEBUG
|
||||
sprintf(caption, "%s. Revision %s", pluginName, PLUGIN_REVISION);
|
||||
# endif // _DEBUG
|
||||
CoreVideo_SetCaption(caption);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void OGLVideoMupenPlus::_stop()
|
||||
{
|
||||
CoreVideo_Quit();
|
||||
}
|
||||
|
||||
void OGLVideoMupenPlus::_swapBuffers()
|
||||
{
|
||||
// if emulator defined a render callback function, call it before buffer swap
|
||||
if (renderCallback != nullptr) {
|
||||
glUseProgram(0);
|
||||
if (config.frameBufferEmulation.N64DepthCompare == 0) {
|
||||
glViewport(0, getHeightOffset(), getScreenWidth(), getScreenHeight());
|
||||
gSP.changed |= CHANGED_VIEWPORT;
|
||||
}
|
||||
gDP.changed |= CHANGED_COMBINE;
|
||||
(*renderCallback)((gDP.changed&CHANGED_CPU_FB_WRITE) == 0 ? 1 : 0);
|
||||
}
|
||||
CoreVideo_GL_SwapBuffers();
|
||||
}
|
||||
|
||||
void OGLVideoMupenPlus::_saveScreenshot()
|
||||
{
|
||||
}
|
||||
|
||||
bool OGLVideoMupenPlus::_resizeWindow()
|
||||
{
|
||||
_setAttributes();
|
||||
|
||||
m_bFullscreen = false;
|
||||
m_width = m_screenWidth = m_resizeWidth;
|
||||
m_height = m_screenHeight = m_resizeHeight;
|
||||
if (CoreVideo_ResizeWindow(m_screenWidth, m_screenHeight) != M64ERR_SUCCESS) {
|
||||
printf("(EE) Error setting videomode %dx%d\n", m_screenWidth, m_screenHeight);
|
||||
m_width = m_screenWidth = config.video.windowedWidth;
|
||||
m_height = m_screenHeight = config.video.windowedHeight;
|
||||
CoreVideo_Quit();
|
||||
return false;
|
||||
}
|
||||
_setBufferSize();
|
||||
isGLError(); // reset GL error.
|
||||
return true;
|
||||
}
|
||||
|
||||
void OGLVideoMupenPlus::_changeWindow()
|
||||
{
|
||||
CoreVideo_ToggleFullScreen();
|
||||
}
|
||||
|
||||
void OGLVideoMupenPlus::_getDisplaySize()
|
||||
{
|
||||
#ifdef VC
|
||||
if( m_bFullscreen ) {
|
||||
// Use VC get_display_size function to get the current screen resolution
|
||||
u32 fb_width;
|
||||
u32 fb_height;
|
||||
if (graphics_get_display_size(0 /* LCD */, &fb_width, &fb_height) < 0)
|
||||
printf("ERROR: Failed to get display size\n");
|
||||
else {
|
||||
m_screenWidth = fb_width;
|
||||
m_screenHeight = fb_height;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
|
@ -2,7 +2,6 @@
|
|||
#include "GLideN64_Windows.h"
|
||||
#include <commctrl.h>
|
||||
#include "../PluginAPI.h"
|
||||
#include "../OpenGL.h"
|
||||
#include "../RSP.h"
|
||||
|
||||
#ifdef OS_WINDOWS
|
||||
|
|
|
@ -1,239 +0,0 @@
|
|||
#include "GLideN64_Windows.h"
|
||||
#include <stdio.h>
|
||||
#include "../GLideN64.h"
|
||||
#include "../Config.h"
|
||||
#include "../OpenGL.h"
|
||||
#include "../N64.h"
|
||||
#include "../RSP.h"
|
||||
#include "../FrameBuffer.h"
|
||||
#include "../GLideNUI/GLideNUI.h"
|
||||
|
||||
class OGLVideoWindows : public OGLVideo
|
||||
{
|
||||
public:
|
||||
OGLVideoWindows() : hRC(NULL), hDC(NULL) {}
|
||||
|
||||
private:
|
||||
virtual bool _start();
|
||||
virtual void _stop();
|
||||
virtual void _swapBuffers();
|
||||
virtual void _saveScreenshot();
|
||||
virtual bool _resizeWindow();
|
||||
virtual void _changeWindow();
|
||||
|
||||
HGLRC hRC;
|
||||
HDC hDC;
|
||||
};
|
||||
|
||||
OGLVideo & OGLVideo::get()
|
||||
{
|
||||
static OGLVideoWindows video;
|
||||
return video;
|
||||
}
|
||||
|
||||
bool OGLVideoWindows::_start()
|
||||
{
|
||||
int pixelFormat;
|
||||
|
||||
PIXELFORMATDESCRIPTOR pfd = {
|
||||
sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd
|
||||
1, // version number
|
||||
PFD_DRAW_TO_WINDOW | // support window
|
||||
PFD_SUPPORT_OPENGL | // support OpenGL
|
||||
PFD_DOUBLEBUFFER, // double buffered
|
||||
PFD_TYPE_RGBA, // RGBA type
|
||||
32, // color depth
|
||||
0, 0, 0, 0, 0, 0, // color bits ignored
|
||||
0, // no alpha buffer
|
||||
0, // shift bit ignored
|
||||
0, // no accumulation buffer
|
||||
0, 0, 0, 0, // accum bits ignored
|
||||
32, // z-buffer
|
||||
0, // no stencil buffer
|
||||
0, // no auxiliary buffer
|
||||
PFD_MAIN_PLANE, // main layer
|
||||
0, // reserved
|
||||
0, 0, 0 // layer masks ignored
|
||||
};
|
||||
|
||||
if (hWnd == NULL)
|
||||
hWnd = GetActiveWindow();
|
||||
|
||||
if ((hDC = GetDC( hWnd )) == NULL) {
|
||||
MessageBox( hWnd, L"Error while getting a device context!", pluginNameW, MB_ICONERROR | MB_OK );
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((pixelFormat = ChoosePixelFormat(hDC, &pfd )) == 0) {
|
||||
MessageBox( hWnd, L"Unable to find a suitable pixel format!", pluginNameW, MB_ICONERROR | MB_OK );
|
||||
_stop();
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((SetPixelFormat(hDC, pixelFormat, &pfd )) == FALSE) {
|
||||
MessageBox( hWnd, L"Error while setting pixel format!", pluginNameW, MB_ICONERROR | MB_OK );
|
||||
_stop();
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((hRC = wglCreateContext(hDC)) == NULL) {
|
||||
MessageBox( hWnd, L"Error while creating OpenGL context!", pluginNameW, MB_ICONERROR | MB_OK );
|
||||
_stop();
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((wglMakeCurrent(hDC, hRC)) == FALSE) {
|
||||
MessageBox( hWnd, L"Error while making OpenGL context current!", pluginNameW, MB_ICONERROR | MB_OK );
|
||||
_stop();
|
||||
return false;
|
||||
}
|
||||
|
||||
return _resizeWindow();
|
||||
}
|
||||
|
||||
void OGLVideoWindows::_stop()
|
||||
{
|
||||
wglMakeCurrent( NULL, NULL );
|
||||
|
||||
if (hRC != NULL) {
|
||||
wglDeleteContext(hRC);
|
||||
hRC = NULL;
|
||||
}
|
||||
|
||||
if (hDC != NULL) {
|
||||
ReleaseDC(hWnd, hDC);
|
||||
hDC = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void OGLVideoWindows::_swapBuffers()
|
||||
{
|
||||
if (hDC == NULL)
|
||||
SwapBuffers( wglGetCurrentDC() );
|
||||
else
|
||||
SwapBuffers( hDC );
|
||||
}
|
||||
|
||||
void OGLVideoWindows::_saveScreenshot()
|
||||
{
|
||||
unsigned char * pixelData = NULL;
|
||||
FrameBuffer * pBuffer = frameBufferList().findBuffer(*REG.VI_ORIGIN);
|
||||
if (pBuffer == nullptr) {
|
||||
GLint oldMode;
|
||||
glGetIntegerv(GL_READ_BUFFER, &oldMode);
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
||||
glReadBuffer(GL_FRONT);
|
||||
pixelData = (unsigned char*)malloc(m_screenWidth * m_screenHeight * 3);
|
||||
glReadPixels(0, m_heightOffset, m_screenWidth, m_screenHeight, GL_RGB, GL_UNSIGNED_BYTE, pixelData);
|
||||
glReadBuffer(oldMode);
|
||||
SaveScreenshot(m_strScreenDirectory, RSP.romname, m_screenWidth, m_screenHeight, pixelData);
|
||||
}
|
||||
else {
|
||||
if (config.video.multisampling != 0) {
|
||||
pBuffer->resolveMultisampledTexture();
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, GLuint(pBuffer->m_resolveFBO));
|
||||
} else
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, GLuint(pBuffer->m_FBO));
|
||||
pixelData = (unsigned char*)malloc(pBuffer->m_pTexture->realWidth * pBuffer->m_pTexture->realHeight * 3);
|
||||
glReadPixels(0, 0, pBuffer->m_pTexture->realWidth, pBuffer->m_pTexture->realHeight, GL_RGB, GL_UNSIGNED_BYTE, pixelData);
|
||||
SaveScreenshot(m_strScreenDirectory, RSP.romname, pBuffer->m_pTexture->realWidth, pBuffer->m_pTexture->realHeight, pixelData);
|
||||
}
|
||||
free( pixelData );
|
||||
}
|
||||
|
||||
void OGLVideoWindows::_changeWindow()
|
||||
{
|
||||
static LONG windowedStyle;
|
||||
static LONG windowedExStyle;
|
||||
static RECT windowedRect;
|
||||
static HMENU windowedMenu;
|
||||
|
||||
if (!m_bFullscreen) {
|
||||
DEVMODE fullscreenMode;
|
||||
memset( &fullscreenMode, 0, sizeof(DEVMODE) );
|
||||
fullscreenMode.dmSize = sizeof(DEVMODE);
|
||||
fullscreenMode.dmPelsWidth = config.video.fullscreenWidth;
|
||||
fullscreenMode.dmPelsHeight = config.video.fullscreenHeight;
|
||||
fullscreenMode.dmBitsPerPel = 32;
|
||||
fullscreenMode.dmDisplayFrequency = config.video.fullscreenRefresh;
|
||||
fullscreenMode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY;
|
||||
|
||||
if (ChangeDisplaySettings( &fullscreenMode, CDS_FULLSCREEN ) != DISP_CHANGE_SUCCESSFUL) {
|
||||
MessageBox( NULL, L"Failed to change display mode", pluginNameW, MB_ICONERROR | MB_OK );
|
||||
return;
|
||||
}
|
||||
|
||||
ShowCursor( FALSE );
|
||||
|
||||
windowedMenu = GetMenu( hWnd );
|
||||
|
||||
if (windowedMenu)
|
||||
SetMenu( hWnd, NULL );
|
||||
|
||||
if (hStatusBar)
|
||||
ShowWindow( hStatusBar, SW_HIDE );
|
||||
|
||||
windowedExStyle = GetWindowLong( hWnd, GWL_EXSTYLE );
|
||||
windowedStyle = GetWindowLong( hWnd, GWL_STYLE );
|
||||
|
||||
SetWindowLong( hWnd, GWL_EXSTYLE, WS_EX_APPWINDOW | WS_EX_TOPMOST );
|
||||
SetWindowLong( hWnd, GWL_STYLE, WS_POPUP );
|
||||
|
||||
GetWindowRect( hWnd, &windowedRect );
|
||||
|
||||
m_bFullscreen = true;
|
||||
_resizeWindow();
|
||||
} else {
|
||||
ChangeDisplaySettings( NULL, 0 );
|
||||
|
||||
ShowCursor( TRUE );
|
||||
|
||||
if (windowedMenu)
|
||||
SetMenu( hWnd, windowedMenu );
|
||||
|
||||
if (hStatusBar)
|
||||
ShowWindow( hStatusBar, SW_SHOW );
|
||||
|
||||
SetWindowLong( hWnd, GWL_STYLE, windowedStyle );
|
||||
SetWindowLong( hWnd, GWL_EXSTYLE, windowedExStyle );
|
||||
SetWindowPos( hWnd, NULL, windowedRect.left, windowedRect.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE );
|
||||
|
||||
m_bFullscreen = false;
|
||||
_resizeWindow();
|
||||
}
|
||||
}
|
||||
|
||||
bool OGLVideoWindows::_resizeWindow()
|
||||
{
|
||||
RECT windowRect, statusRect, toolRect;
|
||||
|
||||
if (m_bFullscreen) {
|
||||
m_screenWidth = config.video.fullscreenWidth;
|
||||
m_screenHeight = config.video.fullscreenHeight;
|
||||
m_heightOffset = 0;
|
||||
_setBufferSize();
|
||||
|
||||
return (SetWindowPos(hWnd, NULL, 0, 0, m_screenWidth, m_screenHeight, SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW) == TRUE);
|
||||
} else {
|
||||
m_screenWidth = m_width = config.video.windowedWidth;
|
||||
m_screenHeight = config.video.windowedHeight;
|
||||
_setBufferSize();
|
||||
|
||||
GetClientRect( hWnd, &windowRect );
|
||||
GetWindowRect( hStatusBar, &statusRect );
|
||||
|
||||
if (hToolBar)
|
||||
GetWindowRect( hToolBar, &toolRect );
|
||||
else
|
||||
toolRect.bottom = toolRect.top = 0;
|
||||
|
||||
m_heightOffset = (statusRect.bottom - statusRect.top);
|
||||
windowRect.right = windowRect.left + config.video.windowedWidth - 1;
|
||||
windowRect.bottom = windowRect.top + config.video.windowedHeight - 1 + m_heightOffset;
|
||||
|
||||
AdjustWindowRect( &windowRect, GetWindowLong( hWnd, GWL_STYLE ), GetMenu( hWnd ) != NULL );
|
||||
|
||||
return (SetWindowPos( hWnd, NULL, 0, 0, windowRect.right - windowRect.left + 1,
|
||||
windowRect.bottom - windowRect.top + 1 + toolRect.bottom - toolRect.top + 1, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE ) == TRUE);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user