diff options
Diffstat (limited to 'gl_calls.cpp')
-rw-r--r-- | gl_calls.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gl_calls.cpp b/gl_calls.cpp index b08615a..6f760b6 100644 --- a/gl_calls.cpp +++ b/gl_calls.cpp @@ -154,6 +154,20 @@ static void GL_InitDefaultVerts() { glEnableVertexAttribArray(1); } +void +GL_GenAndBindTexture(GLuint *GLTexture, int Width, int Height, int BytesPerPixel, void *BufferAddress) +{ + glGenTextures(1, GLTexture); + glBindTexture(GL_TEXTURE_2D, *GLTexture); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + int ByteFlag = (BytesPerPixel == 4) ? GL_RGBA : GL_RGBA16; + int ByteFlag2 = (BytesPerPixel == 4) ? GL_UNSIGNED_BYTE : GL_UNSIGNED_SHORT; + glTexImage2D(GL_TEXTURE_2D, 0, ByteFlag, Width, Height, 0, GL_RGBA, ByteFlag2, BufferAddress); +} + #if 0 void GL_InitTexture(gl_effect_layer *Test) |