How to load texture in OpenGL
BlitzMax Forums/BlitzMax Programming/How to load texture in OpenGL
| ||
Can someone please show me an example of how to texture a OpenGL object. I tryed to look at the MAXCube example, but didnīt get any wiser :( Thanks Sveinung |
| ||
glBindTexture i think max has some kinda inbuilt shortcut to loading gl textures bglTexFromPixmap( pixmap:TPixmap,mipmap=True ) Helper function to create a texture from a pixmap ^ im gonna take a guess as i cant actually try it, that you can glbindtexture with the returned int (yay or nay im not sure yet) |
| ||
Yep, that's correct. Use LoadPixmap to, erm, load a pixmap first. |
| ||
I have done that, but still no texturemap. My code look something like this: tex01 = loadpixmap("rock.png") glbindtexture(GL_TEXTURE_2D, bgltexfrompixmap(tex01)) glenable GL_TEXTURE_2D Then I bind this to the quad.... What am I doing wrong? Regards Sveinung |
| ||
got your texture coords correct on the quad? |
| ||
I think so. I have taken the coords from my PureBasic code, works fine there. But I use the command glTexImage2D(GL_TEXTURE_2D, 0, 3, Width, Height, 0, GL_BGR_EXT, GL_UNSIGNED_BYTE, ImageData+PeekL(ImageData+10)). This is not in my BM code, and I havent found it used in any of the examples. I thought this line was needed, but I'm not sure. BTW thanks for the help so fare! regards Sveinung |
| ||
Looks OK to me. Can you post more code? |