Re: [Vala] Binding an OpenGL function with GLchar* parameters
- From: Jan Hudec <bulb ucw cz>
- To: Tristin Celestin <tristin_celestin yahoo com>
- Cc: vala-list gnome org
- Subject: Re: [Vala] Binding an OpenGL function with GLchar* parameters
- Date: Sun, 14 Mar 2010 16:48:06 +0100
On Sat, Mar 13, 2010 at 12:14:23 -0800, Tristin Celestin wrote:
If I don't include the out specifier, how will glGetActiveAttrib change
the value of name?
Whenever you pass an object to some function, without 'out', the function
can't give you another object, but it can change the properties of the
object. And the same really happens with string. It can't give you different
string, but it can change the content of the one you passed in. Which is what
this function does.
You could make the API nicer from vala by creating a wrapper in the .vapi,
that would allocate a string, call the underlying function and return the
string via normal out parameter.
Am 13.03.2010 16:32, Tristin Celestin wrote:
I have a OpenGL function with this declaration:
GLAPI void APIENTRY glGetActiveAttrib (GLuint program, GLuint index,
GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar
*name);
The parameters length, size, type, and name are all outputs of the
function. My question is how to deal with the name parameter. A GLchar*
is just a char*.
Is this the correct way to bind the above function?
public static void glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, out GLsizei
length, out GLint size, out GLenum type, out string name);
Just 'string', not 'out string', otherwise it woule be 'GLchar **'.
--
Jan 'Bulb' Hudec <bulb ucw cz>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]