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

  • Home
  • SEARCH
  • 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 317635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:29:44+00:00 2026-05-12T08:29:44+00:00

I have some problems mapping a texture to a triangle strip. I think I

  • 0

I have some problems mapping a texture to a triangle strip. I think I still don’t fully understand the texture coordinates.

I have a 512×512 texture, and I’m trying to map the 320×64 part of it on a triangle strip.

Here is my code:

static const Vertex3D bg_vertex [] = 
{
    {  0,    0,     0}, {  0,   64,     0}, { 64,    0,     0},
    { 64,   64,     0}, {128,    0,     0}, {128,   64,     0},
    {192,    0,     0}, {192,   64,     0}, {256,    0,     0},
    {256,   64,     0}, {320,    0,     0}, {320,   64,     0}
};

static const GLfloat bg_texcoords [] =
{
    {1.000, 0.000}, {1.000, 0.125}, {0.875, 0.000}, {0.875, 0.125}, {0.750, 0.000}, {0.750, 0.125},
    {0.625, 0.000}, {0.625, 0.125}, {0.500, 0.000}, {0.500, 0.125}, {0.375, 0.000}, {0.375, 0.125}
};

glBindTexture (GL_TEXTURE_2D, bg1Texture);
glEnable(GL_TEXTURE_2D);

glColor4f (1.0, 1.0, 1.0, 1.0);
glTexCoordPointer(2, GL_FLOAT, 0, bg_texcoords);
glVertexPointer(3, GL_FLOAT, 0, &bg_vertex);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 12);

When I run the code, it displays a distorted image of the original texture on the triangle strips.

Can someone please tell me what am I doing wrong?

Thanks

  • 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-12T08:29:44+00:00Added an answer on May 12, 2026 at 8:29 am

    OK, it works now when I removed the extra braces from the texture coordinates:

    static const GLfloat bg_texcoords [] =
    {
        1.000, 0.000, 1.000, 0.125, 0.875, 0.000, 0.875, 0.125, 0.750, 0.000, 0.750, 0.125,
        0.625, 0.000, 0.625, 0.125, 0.500, 0.000, 0.500, 0.125, 0.375, 0.000, 0.375, 0.125
    };
    

    Now it maps the texture perfectly on the triangles

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

Sidebar

Related Questions

I discovered to have some problem to fully understand callbacks scoping when trying to
I have been having some problems trying to get my PHP running. When I
I'm trying to build my first generic list and have run into some problems.
I have just started learning Erlang and am trying out some Project Euler problems
I have some problems with Miktex installed on Windows Vista Business SP1/32 bit. I
I have some problems on a site with the concurrent access to a list.
I am very new to C and I have some problems learning about pointers.
I have only installed Ruby1.9 on my machine. Have some kind of problems with
Looking for some direction here as I'm running into some migration problems. We have
Here's my problem - I have some code like this: <mx:Canvas width=300 height=300> <mx:Button

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.