Building Panda3D with OpenGL ES using Cygwin and MSVC9. Log


#15

This isn’t an issue with abstract functions or anything like this. I think it might be related to the DLL symbols again: Microsoft’s nutty DLL-import scheme requires symbols that are imported from another DLL to be prefixed with _imp, and symbols that are local to this DLL are not meant to be prefixed.

This is why you see the _imp prefix on do_unlock_and_reload_ram_image@Texture in the output of nm. (You should get used to using dumpbin /exports instead of nm; I think it’s more reliable on Windows.)

It’s suspicious that the _imp prefix is absent when the error message is reported by link. Almost as if BUILDING_PANDA had been defined when compiling some parts of the framework directory. Make sure that BUILDING_xxx is only defined when compiling the code that is going to go into library xxx.

David


#16

Hey.

I finally got my new lib ‘wegldisplay’ compiling and linking properly. I used ‘egldisplay’ and ‘wgldisplay’ as bases for this. I have a pandagles2.lib file but no wegl[2]display.lib.

My Sources.pp for wegldisplay looks like this

#define BUILD_DIRECTORY $[HAVE_WEGL]

#define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \
                   dtoolutil:c dtoolbase:c dtool:m

#begin lib_target
  #define TARGET wegldisplay
  #define EXTRA_CDEFS OPENGLES_1
  #define LOCAL_LIBS \
    glesgsg display putil windisplay
	
  #define COMPONENT_LIBS \
    windisplay
	
	
  #define SOURCES \
    config_wegldisplay.cxx config_wegldisplay.h \
    weglGraphicsBuffer.h weglGraphicsBuffer.cxx \
    weglGraphicsPipe.I weglGraphicsPipe.cxx weglGraphicsPipe.h \
    weglGraphicsPixmap.h weglGraphicsPixmap.cxx \
    weglGraphicsWindow.h weglGraphicsWindow.cxx \
    weglGraphicsStateGuardian.h weglGraphicsStateGuardian.cxx

  #define INSTALL_HEADERS \
    weglGraphicsBuffer.h weglGraphicsPixmap.h \
    weglGraphicsPipe.I weglGraphicsPipe.h \
    weglGraphicsWindow.I weglGraphicsWindow.h
	
	#define WIN_SYS_LIBS \
		EGL GLESv2 $[WIN_SYS_LIBS]

#end lib_target

#begin lib_target
  #define TARGET wegldisplay
  #define EXTRA_CDEFS OPENGLES_2
  #define LOCAL_LIBS \
    gles2gsg display putil windisplay

  #define SOURCES \
    config_wegldisplay.cxx config_wegldisplay.h \
    weglGraphicsBuffer.h weglGraphicsBuffer.cxx \
    weglGraphicsPipe.I weglGraphicsPipe.cxx weglGraphicsPipe.h \
    weglGraphicsPixmap.h weglGraphicsPixmap.cxx \
    weglGraphicsWindow.h weglGraphicsWindow.cxx \
    weglGraphicsStateGuardian.h weglGraphicsStateGuardian.cxx

  #define INSTALL_HEADERS \
    weglGraphicsBuffer.h weglGraphicsPixmap.h \
    weglGraphicsPipe.I weglGraphicsPipe.h \
    weglGraphicsWindow.I weglGraphicsWindow.h
	
	#define WIN_SYS_LIBS \
		EGL GLESv2 $[WIN_SYS_LIBS]

#end lib_target

My Config.prc (in the etc folder) looks like this:

load-display pandagles
load-display pandagles2

I think I need help with the Config.pp files in general. I had the following error:

Cycle detected in inter-directory dependencies!
wegldisplay depends on pandagles2
pandagles2 depends on wegldisplay

When I had the second #define TARGET in wegldisplay/Sources.pp set as wegl2display. I understand what the error means, just not how to resolve it. I seem to have the same thing that egldisplay has (more or less)

Any help would be greatly appreciated. Thanks!


#17

Hmm, that’s weird. I assume you’ve added the right code to panda/metalibs/pandagles2 and panda/metalibs/pandagles already?

Maybe you’re accidentally including pandagles2.h in your code, or so?

If not, you could try calling “make cleanall” within the wegldisplay and pandagles2 directories, and invoking “ppremake” and “make install” in wegldisplay and pandagles2, respectively.


#18

I don’t include pangles directly. Would you mind taking a quick look at my changes? They are fairly small. I would appreciate a hand since I’m not clear on the build system.

I uploaded my work here if you are interested:

bitbucket.org/colinn/panda3d_wegldisplay


#19

ppremake determines directory dependency order based on the LOCAL_LIBS lines in each Sources.pp. You can also use ppremake -d dirname or ppremake -r dirname to output the forward and reverse dependencies of a particular directory, if it helps you track this down. But in general, the error message is telling you that wegldisplay is directly or indirectly linking with a library built by pandagles2, and vice-versa.

David


#20

Cool, thanks David. I’ve found the error and fixed it.

Should my wegldisplay be generating a lib? It creates object files and installs a header.


#21

Should we really have a separate wegldisplay? I was thinking of having egldisplay use the Windows interfaces in the case of Windows, and X11 in the case of Unix.


#22

It doesn’t matter to me. Once wegldisplay is working it should be easy to merge egl and wegl.

Note: eglDisplay should compile in windows (or at least it did). I found it easier to distance myself from that though to limit breakage points.


#23

Another update. I merge the wegl code into egldisplay. It should still compile and link properly in Linux. If not there are probably a few small chagnes that need making.

Unfortunately pview still can’t find a graphics pipe. Not sure what I am doing wrong.

UPDATE: I don’t have many libs, like libp3framework.


#24

Awesome, great job! I’d be happy to incorporate your changes and make sure it still works on Linux.

Do you have “load-display pandagles2” in Config.prc? Is there any warning saying that it couldn’t be loaded?


#25

Here is my prc file

load-display pandagles
load-display pandagles2
load-display egldisplay
load-display pandagl
notify-level-panagles3 spam

Here is the console output of pview

colinn@colinn-PC /cygdrive/c/panda3d-1.7.0
$ pview
Known pipe types:
(all display modules loaded.)
No graphics pipe is available!
Your Config.prc file must name at least one valid panda display
library via load-display or aux-display.

colinn@colinn-PC /cygdrive/c/panda3d-1.7.0
$ which pview
/cygdrive/c/panda3d-1.7.0/bin/pview

I can’t create a hello world app since I don’t have libp3framework. So I must be missing something.


#26

Hmm… two things could be wrong.

Firstly, try adding a “plugin-path” line to Config.prc pointing to the location of the directory that contains the pandagles dll.

Secondly, make sure the Config.prc file is loaded at all, by setting the PRC_DIR environment variable to the directory containing it.

PS. I also notice there’s “panagles3” in your Config.prc file. Shouldn’t that be “pandagles2”?


#27

(old post deleted)

I get a window now. My config.prc was in etc and I had used cygwin style paths for PRC_DIR instead of windows style paths.

Unfortunately it crashes, but at least its something.

Here is the log

Known pipe types:
  weglGraphicsPipe
(all display modules loaded.)
:display:windisplay: OS version: 6.0.2.6002 
:display:windisplay:   Service Pack 2
:display:windisplay: max Mhz 2800000000, current Mhz 2800000000 
:display:egldisplay(error): eglChooseConfig failed: EGL_SUCCESS
:display:egldisplay(error): Failed to create window surface.
:display:gsg:gles2gsg(warning): Unable to query GL_VENDOR
:display: loading display module: libpandagles2.dll

#28

The error is thrown by this code:

  int attrib_list[] = {
#ifdef OPENGLES_1
    EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT,
#endif
#ifdef OPENGLES_2
    EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
#endif
    EGL_SURFACE_TYPE, EGL_DONT_CARE,
    EGL_NONE
  };

  int num_configs = 0;
  EGLConfig configs[32];
  if (!eglChooseConfig(_egl_display, attrib_list, configs, 32, &num_configs) || num_configs <= 0) {
    egldisplay_cat.error() << "eglChooseConfig failed: "
      << get_egl_error_string(eglGetError()) << "\n";
    return;
  }

Because eglGetError() apparently returns EGL_SUCCESS, I can assume that it just returns no available configs.

Are you sure that EGL is supposed to work? The code asks for a GLES2 renderable, does your device really support GLES2? Otherwise you should try the pandagles renderer.


#29

It should work. I have some sample running from another project.

I’ve added file/line prints to the error cats.


#30

Do you know what could be different between the Panda3D code and the sample code?


#31

It is hard to say. My sample is all in one file so it’s easier to follow. I’m still workout out the use of Pipes, Buffers, and Windows


#32

Hey.

Been away for a while. I had to shift priority back to some other work.

Anyways. I’ve got the display set up. I had to change the config options for eglChooseConfig to work. I’ve since encountered two problems. The first was that Panda couldn’t find an appropriate set of FrameBuffer properties. It could only get hardware_accel=1, not RGB, ALPHA, DEPTH, and BACK BUFFER…which seemed strange. To just hack past this is I commented out the code which adds those missing properties.

Next I get this

Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call.  This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.

// stack

 	>	libpandagles_d.dll!GLESGraphicsStateGuardian::prepare_vertex_buffer(GeomVertexArrayData * data=0x02272a44)  Line 3569	C++
 	libpanda_d.dll!PreparedGraphicsObjects::prepare_vertex_buffer_now(GeomVertexArrayData * data=0x02272a44, GraphicsStateGuardianBase * gsg=0x0306e424)  Line 955 + 0x16 bytes	C++
 	libpanda_d.dll!GeomVertexArrayData::prepare_now(PreparedGraphicsObjects * prepared_objects=0x0306ea1c, GraphicsStateGuardianBase * gsg=0x0306e424)  Line 286 + 0x10 bytes	C++
 	libpandagles_d.dll!GLESGraphicsStateGuardian::setup_array_data(const unsigned char * & client_pointer=0xcccccccc, const GeomVertexArrayDataHandle * array_reader=0x0227007c, bool force=false)  Line 3724 + 0x37 bytes	C++
 	libpandagles_d.dll!GLESGraphicsStateGuardian::update_standard_vertex_arrays(bool force=false)  Line 2642 + 0x15 bytes	C++
 	libpandagles_d.dll!GLESGraphicsStateGuardian::begin_draw_primitives(const GeomPipelineReader * geom_reader=0x0080f434, const GeomMunger * munger=0x02272514, const GeomVertexDataPipelineReader * data_reader=0x0080f408, bool force=false)  Line 2500 + 0xd bytes	C++
 	libpanda_d.dll!GeomPipelineReader::draw(GraphicsStateGuardianBase * gsg=0x0306e424, const GeomMunger * munger=0x02272514, const GeomVertexDataPipelineReader * data_reader=0x0080f408, bool force=false)  Line 1781 + 0x23 bytes	C++
 	libpanda_d.dll!Geom::draw(GraphicsStateGuardianBase * gsg=0x0306e424, const GeomMunger * munger=0x02272514, const GeomVertexData * vertex_data=0x02272928, bool force=false, Thread * current_thread=0x02fcd46c)  Line 1219 + 0x19 bytes	C++
 	libpanda_d.dll!CullableObject::draw_inline(GraphicsStateGuardianBase * gsg=0x0306e424, bool force=false, Thread * current_thread=0x02fcd46c)  Line 252	C++
 	libpanda_d.dll!CullableObject::draw(GraphicsStateGuardianBase * gsg=0x0306e424, bool force=false, Thread * current_thread=0x02fcd46c)  Line 144	C++
 	libpanda_d.dll!CullHandler::draw(CullableObject * object=0x022723d8, GraphicsStateGuardianBase * gsg=0x0306e424, bool force=false, Thread * current_thread=0x02fcd46c)  Line 27	C++
 	libpanda_d.dll!CullBinStateSorted::draw(bool force=false, Thread * current_thread=0x02fcd46c)  Line 90 + 0x19 bytes	C++
 	libpanda_d.dll!CullResult::draw(Thread * current_thread=0x02fcd46c)  Line 277 + 0x31 bytes	C++
 	libpanda_d.dll!GraphicsEngine::do_draw(CullResult * cull_result=0x030906ac, SceneSetup * scene_setup=0x03090dcc, GraphicsOutput * win=0x030685e4, DisplayRegion * dr=0x03088ee4, Thread * current_thread=0x02fcd46c)  Line 1895	C++
 	libpanda_d.dll!GraphicsEngine::draw_bins(GraphicsOutput * win=0x030685e4, DisplayRegion * dr=0x03088ee4, Thread * current_thread=0x02fcd46c)  Line 1535	C++
 	libpanda_d.dll!GraphicsEngine::draw_bins(const ov_set<PointerTo<GraphicsOutput>,IndirectLess<GraphicsOutput> > & wlist={...}, Thread * current_thread=0x02fcd46c)  Line 1490	C++
 	libpanda_d.dll!GraphicsEngine::WindowRenderer::do_frame(GraphicsEngine * engine=0x0306711c, Thread * current_thread=0x02fcd46c)  Line 2468	C++
 	libpanda_d.dll!GraphicsEngine::render_frame()  Line 738	C++
 	libframework_d.dll!PandaFramework::task_igloop(GenericAsyncTask * task=0x0226b868, void * data=0x0040d178)  Line 1567 + 0x15 bytes	C++
 	libpanda_d.dll!GenericAsyncTask::do_task()  Line 76 + 0x1b bytes	C++
 	libpanda_d.dll!AsyncTask::unlock_and_do_task()  Line 455 + 0xf bytes	C++
 	libpanda_d.dll!AsyncTaskChain::service_one_task(AsyncTaskChain::AsyncTaskChainThread * thread=0x00000000)  Line 770 + 0xf bytes	C++
 	libpanda_d.dll!AsyncTaskChain::do_poll()  Line 1306	C++
 	libpanda_d.dll!AsyncTaskManager::poll()  Line 547	C++
 	libframework_d.dll!PandaFramework::do_frame(Thread * current_thread=0x02fcd46c)  Line 832 + 0xe bytes	C++
 	libframework_d.dll!PandaFramework::main_loop()  Line 847 + 0x13 bytes	C++
 	pview.exe!main(int argc=1, char * * argv=0x03059650)  Line 370 + 0xd bytes	C++
 	pview.exe!__tmainCRTStartup()  Line 586 + 0x19 bytes	C
 	pview.exe!mainCRTStartup()  Line 403	C
 	kernel32.dll!7561d0e9() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]	
 	ntdll.dll!76e219bb() 	
 	ntdll.dll!76e2198e() 	
 	libdtool_d.dll!std::_Move_backward_opt<Filename *,Filename *,std::random_access_iterator_tag,std::_Undefined_move_tag>(Filename * _First=, Filename * _Last=, Filename * _Dest=, std::random_access_iterator_tag _First_dest_cat={...}, std::_Undefined_move_tag __formal={...}, std::_Undefined_move_tag __formal={...})  Line 2755 + 0xa bytes	C++

The line appears to be

if (GLCAT.is_debug() && CLP(debug_buffers)) {

This is compiled with OPTIMIZE=1

The following errors are reported

:display: loading display module: libpandagles_d.dll
Known pipe types:
  weglGraphicsPipe
(all display modules loaded.)
:display:windisplay: OS version: 6.0.2.6002 
:display:windisplay:   Service Pack 2
:display:windisplay: max Mhz 2800000000, current Mhz 2800000000 
:display:gsg:glesgsg(warning): Multitexture advertised as supported by OpenGL runtime, but could not get pointers to extension functions.
:display:gsg:glesgsg(error): at 8321 of c:\panda3d-1.7.0\panda\src\glstuff\glGraphicsStateGuardian_src.cxx : GL error 1280

#33

I was able to get rid of the GL enumeration warning by forcibly disabling cube map support.


#34

So no ideas on the ESP crash posted above?