Bugs item #3281206, was opened at 2011-04-08 21:07 Message generated for change (Comment added) made by nusmuk You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=507079&aid=3281206...
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: rendering (e.g. display) Group: any operating system Status: Pending Resolution: None Priority: 7 Private: No Submitted By: Matteo Sisti Sette (sistisette) Assigned to: Nobody/Anonymous (nobody) Summary: thin white primitive borders are shown despite texture
Initial Comment: Sometimes, depending on their size and/or position, rectangles (and I guess other polygons too but I mainly work with rectangles) are shown with a thin white border even if they are textured with a pix that has no white pixel in the proximity of the border, e.g. a completely black image or an image whose pixels close to the border are all black or transparent.
This has been there for years, I've always seen this happen since I use gem, across many versions. This happens both with Linux and Windows, i don't know on Mac OS.
If a rectangle is moving or changing size, the borders appear and disappear. Most of the time they are absent, I mean the values of position and size that cause the borders to appear are just a small fraction of the total.
----------------------------------------------------------------------
Comment By: Cyrille Henry (nusmuk) Date: 2011-08-16 19:25
Message: hello,
yes, GL_CLAMP_TO_EDGE is better than GL_CLAMP.
The grep does not say a lot about the code. if you have a look in pix_texture.cpp : if (type) m_repeat = GL_REPEAT; else { if(GLEW_EXT_texture_edge_clamp) m_repeat = GL_CLAMP_TO_EDGE; else m_repeat = GL_CLAMP; }
when repeat mode = 0, then m_repeat is GL_CLAMP_TO_EDGE if possible, or GL_CLAMP if not.
it's the same about pix_imageInPlace and pix_cubemap. it's not the same for framebuffer, but there certainly is a good reason for this.
c
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody) Date: 2011-08-16 17:15
Message: Guessing at the cause here, but I'm led to believe GL_CLAMP is mostly wrong, and GL_CLAMP_TO_EDGE is to be preferred almost always...
http://www.opengl.org/wiki/Common_Mistakes#Texture_edge_color_problem
claude@zebimus:~/code/pd-gem$ grep -Rwn "GL_CLAMP" . | grep -v \.svn ./Gem/ChangeLog:4473: "GL_CLAMP" when doing rectangle-textures, as they will ignore ./Gem/src/Pixes/pix_imageInPlace.cpp:216: m_repeat = GL_CLAMP; ./Gem/src/Pixes/pix_cubemap.cpp:365: m_repeat = GL_CLAMP; ./Gem/src/Pixes/pix_texture.cpp:118: // NPOT: GL_CLAMP, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_BORDER ./Gem/src/Pixes/pix_texture.cpp:690: m_repeat = GL_CLAMP; ./Gem/src/Gem/glew.h:698:#define GL_CLAMP 0x2900 ./Gem/src/Controls/gemframebuffer.cpp:284: glTexParameterf(m_texTarget, GL_TEXTURE_WRAP_S, GL_CLAMP); ./Gem/src/Controls/gemframebuffer.cpp:285: glTexParameterf(m_texTarget, GL_TEXTURE_WRAP_T, GL_CLAMP); ./Gem/src/Utils/GLUtil_generated.h:86: if (!strcmp(name, "GL_CLAMP")) return GL_CLAMP; ./GemLibs/FTGL/test/FTTextureGlyph-Test.cpp:42: glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); ./GemLibs/FTGL/test/FTTextureGlyph-Test.cpp:43: glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); ./GemLibs/FTGL/test/FTTextureGlyph-Test.cpp:69: glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); ./GemLibs/FTGL/test/FTTextureGlyph-Test.cpp:70: glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); ./GemLibs/FTGL/src/FTGLTextureFont.cpp:128: glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); ./GemLibs/FTGL/src/FTGLTextureFont.cpp:129: glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); ./GemLibs/FTGL/include/FTGLTextureFont.h:85: * GL_TEXTURE_WRAP_S = GL_CLAMP ./GemLibs/FTGL/include/FTGLTextureFont.h:86: * GL_TEXTURE_WRAP_T = GL_CLAMP
Incidentally, could these better be ...i instead of ...f function calls?
claude@zebimus:~/code/pd-gem$ grep -Rn "glTexParameterf" . | grep -v \.svn | grep -v GL_TEXTURE_PRIORITY | grep -v src/openGL | grep -v glew.h | grep -v build/ | grep -v GEM ./Gem/src/Pixes/pix_imageInPlace.cpp:156: glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, m_repeat); ./Gem/src/Pixes/pix_imageInPlace.cpp:157: glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, m_repeat); ./Gem/src/Pixes/pix_cubemap.cpp:112: glTexParameterf(m_textureType, GL_TEXTURE_MIN_FILTER, m_textureQuality); ./Gem/src/Pixes/pix_cubemap.cpp:113: glTexParameterf(m_textureType, GL_TEXTURE_MAG_FILTER, m_textureQuality); ./Gem/src/Pixes/pix_cubemap.cpp:114: glTexParameterf(m_textureType, GL_TEXTURE_WRAP_S, m_repeat); ./Gem/src/Pixes/pix_cubemap.cpp:115: glTexParameterf(m_textureType, GL_TEXTURE_WRAP_T, m_repeat); ./Gem/src/Pixes/pix_cubemap.cpp:347: glTexParameterf(m_textureType, GL_TEXTURE_MAG_FILTER, m_textureQuality); ./Gem/src/Pixes/pix_cubemap.cpp:348: glTexParameterf(m_textureType, GL_TEXTURE_MIN_FILTER, m_textureQuality); ./Gem/src/Pixes/pix_cubemap.cpp:371: glTexParameterf(m_textureType, GL_TEXTURE_WRAP_S, m_repeat); ./Gem/src/Pixes/pix_cubemap.cpp:372: glTexParameterf(m_textureType, GL_TEXTURE_WRAP_T, m_repeat); ./Gem/src/Pixes/pix_snap2tex.cpp:90: glTexParameterf(m_textureType, GL_TEXTURE_WRAP_S, m_repeat); ./Gem/src/Pixes/pix_snap2tex.cpp:91: glTexParameterf(m_textureType, GL_TEXTURE_WRAP_T, m_repeat); ./Gem/src/Pixes/pix_snap2tex.cpp:365: glTexParameterf(m_textureType, GL_TEXTURE_WRAP_S, m_repeat); ./Gem/src/Pixes/pix_snap2tex.cpp:366: glTexParameterf(m_textureType, GL_TEXTURE_WRAP_T, m_repeat); ./Gem/src/Pixes/pix_texture.cpp:137: glTexParameterf(m_textureType, GL_TEXTURE_MIN_FILTER, m_textureQuality); ./Gem/src/Pixes/pix_texture.cpp:138: glTexParameterf(m_textureType, GL_TEXTURE_MAG_FILTER, m_textureQuality); ./Gem/src/Pixes/pix_texture.cpp:139: glTexParameterf(m_textureType, GL_TEXTURE_WRAP_S, m_repeat); ./Gem/src/Pixes/pix_texture.cpp:140: glTexParameterf(m_textureType, GL_TEXTURE_WRAP_T, m_repeat); ./Gem/src/Pixes/pix_texture.cpp:270: glTexParameterf(m_textureType, GL_TEXTURE_MAG_FILTER, m_textureQuality); ./Gem/src/Pixes/pix_texture.cpp:271: glTexParameterf(m_textureType, GL_TEXTURE_MIN_FILTER, m_textureQuality); ./Gem/src/Pixes/pix_texture.cpp:657: glTexParameterf(m_textureType, GL_TEXTURE_MAG_FILTER, m_textureQuality); ./Gem/src/Pixes/pix_texture.cpp:658: glTexParameterf(m_textureType, GL_TEXTURE_MIN_FILTER, m_textureQuality); ./Gem/src/Pixes/pix_texture.cpp:696: glTexParameterf(m_textureType, GL_TEXTURE_WRAP_S, m_repeat); ./Gem/src/Pixes/pix_texture.cpp:697: glTexParameterf(m_textureType, GL_TEXTURE_WRAP_T, m_repeat); ./Gem/src/Pixes/pix_movieOS.cpp:271: glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); ./Gem/src/Pixes/pix_movieOS.cpp:272: glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); ./Gem/src/Controls/gemframebuffer.cpp:284: glTexParameterf(m_texTarget, GL_TEXTURE_WRAP_S, GL_CLAMP); ./Gem/src/Controls/gemframebuffer.cpp:285: glTexParameterf(m_texTarget, GL_TEXTURE_WRAP_T, GL_CLAMP);
----------------------------------------------------------------------
Comment By: IOhannes m zmölnig (zmoelnig) Date: 2011-08-16 16:33
Message: it's hardware/driver specific as the openGL standard doesn't specify exactly how it ought to be done (afair); i mainly follow cyrille's arguing here.
the workaround is to e.g. set "repeat" mode and/or the "quality" mode of texture.
you can apply a global defaul by adding lines for "texture.quality" and "texture.repeat" to your gem.conf; something like: <gem.conf> texture.quality 0 </gem.conf>
----------------------------------------------------------------------
Comment By: Matteo Sisti Sette (sistisette) Date: 2011-08-16 16:27
Message: Sorry it was me asking the last question (damn the fake "remember me" checkbox, I reported that but the admins like the way it is)
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody) Date: 2011-08-16 16:24
Message: What hardware/driver is this specific to? What's the workaround in gem.conf?
----------------------------------------------------------------------
Comment By: IOhannes m zmölnig (zmoelnig) Date: 2011-08-16 16:01
Message: given that the problem is hardware/driver specific, there is a workaround _and_ the workaround can be done globally using gem.conf (in >=0.93), i think this can be closed.
----------------------------------------------------------------------
Comment By: Matteo Sisti Sette (sistisette) Date: 2011-04-23 15:39
Message: Does the hardware really interpolate textures the wrong way? Are we sure Gem is asking the hardware the right thing? If "repeat" is the fix, i suspect it may mask the issue (i.e. make it less evident in some but not all situations) rather than fix it, but I haven't tried it actually.
----------------------------------------------------------------------
Comment By: Cyrille Henry (nusmuk) Date: 2011-04-08 22:35
Message: This is not a gem problem. it's the way the hardware interpolate a texture. i don't remember the exact configuration, but changing the default value of "quality" and/or "repeat" of pix_texture change can fix this problem. since it's not gem fault, and gem offer a solution, i think this can be closed.
----------------------------------------------------------------------
Comment By: Matteo Sisti Sette (sistisette) Date: 2011-04-08 21:10
Message: I hope it is ok to rise the priority. Though this is an old bug, it is a real showstopper in a range of situations.
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=507079&aid=3281206...