Textured Polygon
BlitzMax Forums/BlitzMax Programming/Textured Polygon
| ||
The TexturedPoly Func works perfectly now that the Ints have been changed to Floats, thanks warpy. Just one thing though, I noticed that the line,DrawImage tmpImage, -100, - 100 ' Chtob zbit' flag texturi at the end of the 'DrawTexturedPolyOGL' function is there to correct a colour problem? Without this call to DrawImage the colours go screwy and are to dark. I managed to hide the image behind my poly tiles, which is fine except this extra call to DrawImage is an overhead my code could do without. Even tried checking the 'glmax2D' mod to try found out how drawimage is correcting the colour,without any luck! Does anyone have any idea how to correct the colour without having to use DrawImage? I thought of drawing all the tiles first them calling DrawImage to correct the colour, but Im making an Iso map, so need to layer my tiles with Bmps,so am forced to make the extra DrawImage function call each tile draw to corret the colour first. |
| ||
Interesting piece of code ! Don't know well at this point if all these specific drivers things will work on different hardware and if it's fast though. I'm wondering if adding repeated UV (tiled texture) is possible ? |
| ||
There is a bindTexture function for opengl that do the trick. Don't know about DX though. I get this here : http://blitzmax.com/Community/posts.php?topic=79462#894458 Function SetTextureRepeat(image:TImage) Local n:Int = image.seqs.Length Repeat n:-1 glBindTexture GL_TEXTURE_2D, TGLImageFrame(image.Frame(n)).name glTexParameteri GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT glTexParameteri GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT Until n < 1 End Function Then it's just a matter of setting higher than 1.0 the UV of the DrawTexturedPoly function :) EDIT: improved SetTextureRepeat to handle sequences frame TImage |
| ||
In fact there is a DX version, a complete SetTextureRepeat and DrawTexturedPoly here : http://blitzmax.com/Community/posts.php?topic=79234#889717 I don't know why but the second one corrupt my viewport with white Lightblend stuff. So I choose your version of DrawTexturedPoly with the second SetTextureRepeat |
| ||
I don't know why but the second one corrupt my viewport with white Lightblend stuff. It does?I can't seem to recreate the the problem here. Got any example code? |
| ||
Hard to reproduce since it's inside the main code of my game but I will try. I probably miss a graphic specific setting somewhere. |
| ||
I didn't see it at first glance but as my game use pixel art assets the Const scale#=1.28 obviously scale every pixels. Just set it up to 1.0 and things are greats again :) |