Ferret Posted December 30, 2011 Posted December 30, 2011 How do i draw to a texture? This is what i'm trying to do, window.Image is TTexture window.Image = CreateTexture(window.Width,window.Height) SetBuffer(window.Image) Then i want to draw a rect to it. Quote JFerret Design - Free Games and Resources!
Ferret Posted December 30, 2011 Author Posted December 30, 2011 I get an error when i try to set the buffer saying that its not a TBuffer. Quote JFerret Design - Free Games and Resources!
DaDonik Posted December 31, 2011 Posted December 31, 2011 Well a TTexture simply is not a TBuffer. what about: DrawImage Quote (Win7 64bit) && (i7 3770K @ 3,5ghz) && (16gb DDR3 @ 1600mhz) && (Geforce660TI)
ParaToxic Posted December 31, 2011 Posted December 31, 2011 Have you tried to create a TBuffer and set with SetBufferColor (or SetColorBuffer actually i don't know) and set Buffer? Quote
Ferret Posted December 31, 2011 Author Posted December 31, 2011 What i want to do is create an image from scratch and draw on it. I also want to redraw the image when needed. Pseudo code: CreateImage() SetBuffer(Image) DrawRect() SetBuffer(BackBuffer) DrawImage() How do i do this in LE, any examples floating around? Quote JFerret Design - Free Games and Resources!
Ferret Posted January 1, 2012 Author Posted January 1, 2012 Got it to work I created a buffer and linked a texture to it using SetColorBuffer, like ParaToxic said. Quote JFerret Design - Free Games and Resources!
Ferret Posted January 4, 2012 Author Posted January 4, 2012 This is the result, wip. But have another problem with the text when i draw it to a texture. Quote JFerret Design - Free Games and Resources!
Aily Posted January 4, 2012 Posted January 4, 2012 This is the result, wip. But have another problem with the text when i draw it to a texture. You need to flip by Y DrawImage(texture, 0 , Y , X , -Y ) Quote "Better" is big enemy of "good"
Josh Posted January 4, 2012 Posted January 4, 2012 The y coordinate gets flipped when you draw to a buffer. This has to do with the way the underlying graphics API works. In Leadwerks3D, the engine will detect these cases and correct them automatically, but for Leadwerks Engine do this: DrawImage x,y+height,width,-height Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Ferret Posted January 6, 2012 Author Posted January 6, 2012 Got it, thx! Quote JFerret Design - Free Games and Resources!
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.