Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8873317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:26:08+00:00 2026-06-14T18:26:08+00:00

I have a texture and the rectangle. I want repeat the texture on that

  • 0

I have a texture and the rectangle.

I want repeat the texture on that rectangle. But only a part of it.

Let say I want to use texture coordinates from 0.25 to 0.75 on X and Y and repeat it 2 times.

If I set the coords of the rectangle’s vertexes to:

(0.25, 0.25)
(0.25, 0.75 * 2)
(0.75 * 2, 0.25)
(0.75 * 2, 0.75 * 2)

That will not repeat texture from 0.25 to 0.75 two times, but will produce texture from 0.25 to 1.0 and from 1.0 to 0.25, which is different.

How to achieve my goal, not changing the texture, using part of it and repeat only that part?

Note that I don’t want to add more vertexes to the rectangle.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T18:26:09+00:00Added an answer on June 14, 2026 at 6:26 pm

    Its pretty easy to achieve with fragment shader:

    float scale;
    float offset;
    
    sampler2D baseMap;
    
    struct PS_INPUT 
    {
       float2 Texcoord : TEXCOORD0;
    
    };
    
    float4 ps_main( PS_INPUT Input ) : COLOR0
    {
       float2 tc =  fmod(Input.Texcoord, scale) + float2(offset, offset);
       return tex2D( baseMap, tc);
    
    }
    

    This shader is symmetrical so lookup window moves along diagonal. But you can apply own offset and scale to each texture coordinate component separately then window will move totally freely.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a texture manager that I am running as singleton, and wish to
What I currently have: Generating of texture coordinates given the width and height of
i have a 1024 x 1024 image I use for a texture in my
i have a GLSurfaceView, that has a texture that i need to change when
Lets say i have a rectangle Now i wish to apply it transformations such
Sorry if my question is uncleared. Let me elaborate. I have a rectangle of
I have a number of spherical longitude/latitude coordinates for points on a sphere that
I have a vertex/fragment shader that draws a rectangle performing many calculations based on
Say that I have this interface: interface Drawable { Vector2 DrawPosition { get; }
I created a GuiWindow class that held a texture, title, and rectangle so I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.