Ticket #853 (closed bug: fixed)

Opened 13 years ago

Last modified 12 years ago

Can't load OpenGL

Reported by: fperrad Owned by: NotFound
Priority: normal Milestone:
Component: library Version: 1.3.0
Severity: medium Keywords:
Cc: japhb Language:
Patch status: obsolete Platform: all

Description

When I try to load OpenGL from Lua, I obtain the following error :

Could not find non-existent sub _gl_func_list
    current instr.: 'lua;OpenGL;_wrap_opengl_entry_points' pc 193 (runtime\parrot\library\OpenGL.pir:197)
    called from Sub 'lua;OpenGL;_opengl_init' pc 18 (runtime\parrot\library\OpenGL.pir:93)
    called from Sub 'lua;glut;luaopen_glut' pc 9 (src\lib\glut.pir:33)
    called from Sub 'lua;package;require' pc 59368 (src/lib/luapackage.pir:495)
    called from Sub '&main_10' pc 110 (EVAL_1:47)
    called from Sub 'docall' pc 53370 (src/lib/luaaux.pir:999)
    called from Sub 'handle_script' pc 51155 (lua.pir:303)
    called from Sub 'main' pc 50642 (lua.pir:123)

The attached patch fixes this issue, OpenGL_funcs.pir becomes an included part of OpenGL.pir instead of an independent PBC file.

In a long term step, we could refactor config/gen/opengl.pm with template, and merge OpenGL.pir & OpenGL_funcs.pir in an single file.

Attachments

load-opengl.patch Download (1.8 KB) - added by fperrad 13 years ago.

Change History

Changed 13 years ago by fperrad

  Changed 13 years ago by japhb

This is effectively a partial reversion of NotFound's commit (r38693) that does the opposite:

https://trac.parrot.org/parrot/changeset/38693

I originally used .include, as you have it in the patch, but NotFound went through and converted it to runtime load ... I don't know his reasoning.

  Changed 13 years ago by NotFound

  • owner set to NotFound
  • status changed from new to assigned

I'll take a look at it tomorrow.

  Changed 13 years ago by japhb

From #parrot, with minor edits:

<fperrad> japhb, what do you think about a refactor of config/gen/opengl.pm with template ? <japhb> fperrad: I like having OpenGL.pir and OpenGL_funcs.pir separate, because OpenGL.pir is hand-written code, and OpenGL_funcs.pir is completely generated. It makes it easy to be clear about what is safe to hand-edit and what is not. It also makes clear what parts opengl.pm alters and what it does not. That's why I went with separate files and a .include. There is also the GLUT callbacks library, which is pseudo-templated; but there's not a whole lot I can do about that cleanly. The GLUT callbacks library is an abomination, and definitely not thread- or interpreter-safe, but there's just no other way with current Parrot NCI. <japhb> Adding this Q/A to ticket .... <fperrad> japhb, OK for the record

  Changed 13 years ago by japhb

More from #parrot:

<japhb> fperrad: I'm also curious why this problem affects Lua and not Rakudo or pure PIR ...?

<japhb> When NotFound made his original patch, I was OK with it because it didn't seem to have any obvious negative impact at the time (and thus I had no real reason to object).

<fperrad> japhb, OpenGL.pir uses the namespace 'OpenGL', but OpenGL_funcs.pir not

I try to add this namespace in OpenGL_funcs.pir, but it isn't enought

<japhb> Oh interesting ... That sounds buggish.

follow-up: ↓ 7   Changed 13 years ago by NotFound

I've been unable to reproduce the problem. Maybe I'm building lua in a wrong way.

I added an example of using opengl from HLL in r40167. Maybe the differences between static-triangle and static-triangle-hll might explain, or help to diagnose, the problem.

  Changed 13 years ago by NotFound

Reason to no use include:

If you include a file from the library directory you need to specify his path, and then you have problems about deprecated search paths and about build tree vs installed paths.

If you really need to use include, better put the file in the include directory.

in reply to: ↑ 5   Changed 13 years ago by fperrad

  • patch changed from new to obsolete

Replying to NotFound:

I've been unable to reproduce the problem. Maybe I'm building lua in a wrong way. I added an example of using opengl from HLL in r40167. Maybe the differences between static-triangle and static-triangle-hll might explain, or help to diagnose, the problem.

I refactor Lua with this new example. See  http://github.com/fperrad/lua/commit/517eef4331b706973d88aa4deeea6d1e12990d9d

Thanks.

François

  Changed 12 years ago by fperrad

  • status changed from assigned to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.