| Index: ddraw/glExtensions.cpp |
| — | — | @@ -92,6 +92,7 @@ |
| 93 | 93 | GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) = NULL;
|
| 94 | 94 | void (APIENTRY *glTextureSubImage2DEXT)(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset,
|
| 95 | 95 | GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) = NULL;
|
| | 96 | +void (APIENTRY *glGetTextureImageEXT)(GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels) = NULL;
|
| 96 | 97 | void (APIENTRY *glMatrixLoadfEXT)(GLenum mode, const GLfloat *m) = NULL;
|
| 97 | 98 | void (APIENTRY *glMatrixMultfEXT)(GLenum mode, const GLfloat *m) = NULL;
|
| 98 | 99 |
|
| — | — | @@ -239,6 +240,7 @@ |
| 240 | 241 | glTextureParameterivEXT = (PFNGLTEXTUREPARAMETERIVEXTPROC)wglGetProcAddress("glTextureParameterivEXT");
|
| 241 | 242 | glTextureImage2DEXT = (PFNGLTEXTUREIMAGE2DEXTPROC)wglGetProcAddress("glTextureImage2DEXT");
|
| 242 | 243 | glTextureSubImage2DEXT = (PFNGLTEXTURESUBIMAGE2DEXTPROC)wglGetProcAddress("glTextureSubImage2DEXT");
|
| | 244 | + glGetTextureImageEXT = (PFNGLGETTEXTUREIMAGEEXTPROC)wglGetProcAddress("glGetTextureImageEXT");
|
| 243 | 245 | glMatrixLoadfEXT = (PFNGLMATRIXLOADFEXTPROC)wglGetProcAddress("glMatrixLoadfEXT");
|
| 244 | 246 | glMatrixMultfEXT = (PFNGLMATRIXMULTFEXTPROC)wglGetProcAddress("glMatrixMultfEXT");
|
| 245 | 247 | }
|
| Index: ddraw/glExtensions.h |
| — | — | @@ -122,6 +122,7 @@ |
| 123 | 123 | GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
|
| 124 | 124 | GLAPI void (APIENTRY *glTextureSubImage2DEXT)(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset,
|
| 125 | 125 | GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
|
| | 126 | +GLAPI void (APIENTRY *glGetTextureImageEXT)(GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
|
| 126 | 127 | GLAPI void (APIENTRY *glMatrixLoadfEXT)(GLenum mode, const GLfloat *m);
|
| 127 | 128 | GLAPI void (APIENTRY *glMatrixMultfEXT)(GLenum mode, const GLfloat *m);
|
| 128 | 129 |
|
| Index: ddraw/texture.cpp |
| — | — | @@ -196,18 +196,27 @@ |
| 197 | 197 |
|
| 198 | 198 | void UploadTextureClassic(TEXTURE *texture, int level, const void *data, int width, int height)
|
| 199 | 199 | {
|
| 200 | | - SetActiveTexture(0);
|
| 201 | | - SetTexture(0,texture);
|
| 202 | 200 | texture->width = width;
|
| 203 | 201 | texture->height = height;
|
| 204 | | - glTexImage2D(GL_TEXTURE_2D,level,texture->internalformat,width,height,0,texture->format,texture->type,data);
|
| | 202 | + if(GLEXT_EXT_direct_state_access) glTextureImage2DEXT(texture->id,GL_TEXTURE_2D,level,texture->internalformat,
|
| | 203 | + width,height,0,texture->format,texture->type,data);
|
| | 204 | + else
|
| | 205 | + {
|
| | 206 | + SetActiveTexture(0);
|
| | 207 | + SetTexture(0,texture);
|
| | 208 | + glTexImage2D(GL_TEXTURE_2D,level,texture->internalformat,width,height,0,texture->format,texture->type,data);
|
| | 209 | + }
|
| 205 | 210 | }
|
| 206 | 211 |
|
| 207 | 212 | void DownloadTextureClassic(TEXTURE *texture, int level, void *data)
|
| 208 | 213 | {
|
| 209 | | - SetActiveTexture(0);
|
| 210 | | - SetTexture(0,texture);
|
| 211 | | - glGetTexImage(GL_TEXTURE_2D,level,texture->format,texture->type,data);
|
| | 214 | + if(GLEXT_EXT_direct_state_access) glGetTextureImageEXT(texture->id,GL_TEXTURE_2D,level,texture->format,texture->type,data);
|
| | 215 | + else
|
| | 216 | + {
|
| | 217 | + SetActiveTexture(0);
|
| | 218 | + SetTexture(0,texture);
|
| | 219 | + glGetTexImage(GL_TEXTURE_2D,level,texture->format,texture->type,data);
|
| | 220 | + }
|
| 212 | 221 | }
|
| 213 | 222 |
|
| 214 | 223 | void (*_CreateTexture)(TEXTURE *texture, int width, int height) = CreateTextureClassic;
|