diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2011-12-31 09:40:11 +0100 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2011-12-31 09:40:11 +0100 |
| commit | 8a91bfa1ddff0c99d65375b8b5c57e710169543a (patch) | |
| tree | c3a5806cc3b5caf1da378f08533956f53f29b686 /src/engine/client/graphics.cpp | |
| parent | 50e75da3334e77d027d5b10d85d4022c5dca0821 (diff) | |
| download | zcatch-8a91bfa1ddff0c99d65375b8b5c57e710169543a.tar.gz zcatch-8a91bfa1ddff0c99d65375b8b5c57e710169543a.zip | |
fixed texture upload support. removed raw gl calls from the text render
Diffstat (limited to 'src/engine/client/graphics.cpp')
| -rw-r--r-- | src/engine/client/graphics.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/engine/client/graphics.cpp b/src/engine/client/graphics.cpp index 2d034f3f..b78e5387 100644 --- a/src/engine/client/graphics.cpp +++ b/src/engine/client/graphics.cpp @@ -270,6 +270,18 @@ int CGraphics_OpenGL::UnloadTexture(int Index) return 0; } +int CGraphics_OpenGL::LoadTextureRawSub(int TextureID, int x, int y, int Width, int Height, int Format, const void *pData) +{ + int Oglformat = GL_RGBA; + if(Format == CImageInfo::FORMAT_RGB) + Oglformat = GL_RGB; + else if(Format == CImageInfo::FORMAT_ALPHA) + Oglformat = GL_ALPHA; + + glBindTexture(GL_TEXTURE_2D, m_aTextures[TextureID].m_Tex); + glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, Width, Height, Oglformat, GL_UNSIGNED_BYTE, pData); + return 0; +} int CGraphics_OpenGL::LoadTextureRaw(int Width, int Height, int Format, const void *pData, int StoreFormat, int Flags) { @@ -336,6 +348,7 @@ int CGraphics_OpenGL::LoadTextureRaw(int Width, int Height, int Format, const vo glGenTextures(1, &m_aTextures[Tex].m_Tex); glBindTexture(GL_TEXTURE_2D, m_aTextures[Tex].m_Tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST); gluBuild2DMipmaps(GL_TEXTURE_2D, StoreOglformat, Width, Height, Oglformat, GL_UNSIGNED_BYTE, pTexData); |