1
\$\begingroup\$

Say I have the following image: Image

I want to resize this texture, so I can have resizable buttons with a texture. Now, as you can't repeat a certain area of an image in OpenGL, I have to create a new texture from the center (from (0.1f, 0.1f) to (0.9f, 0.9f) in texture coordinates.

How can I create a new texture from the inside of this image using the Slick library?

\$\endgroup\$
  • 2
    \$\begingroup\$ I wouldn't do it in OpenGL just create a org.newdawn.slick.Image and then getSubImage(int x, int y, int width, int height) method. If you use shaders you can of course always just calculate the texture coordinate transformation there without making copies of the region (but then you'd have to deal with other issues like texture filtering artifacts interfering with the tiling). \$\endgroup\$ – PeterT Sep 11 '13 at 2:49
  • 1
    \$\begingroup\$ It would be best if I could gt those subImages, and merge them to 1 image with the correct size. So far I have not been able to merge several textures to 1. Any ideas? \$\endgroup\$ – Basaa Sep 11 '13 at 10:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.