Adding textures
BlitzMax Forums/BlitzMax Beginners Area/Adding textures
| ||
Hi, This is a quick question. Theres a DrawPoly command, but I cant seem to see a way of adding a texture to the polygon. Is it possible? (I know you can with OpenGL but I aint got a clue about how to use it). Cheers sin |
| ||
Someone made a texture poly module thing somewhere here. To do it in GL you need to first have a texture uploaded. You might be able to use Max to do that for you, like use the helper function to convert a pixmap to a texture and get the handle of it. Then use glBindTexture(handle) to select it. Then you do something like: glBegin(GL_QUADS) (or GL_TRIANGLES etc) 'Put all your GL commands in here glEnd() The command to put in there are pairs of glTexCoords2f() (which range from 0.0 to 1.0), and glVertex2f(). ie glEnable(GL_Texture2D) 'not sure exact name glBegin(GL_QUADS) glTexCoords2f(0,0); glVertex2f(50,50) glTexCoords2f(0,1); glVertex2f(100,50) glTexCoords2f(1,1); glVertex2f(100,100) glTexCoords2f(1,0); glVertex2f(50,100) glEnd() Something like that will draw a textured rectangle. You may have to break your big polygon into triangles or strips of them. (this isn't accurate info, just a starter) |