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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:50:45+00:00 2026-05-27T17:50:45+00:00

I am using OpenGL to draw textures in my game. glClear(GL_COLOR_BUFFER_BIT); float w =

  • 0

I am using OpenGL to draw textures in my game.

glClear(GL_COLOR_BUFFER_BIT);

float w = 128;
float h = 128;

w *= scale;
h *= scale;

GLfloat vertices[] = {
    w, 0,
    w, h,
    0, 0,
    0, h
};

float u1 = 0;
float u2 = 1;
float v1 = 0;
float v2 = 1;

GLfloat texCoords[] = {
    u2, v1,
    u2, v2,
    u1, v1,
    u1, v2
};

glVertexPointer(2, GL_FLOAT, 0, vertices);
glEnableClientState(GL_VERTEX_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

It is a simple example to explain my problem. I change scale variable, which impacts only on triangle vertices and should not alter texture coordinates. When scale is 1, i have this picture:

one http://dl.dropbox.com/u/21467/opengl/1.png

When I change scale to 0.99, I have this picture:

two http://dl.dropbox.com/u/21467/opengl/3.png

If you look carefully, you notice little stripe on the top of the texture. Why is it there and how can I avoid it?

In my real game I draw tiles and if I change scale, my tiles start having those stripes and in result I got this nasty grid of stripes in my game. Does anybody know, what is wrong?

  • 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-27T17:50:46+00:00Added an answer on May 27, 2026 at 5:50 pm

    Call the following code when creating the texture buffer:

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    

    If you look carefully, you notice little stripe on the top of the texture. Why is it there and how can I avoid it?

    What is happening is that at certain pixels, the texture coordinate at that screen position may be something like -0.0001, or 1.0002. The TEXTURE_WRAP_[S/T] texture parameter details what will happen when this occurs.

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

Sidebar

Related Questions

I'm using OpenGL ES to draw things in my iPhone game. Sometimes I like
I'm using OpenGL to draw in 2D. I'm trying to overlay textures with alpha.
I'm trying to draw a car for a game I'm making using OpenGL. The
I am trying to draw a series of rectangles using OpenGL but some of
I am working on a 2D game using OpenGL ES. I am using the
I'm trying to write a simple maze game, without using any deprecated OpenGL API
I am using OpenGL ES 2.0 and GLSL to draw objects. Then I want
I'm currently using OpenGL on Android to draw set width lines, which work great
I am trying to load and draw a 2d texture using OpenGL with GLFW
I'm trying to draw grayscale image in color as texture in OpenGL using two

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.