Vern Jensen
01-11-2012, 02:54 PM
Not sure if this is better in the beginners or advanced area, but here goes:
My game uses GL_TEXTURE_RECTANGLE_EXT to draw textures for a 2D sprite-based game. On systems where this is not supported, it has to use GL_TEXTURE_2D instead.
I was getting blank white rectangles instead of properly drawing textures until I added these calls immediately before creating the texture *and* before drawing it each time a texture is drawn:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
My understanding of these calls is that they should be something you just "set once" and then they should stay in effect. Why is it that I'd have to call these not only before the glTexImage2D() call when first creating the texture, but also before drawing the texture?
(If I call the above calls prior to drawing each texture, they draw blank white the very first time they are drawn, but then draw properly from then on out. This results in a flash of white for each texture the first time it is used.)
This behavior seems strange to me. Was wondering if anyone else could explain it?
(BTW yes, there is code in my game's engine to use power-of-2 textures when using TEXTURE_2D, and also to use proper coordinates from 0.0 to 1.0 instead of from 0 to width/height.)
My game uses GL_TEXTURE_RECTANGLE_EXT to draw textures for a 2D sprite-based game. On systems where this is not supported, it has to use GL_TEXTURE_2D instead.
I was getting blank white rectangles instead of properly drawing textures until I added these calls immediately before creating the texture *and* before drawing it each time a texture is drawn:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
My understanding of these calls is that they should be something you just "set once" and then they should stay in effect. Why is it that I'd have to call these not only before the glTexImage2D() call when first creating the texture, but also before drawing the texture?
(If I call the above calls prior to drawing each texture, they draw blank white the very first time they are drawn, but then draw properly from then on out. This results in a flash of white for each texture the first time it is used.)
This behavior seems strange to me. Was wondering if anyone else could explain it?
(BTW yes, there is code in my game's engine to use power-of-2 textures when using TEXTURE_2D, and also to use proper coordinates from 0.0 to 1.0 instead of from 0 to width/height.)