mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Remove GL includes from headers
This commit is contained in:
parent
ecc5a7af81
commit
e05abbaa91
|
@ -1702,6 +1702,7 @@ if(CLIENT)
|
|||
friends.h
|
||||
ghost.cpp
|
||||
ghost.h
|
||||
graphics_defines.h
|
||||
graphics_threaded.cpp
|
||||
graphics_threaded.h
|
||||
http.cpp
|
||||
|
|
|
@ -23,6 +23,16 @@
|
|||
#include <engine/shared/image_manipulation.h>
|
||||
|
||||
// ------------ CCommandProcessorFragment_OpenGL
|
||||
void CCommandProcessorFragment_OpenGL::Cmd_Update_Viewport(const CCommandBuffer::SCommand_Update_Viewport *pCommand)
|
||||
{
|
||||
glViewport(pCommand->m_X, pCommand->m_Y, pCommand->m_Width, pCommand->m_Height);
|
||||
}
|
||||
|
||||
void CCommandProcessorFragment_OpenGL::Cmd_Finish(const CCommandBuffer::SCommand_Finish *pCommand)
|
||||
{
|
||||
glFinish();
|
||||
}
|
||||
|
||||
bool CCommandProcessorFragment_OpenGL::Texture2DTo3D(void *pImageBuffer, int ImageWidth, int ImageHeight, int ImageColorChannelCount, int SplitCountWidth, int SplitCountHeight, void *pTarget3DImageData, int &Target3DImageWidth, int &Target3DImageHeight)
|
||||
{
|
||||
Target3DImageWidth = ImageWidth / SplitCountWidth;
|
||||
|
@ -1038,6 +1048,12 @@ bool CCommandProcessorFragment_OpenGL::RunCommand(const CCommandBuffer::SCommand
|
|||
case CCommandBuffer::CMD_SCREENSHOT:
|
||||
Cmd_Screenshot(static_cast<const CCommandBuffer::SCommand_Screenshot *>(pBaseCommand));
|
||||
break;
|
||||
case CCommandBuffer::CMD_UPDATE_VIEWPORT:
|
||||
Cmd_Update_Viewport(static_cast<const CCommandBuffer::SCommand_Update_Viewport *>(pBaseCommand));
|
||||
break;
|
||||
case CCommandBuffer::CMD_FINISH:
|
||||
Cmd_Finish(static_cast<const CCommandBuffer::SCommand_Finish *>(pBaseCommand));
|
||||
break;
|
||||
|
||||
case CCommandBuffer::CMD_CREATE_BUFFER_OBJECT: Cmd_CreateBufferObject(static_cast<const CCommandBuffer::SCommand_CreateBufferObject *>(pBaseCommand)); break;
|
||||
case CCommandBuffer::CMD_UPDATE_BUFFER_OBJECT: Cmd_UpdateBufferObject(static_cast<const CCommandBuffer::SCommand_UpdateBufferObject *>(pBaseCommand)); break;
|
||||
|
|
|
@ -8,9 +8,6 @@
|
|||
|
||||
#ifndef CONF_BACKEND_OPENGL_ES
|
||||
#include <GL/glew.h>
|
||||
#else
|
||||
#define GL_GLEXT_PROTOTYPES 1
|
||||
#include "SDL_opengles2.h"
|
||||
#endif
|
||||
|
||||
#include <engine/storage.h>
|
||||
|
@ -166,11 +163,6 @@ void CCommandProcessorFragment_SDL::Cmd_Init(const SCommand_Init *pCommand)
|
|||
SDL_GL_MakeCurrent(m_pWindow, m_GLContext);
|
||||
}
|
||||
|
||||
void CCommandProcessorFragment_SDL::Cmd_Update_Viewport(const SCommand_Update_Viewport *pCommand)
|
||||
{
|
||||
glViewport(pCommand->m_X, pCommand->m_Y, pCommand->m_Width, pCommand->m_Height);
|
||||
}
|
||||
|
||||
void CCommandProcessorFragment_SDL::Cmd_Shutdown(const SCommand_Shutdown *pCommand)
|
||||
{
|
||||
SDL_GL_MakeCurrent(NULL, NULL);
|
||||
|
@ -179,9 +171,6 @@ void CCommandProcessorFragment_SDL::Cmd_Shutdown(const SCommand_Shutdown *pComma
|
|||
void CCommandProcessorFragment_SDL::Cmd_Swap(const CCommandBuffer::SCommand_Swap *pCommand)
|
||||
{
|
||||
SDL_GL_SwapWindow(m_pWindow);
|
||||
|
||||
if(pCommand->m_Finish)
|
||||
glFinish();
|
||||
}
|
||||
|
||||
void CCommandProcessorFragment_SDL::Cmd_VSync(const CCommandBuffer::SCommand_VSync *pCommand)
|
||||
|
@ -189,11 +178,6 @@ void CCommandProcessorFragment_SDL::Cmd_VSync(const CCommandBuffer::SCommand_VSy
|
|||
*pCommand->m_pRetOk = SDL_GL_SetSwapInterval(pCommand->m_VSync) == 0;
|
||||
}
|
||||
|
||||
void CCommandProcessorFragment_SDL::Cmd_Resize(const CCommandBuffer::SCommand_Resize *pCommand)
|
||||
{
|
||||
glViewport(0, 0, pCommand->m_Width, pCommand->m_Height);
|
||||
}
|
||||
|
||||
void CCommandProcessorFragment_SDL::Cmd_VideoModes(const CCommandBuffer::SCommand_VideoModes *pCommand)
|
||||
{
|
||||
SDL_DisplayMode mode;
|
||||
|
@ -240,11 +224,9 @@ bool CCommandProcessorFragment_SDL::RunCommand(const CCommandBuffer::SCommand *p
|
|||
{
|
||||
case CCommandBuffer::CMD_SWAP: Cmd_Swap(static_cast<const CCommandBuffer::SCommand_Swap *>(pBaseCommand)); break;
|
||||
case CCommandBuffer::CMD_VSYNC: Cmd_VSync(static_cast<const CCommandBuffer::SCommand_VSync *>(pBaseCommand)); break;
|
||||
case CCommandBuffer::CMD_RESIZE: Cmd_Resize(static_cast<const CCommandBuffer::SCommand_Resize *>(pBaseCommand)); break;
|
||||
case CCommandBuffer::CMD_VIDEOMODES: Cmd_VideoModes(static_cast<const CCommandBuffer::SCommand_VideoModes *>(pBaseCommand)); break;
|
||||
case CMD_INIT: Cmd_Init(static_cast<const SCommand_Init *>(pBaseCommand)); break;
|
||||
case CMD_SHUTDOWN: Cmd_Shutdown(static_cast<const SCommand_Shutdown *>(pBaseCommand)); break;
|
||||
case CMD_UPDATE_VIEWPORT: Cmd_Update_Viewport(static_cast<const SCommand_Update_Viewport *>(pBaseCommand)); break;
|
||||
default: return false;
|
||||
}
|
||||
|
||||
|
@ -923,7 +905,7 @@ int CGraphicsBackend_SDL_OpenGL::Init(const char *pName, int *Screen, int *pWidt
|
|||
//TODO: current problem is, that the opengl driver knows about the scaled display,
|
||||
//so the viewport cannot be adjusted for resolutions, that are higher than allowed by the display driver
|
||||
|
||||
CCommandProcessorFragment_SDL::SCommand_Update_Viewport CmdSDL;
|
||||
CCommandBuffer::SCommand_Update_Viewport CmdSDL;
|
||||
CmdSDL.m_X = 0;
|
||||
CmdSDL.m_Y = 0;
|
||||
|
||||
|
|
|
@ -5,13 +5,7 @@
|
|||
|
||||
#include <base/detect.h>
|
||||
|
||||
#ifndef CONF_BACKEND_OPENGL_ES
|
||||
#include <GL/glew.h>
|
||||
#else
|
||||
#define GL_GLEXT_PROTOTYPES 1
|
||||
#include "SDL_opengles2.h"
|
||||
#include <GLES3/gl3.h>
|
||||
#endif
|
||||
#include "graphics_defines.h"
|
||||
|
||||
#ifdef CONF_BACKEND_OPENGL_ES3
|
||||
#define BACKEND_GL_MODERN_API 1
|
||||
|
@ -137,10 +131,10 @@ protected:
|
|||
{
|
||||
}
|
||||
|
||||
GLuint m_Tex;
|
||||
GLuint m_Tex2DArray; //or 3D texture as fallback
|
||||
GLuint m_Sampler;
|
||||
GLuint m_Sampler2DArray; //or 3D texture as fallback
|
||||
TWGLuint m_Tex;
|
||||
TWGLuint m_Tex2DArray; //or 3D texture as fallback
|
||||
TWGLuint m_Sampler;
|
||||
TWGLuint m_Sampler2DArray; //or 3D texture as fallback
|
||||
int m_LastWrapMode;
|
||||
|
||||
int m_MemSize;
|
||||
|
@ -154,11 +148,11 @@ protected:
|
|||
std::vector<CTexture> m_Textures;
|
||||
std::atomic<int> *m_pTextureMemoryUsage;
|
||||
|
||||
GLint m_MaxTexSize;
|
||||
TWGLint m_MaxTexSize;
|
||||
|
||||
bool m_Has2DArrayTextures;
|
||||
bool m_Has2DArrayTexturesAsExtension;
|
||||
GLenum m_2DArrayTarget;
|
||||
TWGLenum m_2DArrayTarget;
|
||||
bool m_Has3DTextures;
|
||||
bool m_HasMipMaps;
|
||||
bool m_HasNPOTTextures;
|
||||
|
@ -234,6 +228,9 @@ protected:
|
|||
virtual void Cmd_RenderTex3D(const CCommandBuffer::SCommand_RenderTex3D *pCommand) {}
|
||||
virtual void Cmd_Screenshot(const CCommandBuffer::SCommand_Screenshot *pCommand);
|
||||
|
||||
virtual void Cmd_Update_Viewport(const CCommandBuffer::SCommand_Update_Viewport *pCommand);
|
||||
virtual void Cmd_Finish(const CCommandBuffer::SCommand_Finish *pCommand);
|
||||
|
||||
virtual void Cmd_CreateBufferObject(const CCommandBuffer::SCommand_CreateBufferObject *pCommand) {}
|
||||
virtual void Cmd_RecreateBufferObject(const CCommandBuffer::SCommand_RecreateBufferObject *pCommand) {}
|
||||
virtual void Cmd_UpdateBufferObject(const CCommandBuffer::SCommand_UpdateBufferObject *pCommand) {}
|
||||
|
@ -275,13 +272,13 @@ class CCommandProcessorFragment_OpenGL2 : public CCommandProcessorFragment_OpenG
|
|||
|
||||
struct SBufferObject
|
||||
{
|
||||
SBufferObject(GLuint BufferObjectID) :
|
||||
SBufferObject(TWGLuint BufferObjectID) :
|
||||
m_BufferObjectID(BufferObjectID)
|
||||
{
|
||||
m_pData = NULL;
|
||||
m_DataSize = 0;
|
||||
}
|
||||
GLuint m_BufferObjectID;
|
||||
TWGLuint m_BufferObjectID;
|
||||
void *m_pData;
|
||||
size_t m_DataSize;
|
||||
};
|
||||
|
@ -329,7 +326,7 @@ protected:
|
|||
|
||||
bool m_UseMultipleTextureUnits;
|
||||
|
||||
GLint m_MaxTextureUnits;
|
||||
TWGLint m_MaxTextureUnits;
|
||||
|
||||
struct STextureBound
|
||||
{
|
||||
|
@ -374,18 +371,18 @@ class CCommandProcessorFragment_OpenGL3_3 : public CCommandProcessorFragment_Ope
|
|||
CGLSLPrimitiveExProgram *m_pPrimitiveExProgramTexturedRotationless;
|
||||
CGLSLSpriteMultipleProgram *m_pSpriteProgramMultiple;
|
||||
|
||||
GLuint m_LastProgramID;
|
||||
TWGLuint m_LastProgramID;
|
||||
|
||||
GLuint m_PrimitiveDrawVertexID[MAX_STREAM_BUFFER_COUNT];
|
||||
GLuint m_PrimitiveDrawVertexIDTex3D;
|
||||
GLuint m_PrimitiveDrawBufferID[MAX_STREAM_BUFFER_COUNT];
|
||||
GLuint m_PrimitiveDrawBufferIDTex3D;
|
||||
TWGLuint m_PrimitiveDrawVertexID[MAX_STREAM_BUFFER_COUNT];
|
||||
TWGLuint m_PrimitiveDrawVertexIDTex3D;
|
||||
TWGLuint m_PrimitiveDrawBufferID[MAX_STREAM_BUFFER_COUNT];
|
||||
TWGLuint m_PrimitiveDrawBufferIDTex3D;
|
||||
|
||||
GLuint m_LastIndexBufferBound[MAX_STREAM_BUFFER_COUNT];
|
||||
TWGLuint m_LastIndexBufferBound[MAX_STREAM_BUFFER_COUNT];
|
||||
|
||||
int m_LastStreamBuffer;
|
||||
|
||||
GLuint m_QuadDrawIndexBufferID;
|
||||
TWGLuint m_QuadDrawIndexBufferID;
|
||||
unsigned int m_CurrentIndicesInBuffer;
|
||||
|
||||
void DestroyBufferContainer(int Index, bool DeleteBOs = true);
|
||||
|
@ -396,13 +393,13 @@ class CCommandProcessorFragment_OpenGL3_3 : public CCommandProcessorFragment_Ope
|
|||
{
|
||||
SBufferContainer() :
|
||||
m_VertArrayID(0), m_LastIndexBufferBound(0) {}
|
||||
GLuint m_VertArrayID;
|
||||
GLuint m_LastIndexBufferBound;
|
||||
TWGLuint m_VertArrayID;
|
||||
TWGLuint m_LastIndexBufferBound;
|
||||
SBufferContainerInfo m_ContainerInfo;
|
||||
};
|
||||
std::vector<SBufferContainer> m_BufferContainers;
|
||||
|
||||
std::vector<GLuint> m_BufferObjectIndices;
|
||||
std::vector<TWGLuint> m_BufferObjectIndices;
|
||||
|
||||
CCommandBuffer::SColorf m_ClearColor;
|
||||
|
||||
|
@ -461,7 +458,6 @@ public:
|
|||
enum
|
||||
{
|
||||
CMD_INIT = CCommandBuffer::CMDGROUP_PLATFORM_SDL,
|
||||
CMD_UPDATE_VIEWPORT,
|
||||
CMD_SHUTDOWN,
|
||||
};
|
||||
|
||||
|
@ -473,16 +469,6 @@ public:
|
|||
SDL_GLContext m_GLContext;
|
||||
};
|
||||
|
||||
struct SCommand_Update_Viewport : public CCommandBuffer::SCommand
|
||||
{
|
||||
SCommand_Update_Viewport() :
|
||||
SCommand(CMD_UPDATE_VIEWPORT) {}
|
||||
int m_X;
|
||||
int m_Y;
|
||||
int m_Width;
|
||||
int m_Height;
|
||||
};
|
||||
|
||||
struct SCommand_Shutdown : public CCommandBuffer::SCommand
|
||||
{
|
||||
SCommand_Shutdown() :
|
||||
|
@ -491,11 +477,9 @@ public:
|
|||
|
||||
private:
|
||||
void Cmd_Init(const SCommand_Init *pCommand);
|
||||
void Cmd_Update_Viewport(const SCommand_Update_Viewport *pCommand);
|
||||
void Cmd_Shutdown(const SCommand_Shutdown *pCommand);
|
||||
void Cmd_Swap(const CCommandBuffer::SCommand_Swap *pCommand);
|
||||
void Cmd_VSync(const CCommandBuffer::SCommand_VSync *pCommand);
|
||||
void Cmd_Resize(const CCommandBuffer::SCommand_Resize *pCommand);
|
||||
void Cmd_VideoModes(const CCommandBuffer::SCommand_VideoModes *pCommand);
|
||||
|
||||
public:
|
||||
|
|
12
src/engine/client/graphics_defines.h
Normal file
12
src/engine/client/graphics_defines.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
#ifndef ENGINE_CLIENT_GRAPHICS_DEFINES_H
|
||||
#define ENGINE_CLIENT_GRAPHICS_DEFINES_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef uint32_t TWGLuint;
|
||||
typedef int32_t TWGLint;
|
||||
typedef uint32_t TWGLenum;
|
||||
typedef uint8_t TWGLubyte;
|
||||
|
||||
#endif
|
|
@ -2332,7 +2332,9 @@ void CGraphics_Threaded::Resize(int w, int h, bool SetWindowSize)
|
|||
if(m_ScreenWidth > 21 * m_ScreenHeight / 9)
|
||||
m_ScreenWidth = 21 * m_ScreenHeight / 9;
|
||||
|
||||
CCommandBuffer::SCommand_Resize Cmd;
|
||||
CCommandBuffer::SCommand_Update_Viewport Cmd;
|
||||
Cmd.m_X = 0;
|
||||
Cmd.m_Y = 0;
|
||||
Cmd.m_Width = m_ScreenWidth;
|
||||
Cmd.m_Height = m_ScreenHeight;
|
||||
|
||||
|
@ -2414,13 +2416,24 @@ void CGraphics_Threaded::Swap()
|
|||
m_DoScreenshot = false;
|
||||
}
|
||||
|
||||
// add swap command
|
||||
CCommandBuffer::SCommand_Swap Cmd;
|
||||
Cmd.m_Finish = g_Config.m_GfxFinish;
|
||||
if(!AddCmd(
|
||||
Cmd, [] { return true; }, "failed to add swap command"))
|
||||
{
|
||||
return;
|
||||
// add swap command
|
||||
CCommandBuffer::SCommand_Swap Cmd;
|
||||
if(!AddCmd(
|
||||
Cmd, [] { return true; }, "failed to add swap command"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(g_Config.m_GfxFinish)
|
||||
{
|
||||
CCommandBuffer::SCommand_Finish Cmd;
|
||||
if(!AddCmd(
|
||||
Cmd, [] { return true; }, "failed to add finish command"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// kick the command buffer
|
||||
|
|
|
@ -119,12 +119,13 @@ public:
|
|||
|
||||
// swap
|
||||
CMD_SWAP,
|
||||
CMD_FINISH,
|
||||
|
||||
// misc
|
||||
CMD_VSYNC,
|
||||
CMD_SCREENSHOT,
|
||||
CMD_VIDEOMODES,
|
||||
CMD_RESIZE,
|
||||
CMD_UPDATE_VIEWPORT,
|
||||
|
||||
};
|
||||
|
||||
|
@ -504,8 +505,12 @@ public:
|
|||
{
|
||||
SCommand_Swap() :
|
||||
SCommand(CMD_SWAP) {}
|
||||
};
|
||||
|
||||
int m_Finish;
|
||||
struct SCommand_Finish : public SCommand
|
||||
{
|
||||
SCommand_Finish() :
|
||||
SCommand(CMD_FINISH) {}
|
||||
};
|
||||
|
||||
struct SCommand_VSync : public SCommand
|
||||
|
@ -517,11 +522,13 @@ public:
|
|||
bool *m_pRetOk;
|
||||
};
|
||||
|
||||
struct SCommand_Resize : public SCommand
|
||||
struct SCommand_Update_Viewport : public SCommand
|
||||
{
|
||||
SCommand_Resize() :
|
||||
SCommand(CMD_RESIZE) {}
|
||||
SCommand_Update_Viewport() :
|
||||
SCommand(CMD_UPDATE_VIEWPORT) {}
|
||||
|
||||
int m_X;
|
||||
int m_Y;
|
||||
int m_Width;
|
||||
int m_Height;
|
||||
};
|
||||
|
|
|
@ -7,6 +7,12 @@
|
|||
|
||||
#include <engine/client/backend_sdl.h>
|
||||
|
||||
#ifndef CONF_BACKEND_OPENGL_ES
|
||||
#include <GL/glew.h>
|
||||
#else
|
||||
#include <GLES3/gl3.h>
|
||||
#endif
|
||||
|
||||
bool CGLSL::LoadShader(CGLSLCompiler *pCompiler, IStorage *pStorage, const char *pFile, int Type)
|
||||
{
|
||||
if(m_IsLoaded)
|
||||
|
@ -88,7 +94,7 @@ bool CGLSL::LoadShader(CGLSLCompiler *pCompiler, IStorage *pStorage, const char
|
|||
ShaderCode[i] = Lines[i].c_str();
|
||||
}
|
||||
|
||||
GLuint shader = glCreateShader(Type);
|
||||
TWGLuint shader = glCreateShader(Type);
|
||||
|
||||
glShaderSource(shader, Lines.size(), ShaderCode, NULL);
|
||||
glCompileShader(shader);
|
||||
|
@ -102,7 +108,7 @@ bool CGLSL::LoadShader(CGLSLCompiler *pCompiler, IStorage *pStorage, const char
|
|||
{
|
||||
char buff[3000];
|
||||
|
||||
GLint maxLength = 0;
|
||||
TWGLint maxLength = 0;
|
||||
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &maxLength);
|
||||
|
||||
glGetShaderInfoLog(shader, maxLength, &maxLength, buff);
|
||||
|
@ -135,7 +141,7 @@ bool CGLSL::IsLoaded()
|
|||
return m_IsLoaded;
|
||||
}
|
||||
|
||||
GLuint CGLSL::GetShaderID()
|
||||
TWGLuint CGLSL::GetShaderID()
|
||||
{
|
||||
return m_ShaderID;
|
||||
}
|
||||
|
|
|
@ -3,12 +3,7 @@
|
|||
|
||||
#include <base/detect.h>
|
||||
|
||||
#ifndef CONF_BACKEND_OPENGL_ES
|
||||
#include <GL/glew.h>
|
||||
#else
|
||||
#define GL_GLEXT_PROTOTYPES 1
|
||||
#include "SDL_opengles2.h"
|
||||
#endif
|
||||
#include "graphics_defines.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
@ -22,13 +17,13 @@ public:
|
|||
void DeleteShader();
|
||||
|
||||
bool IsLoaded();
|
||||
GLuint GetShaderID();
|
||||
TWGLuint GetShaderID();
|
||||
|
||||
CGLSL();
|
||||
virtual ~CGLSL();
|
||||
|
||||
private:
|
||||
GLuint m_ShaderID;
|
||||
TWGLuint m_ShaderID;
|
||||
int m_Type;
|
||||
bool m_IsLoaded;
|
||||
};
|
||||
|
|
|
@ -2,6 +2,12 @@
|
|||
#include "opengl_sl.h"
|
||||
#include <base/system.h>
|
||||
|
||||
#ifndef CONF_BACKEND_OPENGL_ES
|
||||
#include <GL/glew.h>
|
||||
#else
|
||||
#include <GLES3/gl3.h>
|
||||
#endif
|
||||
|
||||
void CGLSLProgram::CreateProgram()
|
||||
{
|
||||
m_ProgramID = glCreateProgram();
|
||||
|
@ -33,7 +39,7 @@ void CGLSLProgram::DetachShader(CGLSL *pShader)
|
|||
}
|
||||
}
|
||||
|
||||
void CGLSLProgram::DetachShaderByID(GLuint ShaderID)
|
||||
void CGLSLProgram::DetachShaderByID(TWGLuint ShaderID)
|
||||
{
|
||||
glDetachShader(m_ProgramID, ShaderID);
|
||||
}
|
||||
|
@ -60,7 +66,7 @@ void CGLSLProgram::LinkProgram()
|
|||
|
||||
void CGLSLProgram::DetachAllShaders()
|
||||
{
|
||||
GLuint aShaders[100];
|
||||
TWGLuint aShaders[100];
|
||||
GLsizei ReturnedCount = 0;
|
||||
while(1)
|
||||
{
|
||||
|
@ -120,7 +126,7 @@ void CGLSLProgram::UseProgram()
|
|||
glUseProgram(m_ProgramID);
|
||||
}
|
||||
|
||||
GLuint CGLSLProgram::GetProgramID()
|
||||
TWGLuint CGLSLProgram::GetProgramID()
|
||||
{
|
||||
return m_ProgramID;
|
||||
}
|
||||
|
|
|
@ -3,12 +3,7 @@
|
|||
|
||||
#include <base/detect.h>
|
||||
|
||||
#ifndef CONF_BACKEND_OPENGL_ES
|
||||
#include <GL/glew.h>
|
||||
#else
|
||||
#define GL_GLEXT_PROTOTYPES 1
|
||||
#include "SDL_opengles2.h"
|
||||
#endif
|
||||
#include <engine/client/graphics_defines.h>
|
||||
|
||||
class CGLSL;
|
||||
|
||||
|
@ -22,10 +17,10 @@ public:
|
|||
|
||||
void LinkProgram();
|
||||
void UseProgram();
|
||||
GLuint GetProgramID();
|
||||
TWGLuint GetProgramID();
|
||||
|
||||
void DetachShader(CGLSL *pShader);
|
||||
void DetachShaderByID(GLuint ShaderID);
|
||||
void DetachShaderByID(TWGLuint ShaderID);
|
||||
void DetachAllShaders();
|
||||
|
||||
//Support various types
|
||||
|
@ -43,7 +38,7 @@ public:
|
|||
virtual ~CGLSLProgram();
|
||||
|
||||
protected:
|
||||
GLuint m_ProgramID;
|
||||
TWGLuint m_ProgramID;
|
||||
bool m_IsLinked;
|
||||
};
|
||||
|
||||
|
|
|
@ -6,6 +6,12 @@
|
|||
|
||||
#include "video.h"
|
||||
|
||||
#ifndef CONF_BACKEND_OPENGL_ES
|
||||
#include <GL/glew.h>
|
||||
#else
|
||||
#include <GLES3/gl3.h>
|
||||
#endif
|
||||
|
||||
// This code is mostly stolen from https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/muxing.c
|
||||
|
||||
#define STREAM_PIX_FMT AV_PIX_FMT_YUV420P /* default pix_fmt */
|
||||
|
@ -95,7 +101,7 @@ void CVideo::Start()
|
|||
m_pFormat = m_pFormatContext->oformat;
|
||||
|
||||
size_t NVals = FORMAT_NCHANNELS * m_Width * m_Height;
|
||||
m_pPixels = (uint8_t *)malloc(NVals * sizeof(GLubyte));
|
||||
m_pPixels = (uint8_t *)malloc(NVals * sizeof(TWGLubyte));
|
||||
m_pRGB = (uint8_t *)malloc(NVals * sizeof(uint8_t));
|
||||
|
||||
/* Add the audio and video streams using the default format codecs
|
||||
|
|
|
@ -3,12 +3,7 @@
|
|||
|
||||
#include <base/system.h>
|
||||
|
||||
#if defined(CONF_BACKEND_OPENGL_ES)
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GLES3/gl3.h>
|
||||
#define glOrtho glOrthof
|
||||
#else
|
||||
#include "SDL_opengl.h"
|
||||
#include "graphics_defines.h"
|
||||
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
|
@ -107,7 +102,7 @@ private:
|
|||
|
||||
bool m_HasAudio;
|
||||
|
||||
GLubyte *m_pPixels;
|
||||
TWGLubyte *m_pPixels;
|
||||
|
||||
OutputStream m_VideoStream;
|
||||
OutputStream m_AudioStream;
|
||||
|
|
Loading…
Reference in a new issue