From tommyline at ...670... Mon Jul 4 14:28:03 2011 From: tommyline at ...670... (Tomek) Date: Mon, 04 Jul 2011 14:28:03 +0200 Subject: [Gambas-devel] My first attempts to extend GL and GLU components. Message-ID: Hello to all Hero Programmers! Since I got intersted in OpenGL programming in Gambas, I begun to search for source files and add some functions I felt I could use. I'm not a C programmer, I just understand some code, so using analogy I tried to attach Evaluators to GL. It works ok, but my question is if copying the array and then pointing to it is the only method to pass a pointer to the array from gambas to library? It slows down the process greatly. I would be really happy if someone could point me to some documentation about how the combination of Gambas and C works in components. I attach my files and chcnaged GL.c file, so you can evaluate them, little Bezier curve project and please don't be too harsh on me, I'm just a beginner :) Regards Tomek ---------------------------------------------------------------- Dom marzen - kup lub wynajmij taniej niz myslisz! Szukaj >> http://linkint.pl/f29e5 -------------- next part -------------- A non-text attachment was scrubbed... Name: GL.c Type: text/x-csrc Size: 42683 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: GLeval.c Type: text/x-csrc Size: 7337 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: GLeval.h Type: text/x-chdr Size: 1655 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: bezier.tar Type: application/x-tar Size: 10677 bytes Desc: not available URL: From lordheavym at ...176... Mon Jul 4 22:00:25 2011 From: lordheavym at ...176... (Laurent Carlier) Date: Mon, 4 Jul 2011 22:00:25 +0200 Subject: [Gambas-devel] My first attempts to extend GL and GLU components. In-Reply-To: References: Message-ID: 2011/7/4 Tomek > Hello to all Hero Programmers! > Since I got intersted in OpenGL programming in Gambas, I begun to search > for source files and add some functions I felt I could use. > I'm not a C programmer, I just understand some code, so using analogy I > tried to attach Evaluators to GL. It works ok, but my question is if copying > the array and then pointing to it is the only method to pass a pointer to > the array from gambas to library? It slows down the process greatly. I would > be really happy if someone could point me to some documentation about how > the combination of Gambas and C works in components. > I attach my files and chcnaged GL.c file, so you can evaluate them, little > Bezier curve project and please don't be too harsh on me, I'm just a > beginner :) > > Regards > Tomek > Nice job! Personnaly, i prefer working with patches (tips: svn diff > mypatch.diff), Benoit prefers modified files. Some quick comments: - No need to implement double and float support, i"ve only added Float datatype, but it use double internally ( http://gambasdoc.org/help/cat/datatypes) so the GL API show Gl.Map1f(), but we use glMap1d() - Associated glGets are already here (see GLinfo.c) , it seem you have properly added the associated constants. - Typos in the methods, the first letter of the variables must be in uppercase ((target)i(u1)f -> (Target)i(U1)f) - Gambas doesn't provide native C arrays support, so there is no other ways to provide C arrays to GL functions. But i don't think it slow down so much the code. - Perhaps the interface of maps functions can be made easier for user, i need to look at. Alsoe perhaps if Array sent to functions is too small, we should zeroing missing bytes. - Perhaps other things :-p I hope we will see more work :-) ++ -------------- next part -------------- An HTML attachment was scrubbed... URL: From lordheavym at ...176... Mon Jul 4 22:45:38 2011 From: lordheavym at ...176... (Laurent Carlier) Date: Mon, 4 Jul 2011 22:45:38 +0200 Subject: [Gambas-devel] My first attempts to extend GL and GLU components. In-Reply-To: References: Message-ID: 2011/7/4 Laurent Carlier > 2011/7/4 Tomek > >> Hello to all Hero Programmers! >> Since I got intersted in OpenGL programming in Gambas, I begun to search >> for source files and add some functions I felt I could use. >> I'm not a C programmer, I just understand some code, so using analogy I >> tried to attach Evaluators to GL. It works ok, but my question is if copying >> the array and then pointing to it is the only method to pass a pointer to >> the array from gambas to library? It slows down the process greatly. I would >> be really happy if someone could point me to some documentation about how >> the combination of Gambas and C works in components. >> I attach my files and chcnaged GL.c file, so you can evaluate them, little >> Bezier curve project and please don't be too harsh on me, I'm just a >> beginner :) >> >> Regards >> Tomek >> > > Nice job! > > Personnaly, i prefer working with patches (tips: svn diff > mypatch.diff), > Benoit prefers modified files. > > Some quick comments: > - No need to implement double and float support, i"ve only added Float > datatype, but it use double internally ( > http://gambasdoc.org/help/cat/datatypes) so the GL API show Gl.Map1f(), > but we use glMap1d() > - Associated glGets are already here (see GLinfo.c) , it seem you have > properly added the associated constants. > - Typos in the methods, the first letter of the variables must be in > uppercase ((target)i(u1)f -> (Target)i(U1)f) > - Gambas doesn't provide native C arrays support, so there is no other ways > to provide C arrays to GL functions. But i don't think it slow down so much > the code. > - Perhaps the interface of maps functions can be made easier for user, i > need to look at. Alsoe perhaps if Array sent to functions is too small, we > should zeroing missing bytes. > - Perhaps other things :-p > > I hope we will see more work :-) > > ++ > > Ok, you can find now your work in the svn trunk (after a small cleanup). I've not tested your example, but it's building fine. Feel free to send comments in case of bugs, or if you have additionnal work :-) Thanks ++ -------------- next part -------------- An HTML attachment was scrubbed... URL: From kevinfishburne at ...590... Mon Jul 4 23:03:58 2011 From: kevinfishburne at ...590... (Kevin Fishburne) Date: Mon, 04 Jul 2011 17:03:58 -0400 Subject: [Gambas-devel] My first attempts to extend GL and GLU components. In-Reply-To: References: Message-ID: <4E122ABE.3000309@...590...> On 07/04/2011 08:28 AM, Tomek wrote: > Hello to all Hero Programmers! > Since I got intersted in OpenGL programming in Gambas, I begun to search for source files and add some functions I felt I could use. > I'm not a C programmer, I just understand some code, so using analogy I tried to attach Evaluators to GL. It works ok, but my question is if copying the array and then pointing to it is the only method to pass a pointer to the array from gambas to library? It slows down the process greatly. I would be really happy if someone could point me to some documentation about how the combination of Gambas and C works in components. > I attach my files and chcnaged GL.c file, so you can evaluate them, little Bezier curve project and please don't be too harsh on me, I'm just a beginner :) Hi Tomek, that is some very good news. I'm considering changing the code for my project to use OpenGL instead of SDL and just saw that GLU is now a component of gb3. Being that I don't know anything about OpenGL, GLU would probably be a lot easier to learn. I noticed there is no component documentation for it. Is the spec completely implemented and just not documented yet? -- Kevin Fishburne Eight Virtues www: http://sales.eightvirtues.com e-mail: sales at ...590... phone: (770) 853-6271 From tommyline at ...670... Mon Jul 4 23:24:50 2011 From: tommyline at ...670... (Tomek) Date: Mon, 04 Jul 2011 23:24:50 +0200 Subject: [Gambas-devel] I have also added Nurbs and some of the quadratics Message-ID: Thank you Laurent, it's nice to be usefull. I have also added NURBS and some of the quadratics - mostly shapes - to GLU. They work too, as my tests showed, so maybe you could add them too? I have ported around 20 OpenGL tutorials from http://nehe.gamedev.net/ , some of them are already on gambasforum.com, maybe we could put them into the tutorials on the gambasdoc page? ---------------------------------------------------------------- Znajdz samochod idealny dla siebie! Szukaj >> http://linkint.pl/f29e2 -------------- next part -------------- A non-text attachment was scrubbed... Name: GLU.c Type: text/x-csrc Size: 4559 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: GLUnurb.c Type: text/x-csrc Size: 4139 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: GLUnurb.h Type: text/x-chdr Size: 1600 bytes Desc: not available URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: GLUnurb.lo URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: GLUquadratic.c Type: text/x-csrc Size: 2850 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: GLUquadratic.h Type: text/x-chdr Size: 1246 bytes Desc: not available URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: GLUquadratic.lo URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: nurb.tar Type: application/x-tar Size: 59648 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: collision.tar Type: application/x-tar Size: 191514 bytes Desc: not available URL: From gambas at ...1... Tue Jul 5 00:31:15 2011 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Tue, 5 Jul 2011 00:31:15 +0200 Subject: [Gambas-devel] My first attempts to extend GL and GLU components. In-Reply-To: References: Message-ID: <201107050031.15777.gambas@...1...> > 2011/7/4 Tomek > > > Hello to all Hero Programmers! > > Since I got intersted in OpenGL programming in Gambas, I begun to search > > for source files and add some functions I felt I could use. > > I'm not a C programmer, I just understand some code, so using analogy I > > tried to attach Evaluators to GL. It works ok, but my question is if > > copying the array and then pointing to it is the only method to pass a > > pointer to the array from gambas to library? It slows down the process > > greatly. I would be really happy if someone could point me to some > > documentation about how the combination of Gambas and C works in > > components. > > I attach my files and chcnaged GL.c file, so you can evaluate them, > > little Bezier curve project and please don't be too harsh on me, I'm > > just a beginner :) > > > > Regards > > Tomek > > Nice job! Yes, cool. > > Personnaly, i prefer working with patches (tips: svn diff > mypatch.diff), > Benoit prefers modified files. Actually I just like subversion commits that implies no job for me! :-) Either you send your code to Laurent (I don't know OpenGL enough), either you get a sourceforge account and do your commits directly. Beware that I'm trying to release Gambas 3, so please be careful with your changes! :-) > > Some quick comments: > - No need to implement double and float support, i"ve only added Float > datatype, but it use double internally ( > http://gambasdoc.org/help/cat/datatypes) so the GL API show Gl.Map1f(), but > we use glMap1d() > - Associated glGets are already here (see GLinfo.c) , it seem you have > properly added the associated constants. > - Typos in the methods, the first letter of the variables must be in > uppercase ((target)i(u1)f -> (Target)i(U1)f) > - Gambas doesn't provide native C arrays support, so there is no other ways > to provide C arrays to GL functions. But i don't think it slow down so much > the code. I think it does partially: If you receive a Gambas array (for example a Float[]), and you need to send a double[] to a C function, you can use the GB.Array.Get(array, 0) to get a pointer to the array data, and GB.Array.Count(array) to get the array length. Then you must be aware of who owns the data, and if the data must be kept around after the C function has terminated. If you want to keep the data for a while, use GB.Ref() and GB.Unref() on the array. If the C OpenGL function takes the ownership of the data (it should be specified in the OpenGL documentation), then use GB.Ref() to prevent the Gambas array to be freed. If you cannot use GB.Ref(), because you cannot store the array pointer between two functions calls, then you have to copy the data. You have to copy the data too if, for example, you receive a Float[] (i.e. a double[] in C) and have to pass a float[] to the C function (i.e. a Single[] in Gambas). Then the question is: why does the function argument (for example GlMap2f) take a Float[] and not a Single[]? Now Gambas 3 can convert arrays on the fly, so it will do the copy for you. More code for me, less code for you! Regards, -- Beno?t Minisini From gambas at ...1... Tue Jul 5 00:46:51 2011 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Tue, 5 Jul 2011 00:46:51 +0200 Subject: [Gambas-devel] I have also added Nurbs and some of the quadratics In-Reply-To: References: Message-ID: <201107050046.51790.gambas@...1...> > Thank you Laurent, it's nice to be usefull. > I have also added NURBS and some of the quadratics - mostly shapes - to > GLU. They work too, as my tests showed, so maybe you could add them too? I > have ported around 20 OpenGL tutorials from http://nehe.gamedev.net/ , > some of them are already on gambasforum.com, maybe we could put them into > the tutorials on the gambasdoc page? Maybe you can put all of them inside one project that I will put with the Gambas examples? What do you think? -- Beno?t Minisini From kevinfishburne at ...590... Tue Jul 5 02:45:59 2011 From: kevinfishburne at ...590... (Kevin Fishburne) Date: Mon, 04 Jul 2011 20:45:59 -0400 Subject: [Gambas-devel] My first attempts to extend GL and GLU components. In-Reply-To: <4E122ABE.3000309@...590...> References: <4E122ABE.3000309@...590...> Message-ID: <4E125EC7.9030701@...590...> On 07/04/2011 05:03 PM, Kevin Fishburne wrote: > Hi Tomek, that is some very good news. > > I'm considering changing the code for my project to use OpenGL instead > of SDL and just saw that GLU is now a component of gb3. Being that I > don't know anything about OpenGL, GLU would probably be a lot easier > to learn. I noticed there is no component documentation for it. Is the > spec completely implemented and just not documented yet? > Please ignore that. I realize now that not all the GLU API has been implemented, and that was what Tomek was basically saying. Sorry, and again thank you very much Tomek for working on this (and Laurent!). -- Kevin Fishburne Eight Virtues www: http://sales.eightvirtues.com e-mail: sales at ...590... phone: (770) 853-6271 From tommyline at ...670... Tue Jul 5 07:24:21 2011 From: tommyline at ...670... (Tomek) Date: Tue, 05 Jul 2011 07:24:21 +0200 Subject: [Gambas-devel] GL Examples Message-ID: Hi Benoit! >From my own experience, if I put everything in one big demo, it would be too much for most of the people (if that's what you mean?), even Gambas Gears was initially too much for me to understand, that's why I went for tutorials online. There is already place for OpenGL tutorials on on gambasdoc page for step by step tutorials. I think it would be best to show people the way from very basics to something more. On the other hand, some of the projects could be shown as examples, but I just don't know how to put them there in organised fashion. Any help would be appreciated :) Tomek. ---------------------------------------------------------- Kredyt gotowkowy nr 1! Teraz do 150 000zl bez zaswiadczen! http://linkint.pl/f29e1 From gambas at ...1... Tue Jul 5 11:13:16 2011 From: gambas at ...1... (=?utf-8?q?Beno=C3=AEt_Minisini?=) Date: Tue, 5 Jul 2011 11:13:16 +0200 Subject: [Gambas-devel] GL Examples In-Reply-To: References: Message-ID: <201107051113.17026.gambas@...1...> > Hi Benoit! > > From my own experience, if I put everything in one big demo, it would be > too much for most of the people (if that's what you mean?), even Gambas > Gears was initially too much for me to understand, that's why I went for > tutorials online. There is already place for OpenGL tutorials on on > gambasdoc page for step by step tutorials. I think it would be best to > show people the way from very basics to something more. On the other > hand, some of the projects could be shown as examples, but I just don't > know how to put them there in organised fashion. Any help would be > appreciated :) > > Tomek. > I don't know. It depends on the size of the "nehe" examples. As these examples are documented on the nehe website, putting all of them in the same project should not be a problem. Look at the "Painting" gambas example: I'm thinking about something like that. But do as you like. If you make me twenty Gambas projects, I think I will be able to merge them into one sole example. Regards, -- Beno?t Minisini