Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Draw only a part of the texture (ie. image)


Recommended Posts

Hello! Would it be possible in LE to draw only a part of the image on the screen (via context). I mean, let's say I have a 256 x 256 texture with four 64 x 64 frames. Now, I would like to be able to draw, for example, a part of the image with following specs: x = 64, y = 0, w = 64, h = 64.

 

I'm asking that because I'm building a basic 2d graphics lib and would like to implement animation in more elegant manner: right now, I'm just loading bunch of textures as frames, which is cumbersome and not quite efficient from renderer's point of view.

 

Thank you.

Link to post

I've adapted your shader to my needs. However, I do not see how to clip the image: image just wraps. I see that you use "zoom" in order to clip the rest of the image. However, I want a non scaled part of the image. Any ideas?

 

Btw, I can't find Shadmar's shader that you're talking about. Could you please direct me where to find it?

Link to post

@gamecreator Thank you! The mask will be very handy for my lib.

 

However, neither of what you've said does not correspond to my needs. Firstly, clamping only stretches the last pixel of the texture to it's borders. Secondly, Shadmar made a masking shader and not a shader to draw a part of the image. Althoug, I can use it for those needs, it's complicated and costly workaround. There should be a much simpler way.

Link to post

@shadmar Thank you! Will try to decipher it, since I'm noob in regards to shaders smile.png

 

Anyway, can I (ab)use this opportunity to ask you what happens to your water prefab? I've downloaded it from here, but the water does not seem to move. Just sits there...

 

EDIT The water does not seem to like postprocessor effects. When I turn them off, everything is as expected. Is there a way to have a water with postprocessor effects?

Link to post

Hmmm... Besides the water texture in Materials/Water folder, textures in Materials/Effects/Water and water shaders in Shaders/Water folder, I really don't see any prefab/entity/material that would be connected to water. And there is no tutorial how to make water. Could you give me, please, any lead?

Link to post

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Facebook Twitter Youtube Github Steam
×
×
  • Create New...