Re: [Plib-devel] No longer blocking non power-of-two textures
Brought to you by:
sjbaker
From: John F. F. <joh...@cy...> - 2007-09-29 22:50:11
|
Gentlemen, While we're on the question of "ssgMakeMipMaps", a feature request ... http://sourceforge.net/tracker/index.php?func=detail&aid=1002001&group_i d=382&atid=350382 ... asks that we add a new argument "bool freeData = false" so that the function will not always delete the input data. Are there any objections to this? - John -----Original Message----- From: John F. Fay Sent: Saturday, September 29, 2007 12:19 PM To: 'PLIB Developers' Subject: Re: [Plib-devel] No longer blocking non power-of-two textures OK, I didn't hear anybody scream so I have put the "ssgSearchExtensionString" and "ssgIsExtensionSupported" functions at the bottom ot "ssg.cxx" because it occurs to me that they are quite general. I have put a prototype for "ssgIsExtensionSupported" into "ssg.h" and added the extra test to "ssgMakeMipMaps" in "ssgLoadTexture.cxx". - John -----Original Message----- From: Fay John F Dr CTR USAF 46 SK Sent: Friday, September 28, 2007 8:44 AM To: PLIB Developers Subject: Re: [Plib-devel] No longer blocking non power-of-two textures It looks fine to my uneducated eye. Unless somebody screams, I will put it into SVN this weekend. (We can always take it out later if it breaks something.) John F. Fay Technical Fellow Jacobs Technology TEAS Group 850-883-1294 -----Original Message----- From: pli...@li... [mailto:pli...@li...] On Behalf Of Paolo Leoncini Sent: Friday, September 28, 2007 8:36 AM To: 'PLIB Developers' Subject: [Plib-devel] No longer blocking non power-of-two textures Dear friends, As most of you probably know the GL_ARB_texture_non_power_of_two OpenGL extension, when supported, allows to overcome the subject limit at the only implementation effort of checking if such extension is supported by the hardware (http://oss.sgi.com/projects/ogl-sample/registry/ARB/texture_non_power_o f_tw o.txt). GL_ARB_texture_non_power_of_two has no relevant limitation, and is much better than GL_EXT_texture_rectangle in which, e.g., texture coordinates were addressed non-parametrically [0..w],[0..h]. Such check could be done in ssgMakeMipMaps at the very beginning just before the power-of-two test. So in our case, in ssgLoadTexture.cxx: ssgMakeMipMaps ( GLubyte *image, int xsize, int ysize, int zsize ) { bool non_power_of_two_tex_supported = ssgIsExtensionSupported( "GL_ARB_texture_non_power_of_two" ); if ( !non_power_of_two_tex_supported && (! ((xsize & (xsize-1))==0) || ! ((ysize & (ysize-1))==0)) ) { ulSetError ( UL_WARNING, "Map is not a power-of-two in size!" ) ; return false ; } ... Checking for such extension could be done, in this and future cases, by the following code (code by Cesar Blecua Udias sent me by Roman Grigoriev when testing VBOs): static bool ssgSearchExtensionString(char *extString, char *extName) { // Returns GL_TRUE if the *extName string appears in the *extString string, // surrounded by white spaces, or GL_FALSE otherwise. char *p, *end; int n, extNameLen; if ((extString == NULL) || (extName == NULL)) return false; extNameLen = strlen(extName); p=extString; end = p + strlen(p); while (p < end) { n = strcspn(p, " "); if ((extNameLen == n) && (strncmp(extName, p, n) == 0)) return GL_TRUE; p += (n + 1); } return GL_FALSE; } bool ssgIsExtensionSupported(char *extName) { // Returns GL_TRUE if the OpenGL Extension whose name is *extName // is supported by the system, or GL_FALSE otherwise. // // The *extName string must follow the OpenGL extensions naming scheme // (ie: "GL_type_extension", like GL_EXT_convolution) return ssgSearchExtensionString((char *)glGetString(GL_EXTENSIONS), extName); } Waiting for reactions - Paolo Leoncini ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ plib-devel mailing list pli...@li... https://lists.sourceforge.net/lists/listinfo/plib-devel ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ plib-devel mailing list pli...@li... https://lists.sourceforge.net/lists/listinfo/plib-devel ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ plib-devel mailing list pli...@li... https://lists.sourceforge.net/lists/listinfo/plib-devel |