Denormgen running on OSX?

Informations, Help and general talk around the Normal and Displacement Map Generator Tool.
User avatar
jsplifer
Apprentice
Posts: 16
Joined: Wed Mar 21, 2007 8:27 am
Location: Pennsylvania

Denormgen running on OSX?

Post by jsplifer » Sat Mar 24, 2007 11:42 pm

Hi

I've been trying to hack this to work on osx. Because I need this tool SOOO badly! :)

Here is some poking: http://home.earthlink.net/~jaspermine/s ... errors.txt

If anybody has news about this working on OSX I would so greatly appreciate the info.

Thank you
jsplifer

User avatar
Dragonlord
Forum Administrator
Posts: 609
Joined: Fri Jul 30, 2004 4:30 pm
Location: Switzerland
Contact:

Post by Dragonlord » Sun Mar 25, 2007 3:15 pm

So far I could not test compiling it on OSX as I do not have access to such a machine. I poked at the error to see what is wrong. What I get is that "APIENTRY" is not defined on OSX in this case but is on linux and windows. On those systems the definition is:

Code: Select all

#define APIENTRY __stdcall
Now what goes for OSX I don't know what definition they use. Do once a search inside "gl.h" ( somewhere in your include path ) for a definition like this:

Code: Select all

#define GLAPIENTRY ***
with *** being something I don't know yet. If such a line exists we can hack it into the source like this:

Code: Select all

// ./gui/ngOpenGlSystem.h line 33 insert
// make sure APIENTRY is defined
#ifndef APIENTRY
#define APIENTRY ***
#endif
With *** the stuff you found in your gl.h file. If there is no such line then there is no such value required ( and I guess this is the case ). If so simply end the #define APIENTRY line without a value ( so it is defined to be empty ).

Now try compiling again with these changes and let me know if it works. If you don't know what I just talked about assume the later case without the value.
Image
Oh to be a dragon, of silkworm size or immense...

User avatar
jsplifer
Apprentice
Posts: 16
Joined: Wed Mar 21, 2007 8:27 am
Location: Pennsylvania

Post by jsplifer » Wed Mar 28, 2007 7:42 am

Thanks for the reply!

Ok continuing with the given advice I see that we should use the X11 OpenGL includes. With this we get around the first error.

Everything looks good up until this point... which I'm desperately trying to fix as I write this. All the errors so far have been fixed with sloppy simlinks. LD can be quite the thorn sometimes on osx.

http://home.earthlink.net/~jaspermine/s ... ROUND2.txt

Had a buddy I do art with try this out on some of my models and WOW!!! How to convince you to add tangent and hi2low to blender? ;)

js

User avatar
Dragonlord
Forum Administrator
Posts: 609
Joined: Fri Jul 30, 2004 4:30 pm
Location: Switzerland
Contact:

Post by Dragonlord » Wed Mar 28, 2007 6:37 pm

Looks like you don't have the libFOX-1.2.so file around. Using 1.2 version is anyways discouraged. I would go with FOX-1.6 version to be on the safe side. The 1.2 code is more of a fallback triggered if the script can not find something else. Should the libraries though be named different on OSX the configure and include files have to be altered. Can you check what FOX version you have and if the libraries are called libFOX-1.x.so ?
Had a buddy I do art with try this out on some of my models and WOW!!! How to convince you to add tangent and hi2low to blender? ;)
Now that one I did not get. What's up with Blender there?
Image
Oh to be a dragon, of silkworm size or immense...

User avatar
jsplifer
Apprentice
Posts: 16
Joined: Wed Mar 21, 2007 8:27 am
Location: Pennsylvania

Post by jsplifer » Wed Mar 28, 2007 9:08 pm

Helllo,

This is the naming of osx library files, these are the unix type names.

http://home.earthlink.net/~jaspermine/s ... F4E8AD.jpg

I am using Fox 1.2 as it was the easy one to install. I would like to try and compile with Fox 1.2 just to test before upgrading this library. As you can see the naming is different, and am searching and replacing in the source all reference to libFOX-1.x.so

I hope we are close.
jsplifer

User avatar
jsplifer
Apprentice
Posts: 16
Joined: Wed Mar 21, 2007 8:27 am
Location: Pennsylvania

Post by jsplifer » Thu Mar 29, 2007 7:35 am

Hello,

I don't know if its just really late or what, but I can't find any code file specifically mentioning the libFOX-1.x.so library.

Configure shouldn't be dumb to .dylib libraries either so why its not finding the FOX lib is a mystery.

I do see fox mentioned 211 times in the source though: ChangeLog, config.log, config.status, configure, configure.ac, and many more, most of the later are looking for fx.h, fx3d.h, and the foxtoolkit.h header files. And again, no mentioned of libFOX-1.x.so in any of those files

I also see configure aware of darwin (mac osx) and the .dylib naming:

Code: Select all

darwin* | rhapsody*)
  dynamic_linker="$host_os dyld"
  version_type=darwin
  need_lib_prefix=no
  need_version=no
  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
  soname_spec='${libname}${release}${major}$shared_ext'
  shlibpath_overrides_runpath=yes
  shlibpath_var=DYLD_LIBRARY_PATH
  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
  if test "$GCC" = yes; then
    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
  else
    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
  fi
  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
  ;;
Silly LD can't find the right thing to link to :) I try again tomorrow and hope you may have an idea. Trying one more thing then off to bed.

jsplifer

User avatar
jsplifer
Apprentice
Posts: 16
Joined: Wed Mar 21, 2007 8:27 am
Location: Pennsylvania

Post by jsplifer » Thu Mar 29, 2007 9:50 am

Hi,

Makefile edit: FOX_LIBS = -L/opt/local/lib -lFOX-1.2

This does not get past the previously posted error. I'm guessing difference between .so and .dylib? I have also created symlinks to spoof .so libraries. No go.

ok, now I sleep.

jsplifer

User avatar
Dragonlord
Forum Administrator
Posts: 609
Joined: Fri Jul 30, 2004 4:30 pm
Location: Switzerland
Contact:

Post by Dragonlord » Thu Mar 29, 2007 7:03 pm

You really should upgrade to 1.6 if possible. The reason is that version 1.2 and lower are more a sort of "hack together" version. They can compile but the later version significantly changed certain things. Especially they added "fox-config" which would be the savior in this messed up situation. So if you can arrange with it install the 1.6 ( or at last 1.4 ) version and then run once on the console

Code: Select all

WANT_FOX=1.6 fox-config --libs
and

Code: Select all

WANT_FOX=1.6 fox-config --cflags
( replace 1.6 with 1.4 if you chose this version ).

The output should then tell us where the problem stems from.
Image
Oh to be a dragon, of silkworm size or immense...

User avatar
jsplifer
Apprentice
Posts: 16
Joined: Wed Mar 21, 2007 8:27 am
Location: Pennsylvania

Post by jsplifer » Sun Apr 01, 2007 5:27 am

Hi,

:) Good News! I got it compiling on OSX.

But man, that Fox1.6 was tricky... couple days later I have denormgen starting up in X11.

The bad news.

Code: Select all

JasperMine2:/usr/bin jaspermine$ ./denormgen
[EXCEPTION OCCURED]
  Exception:   InvalidAction
  Description: Invalid Action (internal error)
  Infos:       
  Source File: ./gui/ngOpenGlSystem.cpp
  Source Line: 733
Haven't looked into this line of code yet, as I'm too excited about getting it to compile.

jsplifer

User avatar
jsplifer
Apprentice
Posts: 16
Joined: Wed Mar 21, 2007 8:27 am
Location: Pennsylvania

Post by jsplifer » Sun Apr 01, 2007 5:38 am

Hello,

After looking at the code in question, I think I have everything set up correctly and thought my OpenGL information could be useful.

Here it is: http://home.earthlink.net/~jaspermine/s ... OpenGL.txt

I hope this will give us a direction.

jsplifer

User avatar
Dragonlord
Forum Administrator
Posts: 609
Joined: Fri Jul 30, 2004 4:30 pm
Location: Switzerland
Contact:

Post by Dragonlord » Sun Apr 01, 2007 1:26 pm

jsplifer wrote:Hello,

After looking at the code in question, I think I have everything set up correctly and thought my OpenGL information could be useful.

Here it is: http://home.earthlink.net/~jaspermine/s ... OpenGL.txt

I hope this will give us a direction.

jsplifer
[ OT: A knight right next to a dragon... now that's promising fun ^.=.^ ]

Your card has Fragment and Vertex programs so everything should be fine from this point on. The function obtainer also can not be a problem as the code to get the functions for multi texturing have worked. So there is only one cause for the problem left: Apple has his own mind on function naming.

The fragment and vertex program functions are defined after GL_ARB_vertex_program and GL_ARB_fragment_program to be:
glGenProgramsARB, glDeleteProgramsARB, glBindProgramARB, glProgramStringARB and glProgramLocalParameter4fARB ( including others but I use only those ).
Now those do not exist which is why the exception occurs. I assume they renamed those functions for no apparent reason. Try once the following code and see if it works.

Code: Select all

	// ngOpenGlSystem.cpp, replace lines 731-742
	if( pHasVFProg ){
		glGenProgramsARB = (GLGENPROGRAMSARB)glXGetProcAddress( (OGLGPA_CAST)"glGenPrograms" );
		if(!glGenProgramsARB) THROW(dueInvalidAction);
		glDeleteProgramsARB = (GLDELETEPROGRAMSARB)glXGetProcAddress( (OGLGPA_CAST)"glDeletePrograms" );
		if(!glDeleteProgramsARB) THROW(dueInvalidAction);
		glBindProgramARB = (GLBINDPROGRAMARB)glXGetProcAddress( (OGLGPA_CAST)"glBindProgram" );
		if(!glBindProgramARB) THROW(dueInvalidAction);
		glProgramStringARB = (GLPROGRAMSTRINGARB)glXGetProcAddress( (OGLGPA_CAST)"glProgramString" );
		if(!glProgramStringARB) THROW(dueInvalidAction);
		glProgramLocalParameter4fARB = (GLPROGRAMLOCALPARAMETER4FARB)glXGetProcAddress( (OGLGPA_CAST)"glProgramLocalParameter4f" );
		if(!glProgramLocalParameter4fARB) THROW(dueInvalidAction);
	}
Image
Oh to be a dragon, of silkworm size or immense...

User avatar
jsplifer
Apprentice
Posts: 16
Joined: Wed Mar 21, 2007 8:27 am
Location: Pennsylvania

Post by jsplifer » Mon Apr 02, 2007 6:45 am

Greetings Dragonlord,

I turned over many rocks this last day looking for the proper function calls to use in C++

I also asked around the blender and crystalspace developer areas about what the problem might be. Although, only two answers, and that was, No naming difference in osx. I will want another opinion before I do anything further.

I have included a sample osx cocoa application I made this afternoon. Its in ObjectiveC so not sure how much use it is.

http://home.earthlink.net/~jaspermine/stuff/Sample.m

I continue to search through my documentation to find these functions, and also to ask anyone in the know. Thanks again for your responses.

jsplifer

PS - I replaced the lines in question with the code you provided and upon startup throws the same error.

User avatar
Dragonlord
Forum Administrator
Posts: 609
Joined: Fri Jul 30, 2004 4:30 pm
Location: Switzerland
Contact:

Post by Dragonlord » Mon Apr 02, 2007 3:36 pm

Wait a moment. I googled a bit around and noticed a mailing list post where somebody mentioned a compile error on linux not existing on OSX. I have not thought about one particular solution. What OpenGL version does OSX use in the headers? 1.1 or a mix between this and 2.0 ? The reason is this that some functions have moved into the OpenGL ( and are no more just extensions ). Perhaps the vertex and fragment programs moved up there and got therefore stripped from the extensions function. If this is the case things get a bit more funny. Let's try the following hack to see if this is the case.

First we need to mess with "ngOpenGlSystem.h". Remove lines 106 up to 110 ( those the following ones ):

Code: Select all

	GLGENPROGRAMSARB glGenProgramsARB;
	GLDELETEPROGRAMSARB glDeleteProgramsARB;
	GLBINDPROGRAMARB glBindProgramARB;
	GLPROGRAMSTRINGARB glProgramStringARB;
	GLPROGRAMLOCALPARAMETER4FARB glProgramLocalParameter4fARB;
Now mess with "ngOpenGlSystem.cpp". We strip out the function retrieval code as we assume the function to be present already. So delete lines 731 up to 742 ( which are the following lines ):

Code: Select all

	if( pHasVFProg ){
		glGenProgramsARB = (GLGENPROGRAMSARB)glXGetProcAddress( (OGLGPA_CAST)"glGenProgramsARB" );
		if(!glGenProgramsARB) THROW(dueInvalidAction);
		glDeleteProgramsARB = (GLDELETEPROGRAMSARB)glXGetProcAddress( (OGLGPA_CAST)"glDeleteProgramsARB" );
		if(!glDeleteProgramsARB) THROW(dueInvalidAction);
		glBindProgramARB = (GLBINDPROGRAMARB)glXGetProcAddress( (OGLGPA_CAST)"glBindProgramARB" );
		if(!glBindProgramARB) THROW(dueInvalidAction);
		glProgramStringARB = (GLPROGRAMSTRINGARB)glXGetProcAddress( (OGLGPA_CAST)"glProgramStringARB" );
		if(!glProgramStringARB) THROW(dueInvalidAction);
		glProgramLocalParameter4fARB = (GLPROGRAMLOCALPARAMETER4FARB)glXGetProcAddress( (OGLGPA_CAST)"glProgramLocalParameter4fARB" );
		if(!glProgramLocalParameter4fARB) THROW(dueInvalidAction);
	}
Now try compiling again.
Image
Oh to be a dragon, of silkworm size or immense...

User avatar
jsplifer
Apprentice
Posts: 16
Joined: Wed Mar 21, 2007 8:27 am
Location: Pennsylvania

Post by jsplifer » Mon Apr 02, 2007 5:35 pm

Hello,

Terminal output when compiling after removing lines mentioned:

http://home.earthlink.net/~jaspermine/stuff/Err01.txt

jsplifer

User avatar
jsplifer
Apprentice
Posts: 16
Joined: Wed Mar 21, 2007 8:27 am
Location: Pennsylvania

Post by jsplifer » Mon Apr 02, 2007 7:47 pm

Hello

As an experiment I tried compiling the denormgen 1.4 sources. The application compiles, but when run gives this error.

Code: Select all

JasperMine2:/usr/bin jaspermine$ ./denormgen 
[EXCEPTION OCCURED]
  Exception:   InvalidAction
  Description: Invalid Action (internal error)
  Infos:       
  Source File: ./gui/ngWindowMain.cpp
  Source Line: 160
This is the code pointed to in error.

Code: Select all

	// init opengl
	if( ! pViewOpenGl->makeCurrent() ) THROW( dueInvalidAction );
	pOglSys = new ngOpenGlSystem( pCmdArgs );
	if( ! pOglSys ) THROW( dueOutOfMemory );
	if( ! pOglSys->CanPixelShade() ){
		pUseNormal = false;
		pUseDisp = false;
	}
jsplifer

Post Reply