Archived

This topic is now archived and is closed to further replies.

krazywest

Tiling

Recommended Posts

I am writing a tile based map engine. The tiles are renderd using this code: glTexCoord2f(0,0); glVertex2f(x*size,y*size); glTexCoord2f(1,0); glVertex2f(x*size+size,y*size); glTexCoord2f(1,1); glVertex2f(x*size+size,y*size+size); glTexCoord2f(0,1); glVertex2f(x*size,y*size+size); At the edge of each tile there appears a line of semi-random pixels. They use colors from else-where in the image and appear blended-like. They are draw using default vc6 GL options -depth testing +cull back face (definetly no blending!). If you want to see it for yourself you can no-longer download Airstrike2. Sorry! [edited by - krazywest on March 19, 2003 2:01:11 PM]

Share this post


Link to post
Share on other sites
"Through further testing" i''ve worked out that gl is trying to do seamless tiling (Like gimp and psp will do), possibly because the tiles are beeing stretched, but I haven''t turned it on anywhere..

How the crap do you turn this off???
I have a GeForce4 Ti 4400, but I can''t find a setting that makes it happen.

Also, has anyone else had this or any problem with airstrike2?

Share this post


Link to post
Share on other sites
Maybe you post some code on your problem? There''s, however, a suggestion: don''t draw tile positions as floats (e.g if you draw in XY plane, don''t use x = 5.65 and y = 7.55) but use whole numbers - there might be a rounding off problem.

Good luck.

" Do we need us? "


Ionware Productions - Games and Game Tools Development

Share this post


Link to post
Share on other sites
The texture lookup function is looking slightly off the bitmap when exactly at 1.0. The range should be [0,1[.

You can specify this using the 'border' parameter of ::glTexImage2D(), or by setting the texture coordinate at 0.999999. Also, check how you have specified your texture buffer; it may have been 1 pixel shorter than you tell the ::glTexImage2D() et al. function. Also, if you don't have a power-of-2 picture, make sure you specify the correct ::glPixelStorei( GL_UNPACK_ALIGNMENT, XXX ) value that corresponds with the picture width.

-cb

[edited by - cbenoi1 on March 16, 2003 6:50:11 PM]

Share this post


Link to post
Share on other sites
Also, depending on what type of texture-filter you use, it may be blending any given pixel with the surrounding pixels. For example, using GL_LINEAR, I had to blit from around 1-1.5 pixels in on all borders. Try turning filtering to NEAREST if it''s already not.

Share this post


Link to post
Share on other sites
Did you set the texture wrap parameters for S and T coordinates to CLAMP_TO_EDGE?

IIRC :
glTexParameteri(GL_TEXTURE_2D, GL_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_WRAP_T, GL_CLAMP_TO_EDGE);

Share this post


Link to post
Share on other sites
Ok, I had Linear on.

Mipmapping wasn't what I thought it was (meee stuuuuuuuuupid...).

So, is there a way to do linear without rapping it around?
I tried the:

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

idea but it messed up the way I do my transparencies (ie. lots of polygons). Is this because I am stupid or because i'm doing it wrong (the clamping, not the transparanceyyiyngyening)?

[edited by - krazywest on March 17, 2003 3:54:07 PM]

And the answer is... the out of date part of my stupid code that stops the clamp working properly!

[edited by - krazywest on March 18, 2003 2:13:04 PM]

Share this post


Link to post
Share on other sites