[Gambas-devel] A few comment about Tommy's changes

tommyline at ...674... tommyline at ...674...
Fri Aug 5 23:12:37 CEST 2011


This sounds promising, Benoit, I was thinking about hiding as much of the sensitive points as possible from the user, This way we can 
do all the pointer related operations inside the class without the user interference.
It all gives me a big headache, I tried to implement changes to nurbs too, but it works awkwardly. 

And of course I need any help you can give me, with as many examples as possible.

By the way, did you make my project work? I can't.

Tomek.



----- Original Message -----
From: "Benoît Minisini" <gambas at ...1...>
To: "mailing list for gambas developers" <gambas-devel at ...494...t>
Sent: Friday, 5 August, 2011 9:33:05 PM
Subject: Re: [Gambas-devel] A few comment about Tommy's changes

> Benoit,
> Did you get my project?
> It now gets through the glu.NewQuadric() and creates GluQuadric object,
> but: -It gets segfault with glu.QuadricNormals and glu.QuadricTextures
> -It doesn't crash with glu.Sphere, .Cylinder and .Disk but there's nothing
> produced on screen. The question is what exactly is passed as GluQuadric
> to the functions, as they work ok with pointer :
> 
> gluQuadricTexture (GLUquadric* quad, GLboolean texture);
> 
> and if the command:
> 
> GLUquadric *quad = VARG(Quad);
> 
> passes pointer to quad.
> 
> Tomek.
> 

Of course: VARG(Quad) returns the pointer to the Gambas object, not the 
pointer to the 'GLUquadric *' object. You must:

1) Use GB.CheckObject() to ensure that you don't receive a NULL reference.
2) Use ((CGLUQUADRIC *)VARG(Quad))->quadric to get the 'GLUquadric *' pointer.

Now let's talk about "object oriented programming". You should centralize all 
functions related to quadric inside the same source file. For example 
'cgluquadric.c'. Because they are related.

Moreover, you can transform the GluQuadric class into a "true" class with 
methods.

In other words, instead of doing:

	glu.QuadricNormals(quadric, gl.GL_SMOOTH)

The Gambas user will do something like that:

	quadric.Normals(gl.GL_SMOOTH).

To do that, you will all corresponding methods to the GluQuadric Gambas class.

Of course, this does not look like normal OpenGL GLU programming, but it is 
real object oriented programming.

And you can have both. You can:
- Keep the old GLU.xxx(quadric, yyy) functions.
- Add equivalent GluQuadric.xxx(yyy) methods.

The first Gambas methods is implemented by the 

	DECLARE_METHOD(GLUxxx, GB_OBJECT quadric; yyy)

function. Wheread the second Gambas method will be implemented in the 
GluQuadric class by:

	DECLARE_METHOD(GluQuadric_xxx, yyy)

Of course, if you are a good developer, both functions will share their code.

Tell me if you want me to make an example of that.

Regards,

-- 
Benoît Minisini

------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
Gambas-devel mailing list
Gambas-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-devel




More information about the Devel mailing list