43 #ifdef CHECK_MEMORY_LEAKS 45 #endif // CHECK_MEMORY_LEAKS 61 glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max);
69 glGenTextures(1, &
id);
70 glBindTexture(GL_TEXTURE_2D,
id);
71 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
72 i->getWidth(), i->getHeight(), 0,
73 GL_RGBA, GL_UNSIGNED_BYTE, i->getData());
74 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
75 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
76 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
77 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
78 glBindTexture(GL_TEXTURE_2D, 0);
96 glEnable(GL_TEXTURE_2D);
97 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
98 glDisable(GL_CULL_FACE);
100 glDisable(GL_LIGHTING);
101 glDisable(GL_COLOR_MATERIAL);
102 glDisable(GL_TEXTURE_GEN_S);
103 glDisable(GL_TEXTURE_GEN_T);
104 glDisable(GL_ALPHA_TEST);
106 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
107 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
108 glBindTexture(GL_TEXTURE_2D, which);
109 glBegin(GL_TRIANGLE_STRIP);
111 glVertex2d(sizeX1, sizeY1);
113 glVertex2d(sizeX1, sizeY2);
115 glVertex2d(sizeX2, sizeY1);
117 glVertex2d(sizeX2, sizeY2);
119 glBindTexture(GL_TEXTURE_2D, 0);
120 glEnable(GL_DEPTH_TEST);
130 i->mirror(
false,
true);
137 WRITE_ERROR(
"Could not load '" + filename +
"'.\n" + e.what());
static GUIGlID add(FXImage *i)
Adds a texture to use.
static std::map< std::string, int > myTextures
mapping from image paths to decals (initialization on first use)
static void clearTextures()
clears loaded textures
static FXbool scalePower2(FXImage *image, int maxSize=(2<< 29))
static GUIMainWindow * getInstance()
static int getTextureID(const std::string &filename, const bool mirrorX=false)
return texture id for the given filename (initialize on first use)
static bool myAllowTextures
whether textures are drawn
static FXImage * loadImage(FXApp *a, const std::string &file)
static int getMaxTextureSize()
return maximum number of pixels in x and y direction
static void drawTexturedBox(int which, SUMOReal size)
Draws a named texture as a box with the given size.