Skip to main content
gamedev.net
🔒 Locked

Large textures problem

Started by Toaster7 4 replies 250+ views
Original Post
Toaster7
Toaster7
Hi, I''m having a problem with large textures (larger than 256*256). What I do to handle them is breaking them up into smaller squares (let''s say two squares of 256*256 for a 512*256 texture). I then render them in two contiguous separate quads. Them problem is a the quad junction -> there is a visible dirty vertical line. I''m rendering the quads the following way: glBindTexture(GL_TEXTURE_2D, texture[0]); glBegin(GL_QUADS); // square 1 glTexCoord2f(0.0f, 0.0f); glVertex3f(-2.0f, -1.0f, 0.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f( 0.0f, -1.0f, 0.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f( 0.0f, 1.0f, 0.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-2.0f, 1.0f, 0.0f); glEnd(); glBindTexture(GL_TEXTURE_2D, texture[1]); glBegin(GL_QUADS); // square 2 glTexCoord2f(0.0f, 0.0f); glVertex3f( 0.0f, -1.0f, 0.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f( 2.0f, -1.0f, 0.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f( 2.0f, 1.0f, 0.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f( 0.0f, 1.0f, 0.0f); glEnd(); How can I get rid of the junction problem ? Thanks, Fred.
v71
v71
i think the only way to go is to draw two overlapped quads, since you can''t change the texture binding within a begin , end statement, draw the quads overlapped by a small epsilon value, maybe this would help, but you may get some ''z-buffering fight'' beetween them, i hope it helps

Toaster7
Toaster7
unfortunately that doesn''t work (I''ve just tried). Same problem whether the quads overlap or not.

Prosper/LOADED
Prosper/LOADED
I''m not sure it''s the right solution, but you could add borders to your textures. That is, the border of your textures being a part of the other texture. (i.e. the texture A right border is the leftest (<- is this correct english ?) texture B column and vice versa).
zedzeek
zedzeek
it is a problem, solution experiment with the clamping modes eg clamp_to_border or clamp_to_edge also u might need th alter your texture coordinates. using a texture borders unfortunatly usually puts u into software acceleration thus they really aint an option.

http://uk.geocities.com/sloppyturds/gotterdammerung.html
Kippesoep
Kippesoep
Still, you can prevent that by providing the border yourself.
If your texture is 256 pixels wide (or high), make sure the image is 254 pixels in size and copy the other columns (or rows) from the other textures. And instead of using 0..1 for texture coordinates, use 1.0/255.0 .. 254.0/255.0.
Kippesoep

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.