Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
564 views
in Technique[技术] by (71.8m points)

c++ - OpenGL make texture scale up and not clamp

I have a texture in a game that clamps to the edge instead of linearly scaling up. These are the parameters I'm providing OpenGL with:

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EGDE);

How should I change them in order to make the texture scale up?

These are the vertices I'm giving OpenGL:

typedef struct{
  float positionX;
  float positionY;
  float textureX ;
  float textureY ;
} textureVertex;

textureVertex vertices[4] = {
      {-3.5f,  3.5f, -1.0f,  1.0f},
      {-3.5f, -3.5f, -1.0f, -1.0f},
      { 3.5f, -3.5f,  1.0f, -1.0f},
      { 3.5f,  3.5f,  1.0f,  1.0f}
    };
question from:https://stackoverflow.com/questions/65883483/opengl-make-texture-scale-up-and-not-clamp

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

Please log in or register to answer this question.

Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...