1 // Copyright (c) 1999-2012 OPEN CASCADE SAS
3 // The content of this file is subject to the Open CASCADE Technology Public
4 // License Version 6.5 (the "License"). You may not use the content of this file
5 // except in compliance with the License. Please obtain a copy of the License
6 // at http://www.opencascade.org and read it completely before using this file.
8 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
11 // The Original Code and all software distributed under the License is
12 // distributed on an "AS IS" basis, without warranty of any kind, and the
13 // Initial Developer hereby disclaims all such warranties, including without
14 // limitation, any warranties of merchantability, fitness for a particular
15 // purpose or non-infringement. Please see the License for the specific terms
16 // and conditions governing the rights and limitations under the License.
21 * Gestion des textures sous OpenGL
26 * Les textures sont toujours initialisee avec des parametres par defaut
27 * texture 1D: WRAP_S = CLAMP
28 * MAG_FILTER = NEAREST
29 * generation de texture automatique en OBJECT_LINEAR
32 * texture 2D: WRAP_S/T = REPEAT
33 * MAG/MIN_FILTER = LINEAR
34 * generation de texture automatique en OBJECT_LINEAR
37 * texture 2D MipMap: WRAP_S/T = REPEAT
39 * MIN_FILTER = LINEAR_MIPMAP_NEAREST
40 * generation de texture automatique en OBJECT_LINEAR
43 * Historique des modifications
44 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45 * 22-05-97: PCT ; Creation
46 * 18-06-97: FMN ; Ajout entete
47 * 20-06-97: PCT ; Correction bug parametres par defaut texture 1D
48 * 30-06-97: PCT ; Correction bug rechargement de la texture courante
49 * 04-07-97: PCT ; suppression de l'utilisation de libimage.a de SGI
50 * 01-08-97: PCT ; suppression InitializeTextureBox()
51 * 04-08-97: FMN,PCT ; Portage WNT
52 * 05-08-97: FMN ; ajout GetTextureData...
53 * 10-09-97: PCT ; ajout commentaires. GetTexture() ne doit pas
54 * etre utilisee dans Cas.Cade ( le chargement est
55 * fait par Graphic3d )
56 * 06-10-97: FMN ; Portage HP
57 * 14-10-97: FMN ; Ajout OpenGl_Extension
58 * 22-10-97: FMN ; Meilleure gestion de l'extension glXGetCurrentDisplayEXT
59 * 04-11-97: FMN ; Gestion des differentes versions GLX
60 * 19-11-97: FMN ; Ajout GetCurrentDisplay plus simple que glXGetCurrentDisplayEXT
61 * 04-12-97: FMN ; On suppose que l'on travaille en OpenGL1.1 (cf OpenGl_Extension)
62 * 17-12-97: FMN ; Probleme compilation SGI
63 * 17-12-97: FMN ; Probleme sur Optimisation sur MyBindTextureEXT()
64 * Le test sur la texture courante doit tenir compte du contexte.
65 * 22-07-98: FGU ; Ajout fonctions TransferTexture_To_Data() et TransferData_To_Texture()
73 #include <OpenGl_GlCore11.hxx>
74 #include <OpenGl_Display.hxx>
75 #include <OpenGl_TextureBox.hxx>
76 #include <OpenGl_ImageBox.hxx>
77 #include <OpenGl_ResourceTexture.hxx>
78 #include <OpenGl_Context.hxx>
80 #include <GL/glu.h> // gluBuild2DMipmaps()
82 #include <NCollection_Vector.hxx>
84 typedef enum {TEXDATA_NONE, TEXDATA_1D, TEXDATA_2D, TEXDATA_2DMM} texDataStatus;
85 typedef enum {TEX_NONE, TEX_ALLOCATED} texStatus;
87 typedef GLfloat SizeType[4];
89 typedef int TextureDataID;
90 #define TEXTUREDATA_ERROR -1
94 char imageFileName[128];
95 int imageWidth, imageHeight;
100 DEFINE_STANDARD_ALLOC
113 NCollection_Vector<contextData> contextdata;
122 GLfloat scalex, scaley;
123 GLfloat transx, transy;
126 DEFINE_STANDARD_ALLOC
130 /*----------------------------------------------------------------------*/
132 * Variables statiques
135 static NCollection_Vector<texDraw> textab;
137 static NCollection_Vector<texData> texdata;
139 static TextureDataID current_texture_data = TEXTUREDATA_ERROR;
140 static TextureID current_texture = TEXTUREBOX_ERROR;
142 static GLfloat sgenparams[] = { 1.0 ,0.0 ,0.0 ,0.0};
143 static GLfloat tgenparams[] = { 0.0 ,1.0 ,0.0 ,0.0};
145 static GLenum status2type[] = { GL_NONE, GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_2D };
147 /*----------------------------------------------------------------------*/
152 /*----------------------------------------------------------------------*/
154 * recherche l'existence de datas de texture par son nom
156 static TextureDataID FindTextureData(char *FileName)
158 for (int i = 0; i < texdata.Length(); i++)
160 if ( texdata(i).status != TEXDATA_NONE && strcmp(FileName, texdata(i).imageFileName) == 0 )
166 return TEXTUREDATA_ERROR;
169 /*----------------------------------------------------------------------*/
171 * recherche un emplacement de data texture libre
173 static TextureDataID FindFreeTextureData(void)
175 for (int i = 0; i < texdata.Length(); i++)
177 if (texdata(i).status == TEXDATA_NONE)
184 texdata.Append(aTexData);
185 return texdata.Length() - 1;
188 /*----------------------------------------------------------------------*/
190 * recherche un emplacement de texture libre
192 static TextureID FindFreeTexture(void)
194 for (int i = 0; i < textab.Length(); i++)
196 if (textab(i).status == TEX_NONE)
203 textab.Append(aTexDraw);
204 return textab.Length() - 1;
207 /*----------------------------------------------------------------------*/
209 * regarde si la texture a ete definie pour le contexte courant
211 static int FindTextureContext(TextureID ID)
215 GLCONTEXT cur = GET_GL_CONTEXT();
216 for (i=0; i<textab(ID).contextdata.Length(); i++)
217 if (textab(ID).contextdata(i).context == cur)
220 return TEXTUREBOX_ERROR;
223 /*----------------------------------------------------------------------*/
225 * chargement d'une texture suivant son type
227 static void LoadTexture(TextureID ID)
231 data = textab(ID).data;
232 switch (texdata(data).status)
235 glTexImage1D(GL_TEXTURE_1D, 0, 4,
236 texdata(data).imageWidth, 0,
237 GL_RGBA, GL_UNSIGNED_BYTE, texdata(data).image);
241 glTexImage2D(GL_TEXTURE_2D, 0, 4,
242 texdata(data).imageWidth, texdata(data).imageHeight, 0,
243 GL_RGBA, GL_UNSIGNED_BYTE, texdata(data).image);
247 gluBuild2DMipmaps(GL_TEXTURE_2D, 4,
248 texdata(data).imageWidth,
249 texdata(data).imageHeight,
250 GL_RGBA, GL_UNSIGNED_BYTE, texdata(data).image);
257 /*----------------------------------------------------------------------*/
259 * les parametres d'initialisation d'une texture
260 * NE PAS METTRE DANS UNE DISPLAY LIST POUR L'INSTANT ( pb avec les matrices )
262 static void SetTextureParam(TextureID ID)
268 data = textab(ID).data;
269 glGetIntegerv(GL_MATRIX_MODE, &cur_matrix);
272 * MISE EN PLACE DE LA MATRICE DE TEXTURE
274 glMatrixMode(GL_TEXTURE);
276 /* if (textab(ID).Gen != GL_SPHERE_MAP)
278 glScalef(textab(ID).scalex, textab(ID).scaley, 1.0);
279 glTranslatef(-textab(ID).transx, -textab(ID).transy, 0.0);
280 glRotatef(-textab(ID).angle, 0.0, 0.0, 1.0);
285 * GENERATION AUTOMATIQUE DE TEXTURE
287 switch (textab(ID).Gen)
289 case GL_OBJECT_LINEAR:
290 glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
291 glTexGenfv(GL_S, GL_OBJECT_PLANE, textab(ID).Plane1);
292 if (texdata(data).status != TEXDATA_1D)
294 glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
295 glTexGenfv(GL_T, GL_OBJECT_PLANE, textab(ID).Plane2);
300 glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
301 if (texdata(data).status != TEXDATA_1D)
302 glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
306 glMatrixMode(GL_MODELVIEW);
310 glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
311 glTexGenfv(GL_S, GL_EYE_PLANE, textab(ID).Plane1);
313 if (texdata(data).status != TEXDATA_1D)
315 glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
316 glTexGenfv(GL_T, GL_EYE_PLANE, textab(ID).Plane2);
325 * RENDU DE LA TEXTURE AVEC LES LUMIERES
327 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, textab(ID).Light);
331 * LISSAGE DE LA TEXTURE
333 switch (texdata(data).status)
337 glTexParameteri(texdata(data).type, GL_TEXTURE_MAG_FILTER, textab(ID).Render);
338 glTexParameteri(texdata(data).type, GL_TEXTURE_MIN_FILTER, textab(ID).Render);
342 if (textab(ID).Render == GL_NEAREST)
344 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
345 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
349 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
350 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
361 switch (texdata(data).status)
364 glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, textab(ID).Wrap);
369 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, textab(ID).Wrap);
370 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, textab(ID).Wrap);
376 glMatrixMode(cur_matrix);
379 /*----------------------------------------------------------------------*/
381 * simulation du glGenTexturesEXT pour un context
383 static void MyGenTextureEXT (TextureID ID)
385 TextureDataID data = textab(ID).data;
386 contextData aContextData;
388 aContextData.context = GET_GL_CONTEXT();
389 aContextData.drawable = GET_GLDEV_CONTEXT();
390 glGenTextures (1, &aContextData.number);
391 textab(ID).contextdata.Append(aContextData);
392 glBindTexture (texdata(data).type, aContextData.number);
396 /*----------------------------------------------------------------------*/
398 * simulation du glBindTextureEXT
400 static void MyBindTextureEXT (TextureID ID, int Context)
402 TextureDataID data = textab(ID).data;
403 if (texdata(data).status == TEXDATA_NONE)
406 GLenum aParamName = texdata(data).status == TEXDATA_1D ?
407 GL_TEXTURE_BINDING_1D : GL_TEXTURE_BINDING_2D;
410 glGetIntegerv (aParamName, &aCurrTex);
411 if (textab(ID).contextdata(Context).number != aCurrTex)
413 glBindTexture (texdata(data).type, textab(ID).contextdata(Context).number);
417 /*----------------------------------------------------------------------*/
419 * installation de la texture pour le dernier contexte
421 static int InstallTextureInContext(TextureID ID)
424 printf("InstallTextureInContext::installation de la texture dans le context\n");
429 printf("InstallTextureInContext::context ok\n");
434 /*----------------------------------------------------------------------*/
435 static TextureID GetTexture(char *FileName, texDataStatus status)
441 /* essait de trouver la texture */
442 i = FindTextureData(FileName);
443 if (i == TEXTUREDATA_ERROR)
446 printf("GetTexture::la texture %s n'existe pas => chargement\n", FileName);
448 /* creation d'une texture */
449 i = FindFreeTextureData();
450 if (i == TEXTUREDATA_ERROR) return TEXTUREBOX_ERROR;
452 texdata(i).share_count = 0;
453 strcpy(texdata(i).imageFileName, FileName);
454 texdata(i).image = (GLubyte *)read_texture(FileName,
455 &texdata(i).imageWidth,
456 &texdata(i).imageHeight,
458 if (texdata(i).image == NULL) return TEXTUREBOX_ERROR;
460 texdata(i).status = status;
461 texdata(i).type = status2type[status];
464 j = FindFreeTexture();
465 if (j != TEXTUREBOX_ERROR)
468 printf("GetTexture::installation texture pour obj %d\n", j);
470 textab(j).contextdata.Clear();
472 textab(j).status = TEX_ALLOCATED;
473 texdata(i).share_count++;
475 SetTextureDefaultParams(j);
478 printf("GetTexture::texture %s(%d) texture %d count=%d\n", texdata(i).imageFileName, i, j, texdata(i).share_count);
482 if (texdata(i).share_count != 0)
483 delete [] texdata(i).image;
489 /*----------------------------------------------------------------------*/
490 static TextureID GetTextureData(char *FileName, texDataStatus status, const GLint width, const GLint height, const void *data)
495 /* essait de trouver la texture */
496 i = FindTextureData(FileName);
497 if (i == TEXTUREDATA_ERROR)
500 printf("GetTextureData::la texture %s n'existe pas => chargement\n", FileName);
502 /* creation d'une texture */
503 i = FindFreeTextureData();
504 if (i == TEXTUREDATA_ERROR) return TEXTUREBOX_ERROR;
506 texdata(i).share_count = 0;
507 strcpy(texdata(i).imageFileName, FileName);
508 texdata(i).image = new GLubyte[width*height*4];
509 memcpy(texdata(i).image, data, (width*height*4));
510 texdata(i).imageWidth = width;
511 texdata(i).imageHeight = height;
513 if (texdata(i).image == NULL) return TEXTUREBOX_ERROR;
515 texdata(i).status = status;
516 texdata(i).type = status2type[status];
519 j = FindFreeTexture();
520 if (j != TEXTUREBOX_ERROR)
523 printf("GetTextureData::installation texture pour obj %d\n", j);
525 textab(j).contextdata.Clear();
527 textab(j).status = TEX_ALLOCATED;
528 texdata(i).share_count++;
530 SetTextureDefaultParams(j);
533 printf("GetTextureData::texture %s(%d) texture %d count=%d\n", texdata(i).imageFileName, i, j, texdata(i).share_count);
537 if (texdata(i).share_count != 0)
538 delete [] texdata(i).image;
543 /*----------------------------------------------------------------------*/
545 * Fonctions publiques
549 /*----------------------------------------------------------------------*/
551 GLboolean IsTextureValid(TextureID ID)
553 if ( (ID < 0) || (ID >= textab.Length()) )
556 if (textab.Length() > 0)
558 return textab(ID).status == TEX_ALLOCATED;
566 /*----------------------------------------------------------------------*/
568 TextureID GetTexture1D(char *FileName)
571 printf("GetTexture1D::loading 1d %s \n", FileName);
573 return GetTexture(FileName, TEXDATA_1D);
576 /*----------------------------------------------------------------------*/
578 TextureID GetTexture2D(char *FileName)
581 printf("GetTexture2D::loading 2d %s \n", FileName);
583 return GetTexture(FileName, TEXDATA_2D);
586 /*----------------------------------------------------------------------*/
588 TextureID GetTexture2DMipMap(char *FileName)
591 printf("GetTexture2DMipMap::loading 2dmm %s \n", FileName);
593 return GetTexture(FileName, TEXDATA_2DMM);
596 /*----------------------------------------------------------------------*/
598 TextureID GetTextureData1D(char *FileName, const GLint width, const GLint height, const void *data)
601 printf("GetTextureData1D::loading 1d %s \n", FileName);
603 return GetTextureData(FileName, TEXDATA_1D, width, height, data);
606 /*----------------------------------------------------------------------*/
608 TextureID GetTextureData2D(char *FileName, const GLint width, const GLint height, const void *data)
611 printf("GetTextureData2D::loading 2d %s \n", FileName);
613 return GetTextureData(FileName, TEXDATA_2D, width, height, data);
616 /*----------------------------------------------------------------------*/
618 TextureID GetTextureData2DMipMap(char *FileName, const GLint width, const GLint height, const void *data)
621 printf("GetTextureData2DMipMap::loading 2dmm %s \n", FileName);
623 return GetTextureData(FileName, TEXDATA_2DMM, width, height, data);
627 /*----------------------------------------------------------------------*/
629 void SetCurrentTexture(TextureID ID)
633 if (!IsTextureValid(ID)) return;
635 context = FindTextureContext(ID);
637 /* la texture n'existe pas dans ce contexte */
638 if (context == TEXTUREBOX_ERROR)
641 printf("SetCurrentTexture::installation texture %d dans context\n", ID);
643 /* si on a une erreur pendant l'installation dans le context
644 * alors on installe la texture sans bind */
645 if (InstallTextureInContext(ID) == TEXTUREBOX_ERROR)
652 /*oui, alors on bind directement */
656 printf("SetCurrentTexture: utilisation du bind %d\n", ID);
658 MyBindTextureEXT(ID, context);
662 current_texture = ID;
663 current_texture_data = textab(ID).data;
666 /*----------------------------------------------------------------------*/
668 void FreeTexture (const Handle(OpenGl_Context)& theContext,
671 if (!IsTextureValid (ID))
676 TextureDataID data = textab(ID).data;
677 texdata(data).share_count--;
678 if (texdata(data).share_count == 0)
680 // release texture data
681 delete [] texdata(data).image;
683 // liberation de la texture dans tous les contextes
684 for (int i = 0; i < textab(ID).contextdata.Length(); ++i)
686 Handle(OpenGl_ResourceTexture) aResource = new OpenGl_ResourceTexture (textab(ID).contextdata(i).number);
687 theContext->DelayedRelease (aResource);
690 texdata(data).status = TEXDATA_NONE;
692 textab(ID).contextdata.Clear();
695 textab(ID).status = TEX_NONE;
697 current_texture_data = TEXTUREDATA_ERROR;
700 /*----------------------------------------------------------------------*/
702 void EnableTexture(void)
704 if (!IsTextureValid(current_texture)) return;
706 switch (texdata(current_texture_data).status)
709 if (textab(current_texture).Gen != GL_NONE)
710 glEnable(GL_TEXTURE_GEN_S);
711 glEnable(GL_TEXTURE_1D);
716 if (textab(current_texture).Gen != GL_NONE)
718 glEnable(GL_TEXTURE_GEN_S);
719 glEnable(GL_TEXTURE_GEN_T);
721 glEnable(GL_TEXTURE_2D);
728 /*----------------------------------------------------------------------*/
730 void DisableTexture(void)
732 if ( !IsTextureEnabled() )
734 if ( !IsTextureValid( current_texture ) )
737 switch (texdata(current_texture_data).status)
740 if (textab(current_texture).Gen != GL_NONE)
741 glDisable(GL_TEXTURE_GEN_S);
742 glDisable(GL_TEXTURE_1D);
747 if (textab(current_texture).Gen != GL_NONE)
749 glDisable(GL_TEXTURE_GEN_S);
750 glDisable(GL_TEXTURE_GEN_T);
752 glDisable(GL_TEXTURE_2D);
759 /*----------------------------------------------------------------------*/
761 GLboolean IsTextureEnabled(void)
763 GLboolean isEnabled1D= GL_FALSE, isEnabled2D= GL_FALSE;
764 glGetBooleanv( GL_TEXTURE_1D, &isEnabled1D );
765 glGetBooleanv( GL_TEXTURE_2D, &isEnabled2D );
766 return isEnabled1D || isEnabled2D;
769 /*----------------------------------------------------------------------*/
771 void SetTextureModulate(TextureID ID)
773 if (!IsTextureValid(ID)) return;
775 textab(ID).Light = GL_MODULATE;
778 /*----------------------------------------------------------------------*/
780 void SetTextureDecal(TextureID ID)
782 if (!IsTextureValid(ID)) return;
784 textab(ID).Light = GL_DECAL;
787 /*----------------------------------------------------------------------*/
789 void SetTextureClamp(TextureID ID)
791 if (!IsTextureValid(ID)) return;
793 textab(ID).Wrap = GL_CLAMP;
796 /*----------------------------------------------------------------------*/
798 void SetTextureRepeat(TextureID ID)
800 if (!IsTextureValid(ID)) return;
802 textab(ID).Wrap = GL_REPEAT;
805 /*----------------------------------------------------------------------*/
807 /* gestion de la facon d'appliquer la texture */
808 void SetModeObject(TextureID ID, const GLfloat sparams[4], const GLfloat tparams[4])
810 if (!IsTextureValid(ID)) return;
812 textab(ID).Gen = GL_OBJECT_LINEAR;
813 if (sparams != NULL) memcpy(textab(ID).Plane1, sparams, sizeof(sgenparams));
814 else memcpy(textab(ID).Plane1, sgenparams, sizeof(sgenparams));
816 if (texdata(textab(ID).data).status != TEXDATA_1D) {
817 if (tparams != NULL) memcpy(textab(ID).Plane2, tparams, sizeof(tgenparams));
818 else memcpy(textab(ID).Plane2, tgenparams, sizeof(tgenparams));
822 /*----------------------------------------------------------------------*/
824 void SetModeSphere(TextureID ID)
826 if (!IsTextureValid(ID)) return;
828 textab(ID).Gen = GL_SPHERE_MAP;
831 /*----------------------------------------------------------------------*/
833 void SetModeEye(TextureID ID, const GLfloat sparams[4], const GLfloat tparams[4])
835 if (!IsTextureValid(ID)) return;
837 textab(ID).Gen = GL_EYE_LINEAR;
838 if (sparams != NULL) memcpy(textab(ID).Plane1, sparams, sizeof(sgenparams));
839 else memcpy(textab(ID).Plane1, sgenparams, sizeof(sgenparams));
841 if (texdata(textab(ID).data).status != TEXDATA_1D) {
842 if (tparams != NULL) memcpy(textab(ID).Plane2, tparams, sizeof(tgenparams));
843 else memcpy(textab(ID).Plane2, tgenparams, sizeof(tgenparams));
847 /*----------------------------------------------------------------------*/
849 void SetModeManual(TextureID ID)
851 if (!IsTextureValid(ID)) return;
853 textab(ID).Gen = GL_NONE;
856 /*----------------------------------------------------------------------*/
858 void SetRenderNearest(TextureID ID)
860 if (!IsTextureValid(ID)) return;
862 textab(ID).Render = GL_NEAREST;
865 /*----------------------------------------------------------------------*/
867 void SetRenderLinear(TextureID ID)
869 if (!IsTextureValid(ID)) return;
871 textab(ID).Render = GL_LINEAR;
874 /*----------------------------------------------------------------------*/
876 void SetTexturePosition(TextureID ID,
877 GLfloat scalex, GLfloat scaley,
878 GLfloat transx, GLfloat transy,
881 textab(ID).scalex = scalex;
882 textab(ID).scaley = scaley;
883 textab(ID).transx = transx;
884 textab(ID).transy = transy;
885 textab(ID).angle = angle;
888 /*----------------------------------------------------------------------*/
890 void SetTextureDefaultParams(TextureID ID)
892 if (!IsTextureValid(ID)) return;
895 printf("SetTextureDefaultParams::set parm par defaut textures\n");
899 textab(ID).scalex = 1.0;
900 textab(ID).scaley = 1.0;
901 textab(ID).transx = 0.0;
902 textab(ID).transy = 0.0;
903 textab(ID).angle = 0.0;
905 textab(ID).Gen = GL_OBJECT_LINEAR;
906 textab(ID).Light = texdata(textab(ID).data).status == TEXDATA_1D ? GL_DECAL : GL_MODULATE;
907 textab(ID).Wrap = texdata(textab(ID).data).status == TEXDATA_1D ? GL_CLAMP : GL_REPEAT;
908 memcpy(textab(ID).Plane1, sgenparams, sizeof(sgenparams));
909 memcpy(textab(ID).Plane2, tgenparams, sizeof(tgenparams));
910 textab(ID).Render = texdata(textab(ID).data).status == TEXDATA_1D ? GL_NEAREST : GL_LINEAR;
913 /*----------------------------------------------------------------------*/
914 /* Transfere de donnee des donnees internes a la structure TransferData */
915 void TransferTexture_To_Data(TextureID ID, TextureData *TransfDt)
918 strcpy(TransfDt->path, texdata(textab(ID).data).imageFileName);
919 TransfDt->gen = textab(ID).Gen;
920 TransfDt->wrap = textab(ID).Wrap;
921 TransfDt->render = textab(ID).Light;
922 TransfDt->scalex = textab(ID).scalex;
923 TransfDt->scaley = textab(ID).scaley;
924 TransfDt->transx = textab(ID).transx;
925 TransfDt->transy = textab(ID).transy;
926 TransfDt->angle = textab(ID).angle;
927 memcpy(TransfDt->plane1, textab(ID).Plane1, sizeof(SizeType));
928 memcpy(TransfDt->plane2, textab(ID).Plane2, sizeof(SizeType));