Re: [Vala] Allow passing ref/out as a pointer.




Thanks, but this code doesn't work either:
GLuint[2] a = {20000,50000};
glGenBuffers (2, &a[0]);
stdout.printf ("Buffers: " + ((uint)a[0]).to_string () + ", "+ ((uint)a[1]).to_string () + "\n");
...
public extern void glGenBuffers (GLsizei n, GLuint * ids);

Output(same):
Buffers: 20000, 50000

Someone knows why?

Thanks
Tal

Subject: Re: [Vala] Allow passing ref/out as a pointer.
From: sergej reich googlemail com
To: tal_hd hotmail com
CC: vala-list gnome org
Date: Sun, 15 Apr 2012 12:17:15 +0200

I've written a vapi for GLEW that addresses most of the issues the GL
vapi has. In the end I ended up using pointers everywhere since it's
much simpler.
I've used it in my projects for a while now, if you want I can put it up
somewhere.

Am Sonntag, den 15.04.2012, 12:53 +0300 schrieb Tal Hadad:
Luca, when I test it now I get that the method don't do anything (and
it should).
Test code:
GLuint[2] a = {20000,50000};
glGenBuffers (a);
stdout.printf ("Buffers: " + ((uint)a[0]).to_string () + ", "+ ((uint)a[1]).to_string () + "\n");
....
public extern void glGenBuffers ([CCode (array_length_pos = 0.1)] GL.GLuint[] buffers);

And output:
Buffers: 20000, 50000

So it seems that it don't do anything, when it should change values.
My OpenGL hardware&drivers are fine.
The other GL code in my program display a simple triangle that
works 100%, and so is Compiz Fusion.

Do you know what is the problem?

Tal

Date: Sun, 15 Apr 2012 11:26:41 +0200
Subject: Re: [Vala] Allow passing ref/out as a pointer.
From: lethalman88 gmail com
To: tal_hd hotmail com
CC: vala-list gnome org

2012/4/15 Tal Hadad <tal_hd hotmail com>



 There's two GL vapis in ExternalBinding page. I'm talking about

the one inside the brackets[0]. This is part of the vapi:

public static void glGenBuffers (GL.GLsizei n, [CCode (array_length = false, array_null_terminated = 
true)] out unowned GL.GLuint[] buffers);

public static void glDeleteBuffers (GL.GLsizei n, [CCode (array_length = false, array_null_terminated = 
true)] GL.GLuint[]? buffers);



The GL C API is:

void glGenBuffers (GLsize n, GLuint *buffers)

void glDeleteBuffers (GLsize n, GLuint *buffers)



Which n is the count of buffers, and buffers represent a pointer

to the first element.



The generation of method glGenBuffers is completely buggy (i.e.

failed even if I pass an GL.GLuint[] array).

However, the generation of the second method is OK.



Take a look at the first method. What the parameter should be?

Is it should be "out GL.GLuint first_element"?

public static void glGenBuffers ([CCode (array_length_pos = 0.1)] GL.GLuint[] buffers);
public static void glDeleteBuffers ([CCode (array_length_pos = 0.1)] GL.GLuint[] buffers);

_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list

                                          


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]