Simple texture mapping example needed

BlitzMax Forums/OpenGL Module/Simple texture mapping example needed

jhague(Posted 2007) [#1]
Embarrassingly, I'm failing to get textured polygons on the screen. I have experience with OpenGL, and I've carefully walked through my code and verified it against the Red Book. Everything is fine, except no textures.

I've also walked through the OpenGL code in the standard Blitz modules, to make sure I'm not missing any Blitz-isms. I even grabbed NeHe tutorial #6 (texture mapping), modified it to work with the latest Blitz (removed FlushMem, changed bgl function names), and I don't see any texture mapping there either.

I'm starting to suspect that something is going on behind the scenes, so if anyone has a super simple, working example of texture mapping in OpenGL, please post the code. Thanks.


ImaginaryHuman(Posted 2007) [#2]
Post your code.


ImaginaryHuman(Posted 2007) [#3]
Post your code.


jhague(Posted 2007) [#4]
I figured out what's going on, though I don't have a fix yet.

my_texture = GLTexFromPixmap(pixmap)

works fine. The second parameter (indicating if mip-maps should be generated) defaults to true. When I set it to false:

GLTexFromPixmap(pixmap, false)

then the resulting texture is a solid color. That My's the reason my texture mapping was broken. I verified this on both OS X and Windows XP with different video cards, so it looks like a Blitz issue. I'll see if I can come up with a fix and report back.

UPDATE: This looks like the classic OpenGL problem of not changing the default filter from GL_NEAREST_MIPMAP_LINEAR when you don't have mipmaps. I forgot all about this. Argh.