Ferret Posted December 30, 2011 Share 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! Link to comment Share on other sites More sharing options...
Clackdor Posted December 30, 2011 Share Posted December 30, 2011 What happens when you DrawRect();? Quote Link to comment Share on other sites More sharing options...
Ferret Posted December 30, 2011 Author Share 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! Link to comment Share on other sites More sharing options...
DaDonik Posted December 31, 2011 Share 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) Link to comment Share on other sites More sharing options...
ParaToxic Posted December 31, 2011 Share 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 Link to comment Share on other sites More sharing options...
Ferret Posted December 31, 2011 Author Share 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! Link to comment Share on other sites More sharing options...
Ferret Posted January 1, 2012 Author Share 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! Link to comment Share on other sites More sharing options...
Ferret Posted January 4, 2012 Author Share 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! Link to comment Share on other sites More sharing options...
Aily Posted January 4, 2012 Share 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" Link to comment Share on other sites More sharing options...
Josh Posted January 4, 2012 Share 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. Link to comment Share on other sites More sharing options...
Ferret Posted January 6, 2012 Author Share Posted January 6, 2012 Got it, thx! Quote JFerret Design - Free Games and Resources! Link to comment Share on other sites More sharing options...
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.