extensions and clamping

Started by
8 comments, last by Damocles 21 years, 7 months ago
Ok, so my textured quads have that oh so lovely dark border on the edges I tried setting texture wrapping to GL_CLAMP but they are still there. I have read about an extension that allows you to use GL_CLAMP_TO_EDGE and supposedly fixes this issue. So I started reading up on extensions......I now have a headache and a desire to kick MS/ARB/everyone else in the nuts for not getting around to making these extensions standard. So can someone please give me a brief run down on extension usage, preferrably with a small example on how to set the clamp to edge wrapping using the extension.
------------------------------------------[New Delta Games] | [Sliders]
Advertisement
These are the most common clamp algorithms

    if(dglExtIsSupported("ARB_texture_border_clamp"))      ClampMethod = CLAMP_TO_BORDER_ARB; //#define CLAMP_TO_BORDER_ARB 0x812Delse if(dglExtIsSupported("GL_EXT_texture_edge_clamp"))      ClampMethod = GL_CLAMP_TO_EDGE; //#define GL_CLAMP_TO_EDGE 0x812Felse if(dglExtIsSupported("GL_SGIS_texture_edge_clamp"))      ClampMethod = GL_CLAMP_TO_EDGE_SGIS; //#define GL_CLAMP_TO_EDGE_SGIS 0x812Felse      ClampMethod = GL_CLAMP;    


hope this helps...

[EDIT] not much...


[edited by - daher on August 31, 2002 11:58:54 AM]
____________________________________MSN | AIM | YIM | ICQ
Erm...no...not that much help. What header file do I need to include to use the dglExtIsSupported function? It''s flagging errors and gl.h doesn''t seem to help any.

Please bear in mind I''m a complete newbie to using extensions And the files I have read about them just confused me even more.
------------------------------------------[New Delta Games] | [Sliders]
If the only thing you need is a way to clamp to your edges, without needing a border colour, then you don''t need extensions.

GL_CLAMP_TO_EDGE is standard from OpenGL 1.2 on. And since it doesn''t require any additional functions (just value defines), you can use it without registering the extension. Just check it''s availability (or if OpenGL version is 1.2+), and use the GL_CLAMP_TO_EDGE value instead of GL_CLAMP.

It''s defined in glext.h, or you can just include it by hand:

#define GL_CLAMP_TO_EDGE 0x812F

Add that to one of your .h files, and you''re done. But note, that if you use production level code, you should definitely check for availability first. If the code is just for fun, it doesn''t matter thta much.

/ Yann
also be aware of a mistake by nvidia on riva->tnt->gf2 cards
if u ask for GL_CLAMP it will do GL_CLAMP_TO_EDGE.
what Yann saiz is correct to use GL_CLAMP_TO_EDGE simply put #include <GL/glext.h> (or wherever u have it) in some file + u can use the extension (no need to setup pointers)
btw CLAMP_TO_BORDER is done in software with a lot of cards g gf2


http://uk.geocities.com/sloppyturds/gotterdammerung.html
Hmm, I just realised I don''t have glext.h. Is it part of the standard OGL files included with Visual Studio? If not, can I download a copy, or is there more required?
------------------------------------------[New Delta Games] | [Sliders]
You can download them at SGI''s site:

glext.h
wglext.h

Check back from time to time to get an update, they add new extensions to those files, as soon as they get into the registry.
Thanks for the links....alas it isn''t working.

I now have the headers, and are included. I use:

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

but the edges are still showing up dark I also tried CLAMP_TO_BORDER to test, but the problem remains. Perhaps this has to be in some special way? At the moment I have it in my texture loading/creation code because I thgouth it had to be applied on a per texture basis. Perhaps I am mistaken?
------------------------------------------[New Delta Games] | [Sliders]
Well, after all that, my friend found the problem. When I had resized some textures in Photoshop, it had created a very dark grey border around the edges of the images, including the alpha channel. It''s such a dark grey that I can only see it if the monitor brightness is right up there, but it''s enough to create an annoying border in-game
------------------------------------------[New Delta Games] | [Sliders]
quote:Original post by Damocles
Well, after all that, my friend found the problem. When I had resized some textures in Photoshop, it had created a very dark grey border around the edges of the images, including the alpha channel. It''s such a dark grey that I can only see it if the monitor brightness is right up there, but it''s enough to create an annoying border in-game

LOL ... no extensions can help you with that

____________________________________MSN | AIM | YIM | ICQ

This topic is closed to new replies.

Advertisement