Thread: RE: [Plib-devel] texture support for ssgLoadOBJ
Brought to you by:
sjbaker
From: Dave M. <Dav...@dy...> - 2000-04-04 16:01:19
|
> >I added texture support to the Wavefront OBJ loader. Wolfram wrote: > I tried it on some files of my own, but due to lots of problems, > (most ?) unrelated to the *.obj-loader didnt succeed (yet). send me any OBJ files that don't work > - I had a texture with a size that is not a power of two. > plib complained (map is not a power-of-two in size) > and exits the program! i'll track that down if you want to send me the texture -- Dave McClurg |
From: Dave M. <Dav...@dy...> - 2000-04-05 00:57:22
|
> >> - I had a texture with a size that is not a power of two. > >> plib complained (map is not a power-of-two in size) > >> and exits the program! > > - Dont load wrong textures, give an error-message, go on loading > everything else. > done. i used Steve's loadDummyTexture() in the event that make_mip_maps() finds non power-of-two sizes. while i was at it, i added some simple error message routines: void ssgSetError(const char *fmt, ...); char* ssgGetError(void); void ssgClearError(void); this is similar to what SDL uses. SetError fprintfs to stderr and stores the message in a buffer that can be retreived with GetError. SetError could also echo to a stderr.txt file if we want to capture multiple error messages. I'd like to apply these error message routines to my loaders and perhaps all of SSG unless there are objections. -- Dave McClurg |
From: Steve B. <sjb...@ai...> - 2000-04-05 04:46:12
|
> Dave McClurg wrote: > while i was at it, i added some simple error message routines: > > void ssgSetError(const char *fmt, ...); > char* ssgGetError(void); > void ssgClearError(void); There should probably be a 'severity' indicator: SSG_DEBUG -- Messages that can safely be ignored. SSG_WARNING -- Messages that are important. SSG_FATAL -- Errors that SSG cannot recover from. It would be nice for the application to be able to register a callback that SSG will call when an error occours - have it default to something that just dumps the message to stderr. > I'd like to apply these error message routines to my loaders > and perhaps all of SSG unless there are objections. Nope no objections - we need something along these lines. -- Steve Baker http://web2.airmail.net/sjbaker1 sjb...@ai... (home) http://www.woodsoup.org/~sbaker sj...@ht... (work) |
From: Wolfram K. <w_...@rz...> - 2000-04-04 20:04:46
|
Dave wrote: > >> - I had a texture with a size that is not a power of two. >> plib complained (map is not a power-of-two in size) >> and exits the program! >i'll track that down if you want to send me the texture Lets first decide what we want :-). I think most or all graphics cards want to have texture-sizes that are a power of two. So, internally, we should only have such textures. I see two ways to deal with this: - Dont load wrong textures, give an error-message, go on loading everything else. - Resample the texture when loading. This, of course, slows loading the texture. Therefore, authors (of games or whatever) should resample their textures once in a paint-program anyway. If we go this way, I want a dialog saying "this is not a nice texture, if you want to go on using it or even distribute it, resample it". It is surprising how uniformed people can be, even if they create textures professionally. For a long time, we had monochrome textures with a size of, for example 118x112 pixels :-(. So, our program was used with the hand brake on :-(. (German idiom, translated into English. I dont know whether there is an English one). Bye bye, Wolfram Kuss. |
From: Dave M. <dp...@ef...> - 2000-04-05 02:22:11
|
more info on the error routines I added: void ssgSetError ( const char* fmt, ... ) ; char* ssgGetError ( void ) ; void ssgClearError ( void ) ; Here are some examples of how an application might handle errors. If ErrorBox() shows a message to the user then to handle a fatal load error: ent = ssgLoad ( fname ) ; if ( ent == NULL ) { ErrorBox ( ssgGetError() ) ; } To handle all load error returns: ssgClearError(); ent = ssgLoad ( fname ) ; if ( ent == NULL ) { //fatal error ErrorBox ( ssgGetError() ) ; } else if ( strcmp(ssgGetError(), "") != 0 ) { //non-fatal errors ... still returned something ErrorBox ( ssgGetError() ) ; } PPE should probably do something like this. This is how it is done in SDL (Simple Direct Media Layer) and I would like to do it the same in SSG unless there are objections. To handle multiple error messages, the application could redirect stderr to a file or I could echo errors to a file in ssgSetError(). which do you prefer? -- Dave McClurg |
From: Steve B. <sjb...@ai...> - 2000-04-05 04:52:24
|
Dave McClurg wrote: > PPE should probably do something like this. ...so I guess it shouldn't be an SSG function - but something general to all of PLIB - including PUI, SL, etc. As a general library, the application might like to handle it's own errors the same way. > To handle multiple error messages, the application > could redirect stderr to a file or I could echo errors > to a file in ssgSetError(). which do you prefer? Using a callback into the application would solve the problem of multiple errors. (That's how Performer handles it). -- Steve Baker http://web2.airmail.net/sjbaker1 sjb...@ai... (home) http://www.woodsoup.org/~sbaker sj...@ht... (work) |
From: Steve B. <sjb...@ai...> - 2000-04-05 04:39:05
|
Wolfram Kuss wrote: > > Dave wrote: > > > > >> - I had a texture with a size that is not a power of two. > >> plib complained (map is not a power-of-two in size) > >> and exits the program! > >i'll track that down if you want to send me the texture > > Lets first decide what we want :-). > I think most or all graphics cards want to have texture-sizes > that are a power of two. So, internally, we should only have such > textures. More than that - it is a REQUIREMENT of OpenGL that maps have power of two sizes. Before we started to use SSG for PPE and stuff like that, it didn't matter that it exited when something as serious as this happened. The developer of a game would see his error and fix it. No big deal. However, now that SSG is used in things like the PPE modeller, it's important that we can survive without crashing - and yet still report the seriousness of the problem to the application. > I see two ways to deal with this: > - Dont load wrong textures, give an error-message, go on loading > everything else. Exactly. > - Resample the texture when loading. This, of course, slows loading > the texture. Therefore, authors (of games or whatever) should resample > their textures once in a paint-program anyway. If we go this way, > I want a dialog saying "this is not a nice texture, if you want to go > on using it or even distribute it, resample it". I don't think that's a good plan. People will ignore the error if SSG kludges a fix - and the texture will just look bad. Replace the broken texture with a magenta and green chequerboard or something. People learn to recognise this as the 'broken texture' symptom. > It is surprising how uniformed people can be, even if they create > textures professionally. For a long time, we had monochrome textures > with a size of, for example 118x112 pixels :-(. > So, our program was used with the hand brake on :-(. (German idiom, > translated into English. I dont know whether there is an English one). Yep. OpenGL implementations are SUPPOSED to ignore non-power of two maps...not all of them do. -- Steve Baker http://web2.airmail.net/sjbaker1 sjb...@ai... (home) http://www.woodsoup.org/~sbaker sj...@ht... (work) |