miptree fixes; glTexStorage2D support; update GLAD
parent
b659ed6bb4
commit
2450936587
|
@ -26,7 +26,7 @@
|
|||
|
||||
/* Khronos platform-specific types and definitions.
|
||||
*
|
||||
* $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $
|
||||
* $Revision: 32517 $ on $Date: 2016-03-11 02:41:19 -0800 (Fri, 11 Mar 2016) $
|
||||
*
|
||||
* Adopters may modify this file to suit their platform. Adopters are
|
||||
* encouraged to submit platform specific modifications to the Khronos
|
||||
|
@ -101,6 +101,9 @@
|
|||
# define KHRONOS_APICALL __declspec(dllimport)
|
||||
#elif defined (__SYMBIAN32__)
|
||||
# define KHRONOS_APICALL IMPORT_C
|
||||
#elif defined(__ANDROID__)
|
||||
# include <sys/cdefs.h>
|
||||
# define KHRONOS_APICALL __attribute__((visibility("default"))) __NDK_FPABI__
|
||||
#else
|
||||
# define KHRONOS_APICALL
|
||||
#endif
|
||||
|
@ -223,7 +226,7 @@ typedef signed short int khronos_int16_t;
|
|||
typedef unsigned short int khronos_uint16_t;
|
||||
|
||||
/*
|
||||
* Types that differ between LLP64 and LP64 architectures - in LLP64,
|
||||
* Types that differ between LLP64 and LP64 architectures - in LLP64,
|
||||
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
|
||||
* to be the only LLP64 architecture in current use.
|
||||
*/
|
||||
|
|
12060
include/glad/glad.h
12060
include/glad/glad.h
File diff suppressed because one or more lines are too long
6997
src/gl/glad.c
6997
src/gl/glad.c
File diff suppressed because one or more lines are too long
|
@ -1415,15 +1415,28 @@ void render_cubemap(uint32_t *pixels, int width, int height, int pitch, camera_t
|
|||
if(img[i]->udtype == UD_IMG && img[i]->tex_dirty)
|
||||
{
|
||||
if(img[i]->tex == 0)
|
||||
{
|
||||
glGenTextures(1, &(img[i]->tex));
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, img[i]->tex);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, iw, ih, 0, GL_BGRA, GL_UNSIGNED_BYTE, img[i]->pixels);
|
||||
// BILINEAR FILTERING IS FOR PLEBS
|
||||
// (just kidding, I may add support for it later)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glBindTexture(GL_TEXTURE_2D, img[i]->tex);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
|
||||
// BILINEAR FILTERING IS FOR PLEBS
|
||||
// (just kidding, I may add support for it later)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
||||
if(GLAD_GL_ARB_texture_storage) {
|
||||
glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, iw, ih);
|
||||
} else {
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, iw, ih, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
|
||||
}
|
||||
} else {
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, img[i]->tex);
|
||||
}
|
||||
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, iw, ih, GL_BGRA, GL_UNSIGNED_BYTE, img[i]->pixels);
|
||||
img[i]->tex_dirty = 0;
|
||||
} else {
|
||||
glBindTexture(GL_TEXTURE_2D, img[i]->tex);
|
||||
|
@ -1633,14 +1646,28 @@ void render_vertex_array(uint32_t *pixels, int width, int height, int pitch, cam
|
|||
if(img[i]->udtype == UD_IMG && img[i]->tex_dirty)
|
||||
{
|
||||
if(img[i]->tex == 0)
|
||||
{
|
||||
glGenTextures(1, &(img[i]->tex));
|
||||
glBindTexture(GL_TEXTURE_2D, img[i]->tex);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
|
||||
// BILINEAR FILTERING IS FOR PLEBS
|
||||
// (just kidding, I may add support for it later)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
||||
if(GLAD_GL_ARB_texture_storage) {
|
||||
glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, iw, ih);
|
||||
} else {
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, iw, ih, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
|
||||
}
|
||||
} else {
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, img[i]->tex);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, iw, ih, 0, GL_BGRA, GL_UNSIGNED_BYTE, img[i]->pixels);
|
||||
// BILINEAR FILTERING IS FOR PLEBS
|
||||
// (just kidding, I may add support for it later)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glBindTexture(GL_TEXTURE_2D, img[i]->tex);
|
||||
}
|
||||
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, iw, ih, GL_BGRA, GL_UNSIGNED_BYTE, img[i]->pixels);
|
||||
|
||||
img[i]->tex_dirty = 0;
|
||||
} else {
|
||||
|
|
|
@ -112,12 +112,23 @@ void render_blit_img(uint32_t *pixels, int width, int height, int pitch,
|
|||
if(src->udtype == UD_IMG && src->tex_dirty)
|
||||
{
|
||||
if(src->tex == 0)
|
||||
{
|
||||
glGenTextures(1, &(src->tex));
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, src->tex);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, iw, ih, 0, GL_BGRA, GL_UNSIGNED_BYTE, src->pixels);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glBindTexture(GL_TEXTURE_2D, src->tex);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
if(GLAD_GL_ARB_texture_storage)
|
||||
{
|
||||
glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, iw, ih);
|
||||
} else {
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, iw, ih, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
|
||||
}
|
||||
} else {
|
||||
glBindTexture(GL_TEXTURE_2D, src->tex);
|
||||
}
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, iw, ih, GL_BGRA, GL_UNSIGNED_BYTE, src->pixels);
|
||||
|
||||
src->tex_dirty = 0;
|
||||
} else {
|
||||
|
|
|
@ -78,20 +78,37 @@ int icelua_fn_client_fbo_create(lua_State *L)
|
|||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, ctex);
|
||||
glGetError();
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
if(GLAD_GL_ARB_texture_storage)
|
||||
{
|
||||
glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, w, h);
|
||||
} else {
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
}
|
||||
glFinish();
|
||||
int err_ctex = glGetError();
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, ctex, 0);
|
||||
glBindTexture(GL_TEXTURE_2D, dstex);
|
||||
glGetError();
|
||||
if(use_stencil)
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, w, h, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, NULL);
|
||||
else
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, w, h, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
if(GLAD_GL_ARB_texture_storage)
|
||||
{
|
||||
if(use_stencil)
|
||||
glTexStorage2D(GL_TEXTURE_2D, 1, GL_DEPTH24_STENCIL8, w, h);
|
||||
else
|
||||
glTexStorage2D(GL_TEXTURE_2D, 1, GL_DEPTH_COMPONENT24, w, h);
|
||||
} else {
|
||||
if(use_stencil)
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, w, h, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, NULL);
|
||||
else
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, w, h, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL);
|
||||
}
|
||||
glFinish();
|
||||
int err_dstex = glGetError();
|
||||
printf("FBO tex err results: %i %i\n", err_ctex, err_dstex);
|
||||
|
|
Loading…
Reference in New Issue