|
@@ -1801,19 +1801,25 @@ void tnsConfigure2DTexture(tnsTexture *t){
|
|
|
t->GLTexBitsType==GL_DEPTH_COMPONENT24||t->GLTexBitsType==GL_DEPTH_COMPONENT32F;
|
|
|
int format=isDepth?GL_DEPTH_COMPONENT:(t->GLTexBitsType==GL_R8?GL_RED:(t->GLTexBitsType==GL_RG8?GL_RG:(t->GLTexBitsType==GL_RGB8?GL_RGB:GL_RGBA)));
|
|
|
int type=isDepth?GL_UNSIGNED_INT:GL_UNSIGNED_BYTE;
|
|
|
+ //if(t->GLTexBitsType==GL_RGBA4){ format=GL_RGB; type=GL_UNSIGNED_SHORT_4_4_4_4; printf("ye\n"); }
|
|
|
if(t->GLTexBitsType==GL_RGBA16UI){ format=GL_RGBA_INTEGER; type=GL_UNSIGNED_SHORT; t->IsUIntTexture=1; }
|
|
|
- if(t->GLTexBitsType==GL_RGBA32UI){ format=GL_RGBA_INTEGER; type=GL_UNSIGNED_INT; t->IsUIntTexture=1; }
|
|
|
- if(t->GLTexBitsType==GL_R32UI){ format=GL_RED_INTEGER; type=GL_UNSIGNED_INT; t->IsUIntTexture=1; }
|
|
|
- if(t->GLTexBitsType==GL_RGBA16F){ format=GL_RGBA; type=GL_FLOAT; }
|
|
|
- if(t->GLTexBitsType==GL_DEPTH_STENCIL){ format=GL_DEPTH_STENCIL; type=GL_UNSIGNED_INT_24_8; t->GLTexBitsType=GL_DEPTH24_STENCIL8; }
|
|
|
+ elif(t->GLTexBitsType==GL_RGBA32UI){ format=GL_RGBA_INTEGER; type=GL_UNSIGNED_INT; t->IsUIntTexture=1; }
|
|
|
+ elif(t->GLTexBitsType==GL_R32UI){ format=GL_RED_INTEGER; type=GL_UNSIGNED_INT; t->IsUIntTexture=1; }
|
|
|
+ elif(t->GLTexBitsType==GL_RGBA16F){ format=GL_RGBA; type=GL_FLOAT; }
|
|
|
+ elif(t->GLTexBitsType==GL_DEPTH_STENCIL){ format=GL_DEPTH_STENCIL; type=GL_UNSIGNED_INT_24_8; t->GLTexBitsType=GL_DEPTH24_STENCIL8; }
|
|
|
#ifndef LAGUI_ANDROID
|
|
|
if(isDepth){t->GLTexBitsType=GL_DEPTH_COMPONENT24; type=GL_UNSIGNED_INT;}
|
|
|
- if(t->Multisample) glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, t->Multisample, t->GLTexBitsType, t->Width, t->Height, GL_TRUE);
|
|
|
+ t->Multisample=0;
|
|
|
#endif
|
|
|
- else{ glTexImage2D(GL_TEXTURE_2D, 0, t->GLTexBitsType, t->Width, t->Height, 0, format, type, 0);
|
|
|
+ if(t->Multisample){
|
|
|
+#ifndef LAGUI_ANDROID
|
|
|
+ glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, t->Multisample, t->GLTexBitsType, t->Width, t->Height, GL_TRUE);
|
|
|
+#endif
|
|
|
+ }else{ glTexImage2D(GL_TEXTURE_2D, 0, t->GLTexBitsType, t->Width, t->Height, 0, format, type, 0);
|
|
|
if(t->IsUIntTexture){
|
|
|
glTexStorage2D(GL_TEXTURE_2D, 1,t->GLTexBitsType,t->Width, t->Height);
|
|
|
}
|
|
|
+ //if(t->GLTexBitsType==GL_RGBA4){ glTexStorage2D(GL_TEXTURE_2D,0,GL_RGBA4,t->Width,t->Height); }
|
|
|
int a=glGetError();
|
|
|
int clamp = GL_CLAMP_TO_EDGE;
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, clamp);
|
|
@@ -2722,9 +2728,10 @@ void tnsDelete2DOffscreen(tnsOffscreen *o){
|
|
|
|
|
|
void tnsDrawToOffscreen(tnsOffscreen *toff, int HowMany, GLuint *AttachmentArray){
|
|
|
if (!toff) return;
|
|
|
- glBindFramebuffer(GL_DRAW_FRAMEBUFFER, toff->FboHandle);
|
|
|
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, toff->FboHandle); glClear(0);
|
|
|
if(AttachmentArray==TNS_ATTACHMENT_ARRAY_NONE){glDrawBuffer(GL_NONE);}
|
|
|
else glDrawBuffers((HowMany ? HowMany : 1), (AttachmentArray ? AttachmentArray : TNS_ATTACHMENT_ARRAY));
|
|
|
+ glClear(0);
|
|
|
T->IsOffscreen = 1;
|
|
|
T->BindedShader = 0;
|
|
|
}
|
|
@@ -2737,7 +2744,7 @@ void tnsReadFromOffscreen(tnsOffscreen *toff){
|
|
|
glBindFramebuffer(GL_READ_FRAMEBUFFER, toff->FboHandle);
|
|
|
}
|
|
|
void tnsDrawToScreen(){
|
|
|
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
|
|
+ glBindFramebuffer(GL_FRAMEBUFFER, 0); glClear(0);
|
|
|
//glDrawBuffer(GL_BACK); printf("%d\n", glGetError());
|
|
|
T->IsOffscreen = 0;
|
|
|
T->BindedShader = 0;
|