Still haven't got it locked down - not quite scaling properly - problem somewhere in my script - working on it.
Thought it would simply require dividing by image size - will have to think about this.
Surprised that scaling the texture using your effect was no faster that my primitive approach using separate image fragment for each quad.
Textured Polygons for All!
- xXxMoNkEyMaNxXx
- Party member
- Posts: 206
- Joined: Thu Jan 10, 2013 6:16 am
- Location: Canada
Re: Textured Polygons for All!
It's because your image splitting is pre-processing, and the image scaling was already going on with no effect.
Scaling is obviously more memory efficient though. Could I ask for details on what you're having problems with? I'd like to help.
Scaling is obviously more memory efficient though. Could I ask for details on what you're having problems with? I'd like to help.
Re: Textured Polygons for All!
You are most generous. I know hard it is to read other peoples code when not well written.xXxMoNkEyMaNxXx wrote:It's because your image splitting is pre-processing, and the image scaling was already going on with no effect.
Scaling is obviously more memory efficient though. Could I ask for details on what you're having problems with? I'd like to help.
The demo I posted before (surface_texturing.love) provided the effect I was aiming for.
It was crude and I felt that your pixel effect already provided the same effect more efficiently via 'po' and 'res' settings.
What I did was to strip out from my demo the creation on new images for each quad and tried to add the appropriate scaling factor for 'po' and 'res'.
Removed:
Code: Select all
tmp = li.newImageData( tex.w, tex.h )
tmp:paste( master_image, 0, 0, tx[i], ty[j], tex.w, tex.h ) -- where tx & ty are location on image
img[j][i] = gr.newImage(tmp) -- image to apply to corresponding quad
Code: Select all
fragments[j][i] = { tx[i], ty[i], tex.w, tex.h }
Net effect:
1. resulting pattern not textured the same as the original demo.
2. the display of the unmodified image (simple love.draw without any effects) disapears after the first frame and is replaced by a single line of characters(very small to the right of the main image)?????? - something completely unrelated and which work fine in original demo??? (Never seen before!)
If you are up to the challenge - great but really can't expect you to as I have bastardized you code.
Thanks anyway.
- Attachments
-
- surface_texture_effect.love
- Modified surface_texturing demo showing problems
- (19.08 KiB) Downloaded 208 times
- xXxMoNkEyMaNxXx
- Party member
- Posts: 206
- Joined: Thu Jan 10, 2013 6:16 am
- Location: Canada
Re: Textured Polygons for All!
Why don't you ever use local variables....................
All the equals signs are lined up, it took me ages to find 'cd'
The ends are tabbed in....................
Where did you pick up this terrible habit? ._.
/rage
Are you putting equal portions of the texture into each quad? because the quads themselves are already distorting the image.
All the equals signs are lined up, it took me ages to find 'cd'
The ends are tabbed in....................
Where did you pick up this terrible habit? ._.
/rage
Are you putting equal portions of the texture into each quad? because the quads themselves are already distorting the image.
Re: Textured Polygons for All!
You were warned!
'rep' is receiving { tex.w, tex.h } for each quad so yes - all quads are receiving the same portion of the image.
Only 'op' is being changed.
Think problem is related to how image coordinates are being converted to fractions of the image.
Don't have a clew are to why effect changes love.draw outside pixel effect.
Thanks for looking.
Edit1:
Code is sub-alpha. Only looking for function.
Headed for: tex.draw(texture,quad,tex)
where texture = an image, quad contains 4 vertices & tex contains tex.x, tex,y, tex.width & tex.height
Got first two with only tex remaining.
Regarding coding style, it's called outlining where the most important info is displayed farest to left. Taught in grade school. Obviously, 'end' is not a topic so shouldn't be emphasized. For a final product I generally resort to the lemming style. GLSL syntax seems sub-human after coding in Lua.
Edit2:
OK! Confirmed that you effect functions as advertized. Great job! ~20% faster than my demo.
All a matter of properly converting image coordinates to fractions and insuring that everything stays in bounds - not as simple (until you figure it out) as it might seem. Now to see if there isn't a better (cleaner) way -"So annoying".
Still a mystery as to why the plain image drawn after using your code is corrupted (now a string of characters).
If I load a separate copy of the original image and draw it, everything is displayed appropriately????
'rep' is receiving { tex.w, tex.h } for each quad so yes - all quads are receiving the same portion of the image.
Only 'op' is being changed.
Think problem is related to how image coordinates are being converted to fractions of the image.
Don't have a clew are to why effect changes love.draw outside pixel effect.
Thanks for looking.
Edit1:
Code is sub-alpha. Only looking for function.
Headed for: tex.draw(texture,quad,tex)
where texture = an image, quad contains 4 vertices & tex contains tex.x, tex,y, tex.width & tex.height
Got first two with only tex remaining.
Regarding coding style, it's called outlining where the most important info is displayed farest to left. Taught in grade school. Obviously, 'end' is not a topic so shouldn't be emphasized. For a final product I generally resort to the lemming style. GLSL syntax seems sub-human after coding in Lua.
Edit2:
OK! Confirmed that you effect functions as advertized. Great job! ~20% faster than my demo.
All a matter of properly converting image coordinates to fractions and insuring that everything stays in bounds - not as simple (until you figure it out) as it might seem. Now to see if there isn't a better (cleaner) way -"So annoying".
Still a mystery as to why the plain image drawn after using your code is corrupted (now a string of characters).
If I load a separate copy of the original image and draw it, everything is displayed appropriately????
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Textured Polygons for All!
Thanks to MonkeyMan I now have texture support...
Had to do some recoding and fixing and there was a lot of touch and go for a while, but we pulled through.
Edit: Some problems I've found.
If you use love.graphics.translate() and love.graphics.scale() the image offsets to what it would be if translate and scale were not used.
And a new one, if you use setMode after the module is loaded, it will stop working. I have tried reloading it after resizing the window but it doesn't seem to want to reload itself. So I can't setMode after it's loaded or it will never work again... until it's restarted.
Had to do some recoding and fixing and there was a lot of touch and go for a while, but we pulled through.
Edit: Some problems I've found.
If you use love.graphics.translate() and love.graphics.scale() the image offsets to what it would be if translate and scale were not used.
And a new one, if you use setMode after the module is loaded, it will stop working. I have tried reloading it after resizing the window but it doesn't seem to want to reload itself. So I can't setMode after it's loaded or it will never work again... until it's restarted.
Re: Textured Polygons for All!
The pest is back.
Textured Polygons for All definitely WORKS with canvases!
Previous demo replaced with corrected (stupid error) one.
Textured Polygons for All definitely WORKS with canvases!
Previous demo replaced with corrected (stupid error) one.
- Attachments
-
- lena_effect_with_canvas.love
- Dumb test demo of texturing
- (353.63 KiB) Downloaded 230 times
Last edited by Ref on Sun Jan 27, 2013 4:49 pm, edited 1 time in total.
- xXxMoNkEyMaNxXx
- Party member
- Posts: 206
- Joined: Thu Jan 10, 2013 6:16 am
- Location: Canada
Re: Textured Polygons for All!
So you can't draw to a canvas? I don't really understand what's going on
Re: Textured Polygons for All!
And the Raycasting of floors and ceilings is waiting for texture support.
- xXxMoNkEyMaNxXx
- Party member
- Posts: 206
- Joined: Thu Jan 10, 2013 6:16 am
- Location: Canada
Re: Textured Polygons for All!
@IndieKid If you can get the positions on screen, it will put an image on it, so it should already support that... This basically replaces the part where you call love.graphics.polygon with a funtion that will draw the polygon and put an image on it.
Who is online
Users browsing this forum: No registered users and 11 guests