Add gluBuild2DMipmaps()
This commit is contained in:
parent
5be561ce4f
commit
53eb2e2a51
|
@ -320,6 +320,18 @@ void APIENTRY glGenerateMipmapEXT(GLenum target) {
|
|||
assert(_glIsMipmapComplete(tex));
|
||||
}
|
||||
|
||||
/* generate mipmaps for any image provided by the user and then pass them to OpenGL */
|
||||
GLAPI GLint APIENTRY gluBuild2DMipmaps(GLenum target, GLint internalFormat,
|
||||
GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type, const void *data){
|
||||
/* 2d texture, level of detail 0 (normal), 3 components (red, green, blue),
|
||||
width & height of the image, border 0 (normal), rgb color data,
|
||||
unsigned byte data, and finally the data itself. */
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, 3, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
|
||||
|
||||
glGenerateMipmapEXT(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
GLenum APIENTRY glCheckFramebufferStatusEXT(GLenum target) {
|
||||
if(target != GL_FRAMEBUFFER_EXT) {
|
||||
_glKosThrowError(GL_INVALID_ENUM, __func__);
|
||||
|
|
|
@ -34,6 +34,11 @@ GLAPI void APIENTRY gluLookAt(GLfloat eyex, GLfloat eyey, GLfloat eyez,
|
|||
GLfloat centerx, GLfloat centery, GLfloat centerz,
|
||||
GLfloat upx, GLfloat upy, GLfloat upz);
|
||||
|
||||
/* generate mipmaps for any image provided by the user and then pass them to OpenGL */
|
||||
GLAPI GLint APIENTRY gluBuild2DMipmaps(GLenum target, GLint internalFormat,
|
||||
GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type, const void *data);
|
||||
|
||||
GLAPI const GLubyte* APIENTRY gluErrorString(GLenum error);
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -47,11 +47,9 @@ void LoadGLTextures() {
|
|||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); // scale linearly when image bigger than texture
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR); // scale linearly when image smalled than texture
|
||||
|
||||
// 2d texture, level of detail 0 (normal), 3 components (red, green, blue), x size from image, y size from image,
|
||||
// border 0 (normal), rgb color data, unsigned byte data, and finally the data itself.
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, 3, image1->sizeX, image1->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, image1->data);
|
||||
|
||||
glGenerateMipmapEXT(GL_TEXTURE_2D);
|
||||
// 2d texture, 3 components (red, green, blue), x size from image, y size from image,
|
||||
// rgb color data, unsigned byte data, and finally the data itself.
|
||||
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, image1->sizeX, image1->sizeY, GL_RGB, GL_UNSIGNED_BYTE, image1->data);
|
||||
|
||||
free(image1);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user