56 glGenTextures(1, &
id);
57 glBindTexture(GL_TEXTURE_2D,
id);
58 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
59 i->getWidth(), i->getHeight(), 0,
60 GL_RGBA, GL_UNSIGNED_BYTE, i->getData());
61 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
62 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
63 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
64 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
65 glBindTexture(GL_TEXTURE_2D, 0);
82 glEnable(GL_TEXTURE_2D);
83 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
84 glDisable(GL_CULL_FACE);
86 glDisable(GL_LIGHTING);
87 glDisable(GL_COLOR_MATERIAL);
88 glDisable(GL_TEXTURE_GEN_S);
89 glDisable(GL_TEXTURE_GEN_T);
90 glDisable(GL_ALPHA_TEST);
92 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
93 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
94 glBindTexture(GL_TEXTURE_2D, which);
95 glBegin(GL_TRIANGLE_STRIP);
97 glVertex2d(sizeX1, sizeY1);
99 glVertex2d(sizeX1, sizeY2);
101 glVertex2d(sizeX2, sizeY1);
103 glVertex2d(sizeX2, sizeY2);
105 glBindTexture(GL_TEXTURE_2D, 0);
106 glEnable(GL_DEPTH_TEST);
static GUIMainWindow * getInstance()
get instance
static void drawTexturedBox(int which, double size)
Draws a named texture as a box with the given size.
static bool myAllowTextures
whether textures are drawn
static std::map< std::string, int > myTextures
mapping from image paths to decals (initialization on first use)
static GUIGlID add(FXImage *i)
Adds a texture to use.
static int getTextureID(const std::string &filename, const bool mirrorX=false)
return texture id for the given filename (initialize on first use)
static int getMaxTextureSize()
return maximum number of pixels in x and y direction
static void clearTextures()
clears loaded textures