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 3404014
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:19:51+00:00 2026-05-18T05:19:51+00:00

I a bit stuck on tiling textures. Basically I want to to tile textures

  • 0

I a bit stuck on tiling textures. Basically I want to to tile textures when I transform an object. So a 1x1x1 square when I glScale to 20,20,20, I would like the texture to tile. The texture is setup as a 1×1,

    - (void)loadTextures:(NSString *)textureName andWithIndex:(int)index { 

 // load image as a CG ref 
 CGImageRef textureImage = [UIImage imageNamed:textureName].CGImage;
 // if failed, bail
 if (!textureImage) { 
  NSLog(@"Error: failed to load texture"); 
  return;
 }


 // figure out the width and height
 int texWidth = CGImageGetWidth(textureImage); 
 int texHeight = CGImageGetHeight(textureImage);

 // alloc space for the texture
 GLubyte *textureData = (GLubyte *)malloc(texWidth * texHeight * 4);

 // create a CA context ref
 CGContextRef textureContext = CGBitmapContextCreate( 
              textureData, texWidth, texHeight, 8, texWidth * 4, 
              CGImageGetColorSpace(textureImage),
              kCGImageAlphaPremultipliedLast
              );

 // draw the image to in-memory buffer
 CGContextDrawImage(textureContext, CGRectMake(0,0,texWidth,texHeight), textureImage);

 // done with context - release it
 CGContextRelease(textureContext); 

 // have GL create handle for our texture
 glGenTextures(1, &textures[index]); 

 // tell GL that the image is 2D
 glBindTexture(GL_TEXTURE_2D, textures[index]);

 // send our data down to GL, copy into graphics hardware
 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texWidth, texHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, textureData);

 // free our in-memory copy of the data
 free(textureData);

 // specify min/max filters
 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

 // tell GL to turn on textures
 glEnable(GL_TEXTURE_2D); 
}
  • 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-05-18T05:19:51+00:00Added an answer on May 18, 2026 at 5:19 am
    glMatrixMode(GL_TEXTURE);
    glLoadIdentity();
    glScalef(20,20,1);
    glMatrixMode(GL_MODELVIEW);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a bit stuck on this. Basically I want to do something like the
I am a bit stuck on the design of my seo friendly urls for
A bit new with WPF...It seems like not matter what I change with horizontal
Bit stuck about how to go about this one. Given the current month, I
bit stuck try to achieve something in Jquery and wondered if anyone can assist..
I'm a bit stuck with my code: def setVenueImage(img): img = images.Image(img.read()) x, y
I'm a bit stuck on what is probably a common situation, but can't find
I'm a bit stuck on the last step of getting the solution to problem
I am a bit stuck with this. I have to interface with an api
I'm a bit stuck trying to get my code to output correctly, see below.

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.