If you just need a couple functions, you can just declare them as "extern" in your vala files. otherwise it's better to write a vapi.
Could I see an example of using extern this way? ... I tried starting to write a .vapi that would cover glext. I changed my mind about GL3 and instead decided to write to GL2, believing there would be a better chance it'd be on the target machine. After some time, I got somewhere in terms of covering what is in glext.h, but then I had all these other questions... 1. I didn't know how to translate the preprocessing guards for particular versions of the api, like #ifndef GL_VERSION_2_0. 2. Because I couldn't do the former, I wasn't sure how I would be able to do compile time checks to see if an extension was supported 3. Can I perform dlopen and dlsym from Vala? If not, how else would I dynamically load libraries and check to see if a particular extension exists during runtime 4. If I wanted to avoid figuring out how to do 2 or 3 myself, I could always use GLew or GLee, except...I end up at my original problem of there not being bindings for what I want... Attached is the glext.vapi file I started writing. I may not use Vala for my project afterall, but perhaps this will help someone else out. --- On Mon, 2/22/10, Abderrahim Kitouni <a kitouni gmail com> wrote:
From: Abderrahim Kitouni <a kitouni gmail com> Subject: Re: [Vala] Using OpenGL 3.0 from Vala To: "Tristin Celestin" <tristin_celestin yahoo com> Cc: Vala-list gnome org Date: Monday, February 22, 2010, 9:00 AM Hi, 2010/2/22 Tristin Celestin <tristin_celestin yahoo com>:I am trying to use OpenGL 3.0 from Vala, but I noticethat only up to OpenGL 1.3 is defined in the .vapifile. The methods relevant to me are defined inGL/glext.h. How would I access the functionsdeclared there?If you just need a couple functions, you can just declare them as "extern" in your vala files. otherwise it's better to write a vapi.Is it enough to just write a .vapi file for myselfreferencing the necessary functions, or should Imodify gl.vapi? glext.h had a lot of methods, and I amnot going to be able to cover all of themmyself.You don't need to bind all the methods, you can just bind the methods you need. I think it's fine to add to gl.vapi directly (maybe in an #if GL_3.0 or something), but GL bindings aren't included with vala, so it may be a good idea to contact the maintainer. HTH, Abderrahim
Attachment:
glext.vapi
Description: Binary data