Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
543 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 reply this article.

OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...