0022337: V3d_View::Print crashes in OCCT 6.5.0
[occt.git] / src / OpenGl / OpenGl_TextureBox.hxx
CommitLineData
7fd59977 1/*
2* Fonction
3* ~~~~~~~~
4* Gestion des textures sous OpenGL
5*
6*
7* Notes
8* ~~~~~
9* Les textures sont toujours initialisee avec des parametres par defaut
10* texture 1D: WRAP_S = CLAMP
11* MAG_FILTER = NEAREST
12* generation de texture automatique en OBJECT_LINEAR
13* rendu avec DECAL
14*
15* texture 2D: WRAP_S/T = REPEAT
16* MAG/MIN_FILTER = LINEAR
17* generation de texture automatique en OBJECT_LINEAR
18* rendu avec MODULATE
19*
20* texture 2D MipMap: WRAP_S/T = REPEAT
21* MAG_FILTER = LINEAR
22* MIN_FILTER = LINEAR_MIPMAP_NEAREST
23* generation de texture automatique en OBJECT_LINEAR
24* rendu avec MODULATE
25*
26*
27* Attention:
28* ~~~~~~~~~~~
29* Ce package a ete teste sur SGI, OSF, SUN, HP et WNT.
30*
31*
32* Historique des modifications
33* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34* 22-05-97: PCT ; creation
35* 01-08-97: PCT ; suppression InitializeTextureBox()
36* 05-08-97: FMN ; ajout GetTextureData...
37* 19-06-98: FMN ; Portage Optimizer (C++)
38* 22-07-98: FGU ; ajout stucture TextureData
39*/
40/*----------------------------------------------------------------------*/
41
42#ifndef _OPENGL_TEXTUREBOX_H_
43#define _OPENGL_TEXTUREBOX_H_
44
45/*----------------------------------------------------------------------*/
46/*
47* Includes
48*/
49
50#include <OpenGl_tgl_all.hxx>
51
52#include <GL/gl.h>
53
54
55/*----------------------------------------------------------------------*/
56/*
57* Constantes
58*/
59
60typedef int TextureID;
61#define TEXTUREBOX_ERROR ((TextureID)-1)
62
63/*
64* Structure
65*/
66struct _TextureData
67{
68 /* Donnees propre au fichier */
69 char path[256];
70
71 /* Donnees propre a la texture */
72 GLint gen;
73 GLint wrap;
74 GLfloat plane1[4], plane2[4];
75 GLint render;
76 GLfloat scalex, scaley;
77 GLfloat transx, transy;
78 GLfloat angle;
79 IMPLEMENT_MEMORY_OPERATORS
80};
81typedef _TextureData TextureData;
82
83/*----------------------------------------------------------------------*/
84/*
85* Prototypes
86*/
87
88/*
89* Gestion des textures
90*/
91
92/* Get texture a partir d'un nom de fichier */
93TextureID GetTexture1D(char *FileName);
94TextureID GetTexture2D(char *FileName);
95TextureID GetTexture2DMipMap(char *FileName);
96
97/* Get texture a partir des donnees (format RGBA) GLubyte data[width][height][4]
98* Le nom est utiliser pour la gesiton en interne, il permet d'eviter de charger
99* plusieurs textures avec le meme noms.
100*/
101TextureID GetTextureData1D(char *FileName, const GLint width, const GLint height, const void *data);
102TextureID GetTextureData2D(char *FileName, const GLint width, const GLint height, const void *data);
103TextureID GetTextureData2DMipMap(char *FileName, const GLint width, const GLint height, const void *data);
104
105void FreeTexture(TextureID ID);
106
107void SetCurrentTexture(TextureID ID);
108GLboolean IsTextureValid(TextureID ID);
109
110void EnableTexture(void);
111void DisableTexture(void);
112GLboolean IsTextureEnabled(void);
113
114/*
115* Configuration d'une texture
116*/
117
118void SetTextureModulate(TextureID ID);
119void SetTextureDecal(TextureID ID);
120
121void SetTextureClamp(TextureID ID);
122void SetTextureRepeat(TextureID ID);
123
124void SetModeObject(TextureID ID, GLfloat sparams[4], GLfloat tparams[4]);
125void SetModeSphere(TextureID ID);
126void SetModeEye(TextureID ID, GLfloat sparams[4], GLfloat tparams[4]);
127void SetModeManual(TextureID ID);
128
129void SetRenderNearest(TextureID ID);
130void SetRenderLinear(TextureID ID);
131
132
133void SetTexturePosition(TextureID ID,
134 GLfloat scalex, GLfloat scaley,
135 GLfloat transx, GLfloat transy,
136 GLfloat angle);
137
138
139void SetTextureDefaultParams(TextureID ID);
140
141void TransferTexture_To_Data(TextureID, TextureData *);
142void TransferData_To_Texture(TextureData*, TextureID*);
143
144/*----------------------------------------------------------------------*/
145
146#endif /* _OPENGL_TEXTUREBOX_H_ */