You can subscribe to this list here.
2001 |
Jan
(226) |
Feb
(139) |
Mar
(156) |
Apr
(95) |
May
(181) |
Jun
(166) |
Jul
(80) |
Aug
(59) |
Sep
(69) |
Oct
(83) |
Nov
(142) |
Dec
(33) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(42) |
Feb
(91) |
Mar
(76) |
Apr
(113) |
May
(67) |
Jun
(68) |
Jul
(37) |
Aug
(41) |
Sep
(16) |
Oct
(135) |
Nov
(51) |
Dec
(21) |
2003 |
Jan
(37) |
Feb
(36) |
Mar
(37) |
Apr
(103) |
May
(68) |
Jun
(70) |
Jul
(77) |
Aug
(12) |
Sep
(9) |
Oct
(53) |
Nov
(88) |
Dec
(63) |
2004 |
Jan
(263) |
Feb
(106) |
Mar
(36) |
Apr
(21) |
May
(21) |
Jun
(34) |
Jul
(33) |
Aug
(34) |
Sep
(35) |
Oct
(21) |
Nov
(43) |
Dec
(63) |
2005 |
Jan
(28) |
Feb
(42) |
Mar
(29) |
Apr
(14) |
May
(41) |
Jun
(20) |
Jul
(65) |
Aug
(136) |
Sep
(41) |
Oct
(74) |
Nov
(34) |
Dec
(94) |
2006 |
Jan
(85) |
Feb
(94) |
Mar
(68) |
Apr
(103) |
May
(66) |
Jun
(51) |
Jul
(24) |
Aug
(56) |
Sep
(57) |
Oct
(85) |
Nov
(73) |
Dec
(68) |
2007 |
Jan
(59) |
Feb
(32) |
Mar
(13) |
Apr
(32) |
May
(36) |
Jun
(36) |
Jul
(64) |
Aug
(35) |
Sep
(19) |
Oct
(10) |
Nov
(13) |
Dec
(20) |
2008 |
Jan
(26) |
Feb
(41) |
Mar
(19) |
Apr
(24) |
May
(16) |
Jun
(33) |
Jul
(34) |
Aug
(4) |
Sep
(11) |
Oct
|
Nov
(26) |
Dec
(23) |
2009 |
Jan
(5) |
Feb
(2) |
Mar
(21) |
Apr
(16) |
May
(13) |
Jun
(6) |
Jul
(34) |
Aug
(2) |
Sep
(1) |
Oct
(7) |
Nov
(5) |
Dec
(24) |
2010 |
Jan
(3) |
Feb
(5) |
Mar
(6) |
Apr
(6) |
May
(14) |
Jun
(6) |
Jul
(1) |
Aug
(12) |
Sep
(10) |
Oct
(9) |
Nov
|
Dec
(2) |
2011 |
Jan
(4) |
Feb
(5) |
Mar
(30) |
Apr
(1) |
May
(2) |
Jun
(5) |
Jul
(3) |
Aug
(2) |
Sep
(3) |
Oct
|
Nov
(6) |
Dec
|
2012 |
Jan
|
Feb
(10) |
Mar
|
Apr
|
May
(1) |
Jun
(3) |
Jul
(1) |
Aug
|
Sep
(2) |
Oct
|
Nov
(2) |
Dec
(4) |
2013 |
Jan
(5) |
Feb
(3) |
Mar
|
Apr
(3) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
(2) |
Feb
|
Mar
|
Apr
(1) |
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(9) |
Nov
(7) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(5) |
Dec
|
2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Glenn L. <pe...@ne...> - 2009-07-14 06:16:43
|
On approximately 7/13/2009 12:51 AM, came the following characters from the keyboard of Reini Urban: > 2009/7/13 Glenn Linderman <pe...@ne...>: > >> So at the present time, I'm not sure >> 1) if there are any active developers >> 2) if there are any that would agree that moving the documentation to >> separate files would be a good thing >> 3) who would apply your documentation patches to the repository, even if >> you submitted them that way, rather than creating your own web site >> >> I don't remember if Reini has a commit bit or not, >> > > No, I don't think I have a commit bit. > > >> but I don't think he's ever built a release. >> > > No, I'm doing all the cygwin releases since years. > That's right! I knew you were involved somehow, but couldn't remember how. Of course building the cygwin package, is taking a release, and building and packaging it. Really, building a release is likely simple, although likely changed since I last did it, in the sense of the file manipulations required, but the hard part comes in doing sufficient testing to be convinced that it is a good release. And there are more parts now than last I did it. I worked only on very focused bug fixes, even then. >> There have been significant changes to >> sourceforge in the intervening period, as well, so it would take some >> learning curve for me (and probably for Reini, although maybe he's up on >> the sourceforge changes from other projects) to attempt to build a >> release, methinks. Or maybe Rob will poke his head in here, and say >> that he could find some time to commit some doc changes and build a new >> release... >> > > I maintain phpwiki on sf.net and it gets worse and worse. > Could you elaborate? I'm not sure what this is. > But posting releases is still simple. > That sounds good. |
From: RIchard N. <rp...@ib...> - 2009-07-13 14:25:41
|
I'm willing to host the web site. I have extra space and bandwidth for this project. per...@li... wrote: > Send Perl-Win32-GUI-Users mailing list submissions to > per...@li... > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > or, via email, send a message with subject or body 'help' to > per...@li... > > You can reach the person managing the list at > per...@li... > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Perl-Win32-GUI-Users digest..." > > > Today's Topics: > > 1. Re: Win32::GUI Documentation (Reini Urban) > 2. Re: Win32::GUI Documentation (Reini Urban) > 3. Re: Win32::GUI Documentation (Kevin Marshall) > 4. Re: Win32::GUI Documentation (Glenn Linderman) > 5. Re: Win32::GUI Documentation (Kevin Marshall) > 6. Re: Win32::GUI Documentation (Glenn Linderman) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Sun, 12 Jul 2009 14:12:35 +0200 > From: Reini Urban <ru...@x-...> > Subject: Re: [perl-win32-gui-users] Win32::GUI Documentation > To: Kevin Marshall <kej...@ho...> > Cc: Perl-Win32-GUI-Users List > <per...@li...> > Message-ID: <4A5...@x-...> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > Kevin Marshall schrieb: > >> Hey everyone, >> >> After digging through the Win32::GUI source and Win32 API Documentation, >> I have created some updated Win32::GUI documentation. Let's face it, the >> docs are lacking in some areas, so I decided to add to some of the >> information that is provided. >> >> If anyone would like a copy of the updated docs, send me an email >> directly (off the mailing lists). If anyone has any questions, comments, >> or suggestions about the docs, please post them on the mailing lists. >> >> These docs are a work in progress, so if anyone has any ideas for any >> extra content that could be included, such as more tutorials, I would be >> happy to look into it. >> > > Where is the patch? The documentation is mainly just POD. > -- NEW FILE UPLOADER ADDED Richard Noble IBK Software T: 646-807-2228 F: 646-536-3180 C: 917-642-9850 rp...@ib... To upload files use this link: http://www.ibksoftware.com/fileloader/ 419 West 154 Street New York, NY 10032 This e-mail is IBK Software confidential and may not be redistributed without permission of IBK Software. |
From: Reini U. <ru...@x-...> - 2009-07-13 07:51:52
|
2009/7/13 Glenn Linderman <pe...@ne...>: > So at the present time, I'm not sure > 1) if there are any active developers > 2) if there are any that would agree that moving the documentation to > separate files would be a good thing > 3) who would apply your documentation patches to the repository, even if > you submitted them that way, rather than creating your own web site > > I don't remember if Reini has a commit bit or not, No, I don't think I have a commit bit. > but I don't think he's ever built a release. No, I'm doing all the cygwin releases since years. > There have been significant changes to > sourceforge in the intervening period, as well, so it would take some > learning curve for me (and probably for Reini, although maybe he's up on > the sourceforge changes from other projects) to attempt to build a > release, methinks. Or maybe Rob will poke his head in here, and say > that he could find some time to commit some doc changes and build a new > release... I maintain phpwiki on sf.net and it gets worse and worse. But posting releases is still simple. -- Reini Urban http://phpwiki.org/ http://murbreak.at/ |
From: Jack C. <ja...@mo...> - 2009-07-13 04:20:06
|
I haven't read the new docs either, and can only speak as a user of Win32::GUI, but I do use it a lot, and find the current doc situation challenging. The Right Thing To Do is probably fixing the POD, but right often gets in the way of done. If correct docs can be posted somewhere, that's better than nothing. I'm willing to help out insofar as I can. Jack On 7/12/09, Glenn Linderman <pe...@ne...> wrote: > On approximately 7/12/2009 7:49 PM, came the following characters from > the keyboard of Kevin Marshall: >> Glenn, >> >> Yes, you're right, the documentation for the module is contained >> within the source code and is extracted during the build process. For >> a module this large, it probably made sense in the beginning to use >> this method to create the docs, but as the module has grown, I imagine >> it has become more difficult to manage. Perhaps moving the >> documentation into their own files is something for the developers to >> look at for the next release. Most of the changes I made to the docs >> involved replacing the TBD sections with the required information, as >> well as supplying more information about input parameters and return >> values for most of the functions. > > Seems to me that the larger a project gets, the better it is for the > documents to be in the source... because if something is changing in the > code, the change to the documentation is right there too. > > However, you seem to hold the opinion that having separate documentation > files would be better in some unstated way? > > I haven't had a chance to read your updated docs, but the kinds of > changes you describe sound extremely helpful. > > While I hold a commit bit to the repository, and have made some minor > bug fixes in the past, the primary developer in recent years has been > Rob May... but I think he got busy with other things, and hasn't been > very active here lately, which is sad for this module, as he was doing > some excellent things to it. > > So at the present time, I'm not sure > 1) if there are any active developers > 2) if there are any that would agree that moving the documentation to > separate files would be a good thing > 3) who would apply your documentation patches to the repository, even if > you submitted them that way, rather than creating your own web site > > I don't remember if Reini has a commit bit or not, but I don't think > he's ever built a release. There have been significant changes to > sourceforge in the intervening period, as well, so it would take some > learning curve for me (and probably for Reini, although maybe he's up on > the sourceforge changes from other projects) to attempt to build a > release, methinks. Or maybe Rob will poke his head in here, and say > that he could find some time to commit some doc changes and build a new > release... > > ------------------------------------------------------------------------------ > Enter the BlackBerry Developer Challenge > This is your chance to win up to $100,000 in prizes! For a limited time, > vendors submitting new applications to BlackBerry App World(TM) will have > the opportunity to enter the BlackBerry Developer Challenge. See full prize > details at: http://p.sf.net/sfu/Challenge > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Per...@li... > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > http://perl-win32-gui.sourceforge.net/ > > -- Sent from my mobile device "I spent all me tin with the ladies drinking gin, So across the Western ocean I must wander" -- traditional |
From: Glenn L. <pe...@ne...> - 2009-07-13 03:33:24
|
On approximately 7/12/2009 7:49 PM, came the following characters from the keyboard of Kevin Marshall: > Glenn, > > Yes, you're right, the documentation for the module is contained > within the source code and is extracted during the build process. For > a module this large, it probably made sense in the beginning to use > this method to create the docs, but as the module has grown, I imagine > it has become more difficult to manage. Perhaps moving the > documentation into their own files is something for the developers to > look at for the next release. Most of the changes I made to the docs > involved replacing the TBD sections with the required information, as > well as supplying more information about input parameters and return > values for most of the functions. Seems to me that the larger a project gets, the better it is for the documents to be in the source... because if something is changing in the code, the change to the documentation is right there too. However, you seem to hold the opinion that having separate documentation files would be better in some unstated way? I haven't had a chance to read your updated docs, but the kinds of changes you describe sound extremely helpful. While I hold a commit bit to the repository, and have made some minor bug fixes in the past, the primary developer in recent years has been Rob May... but I think he got busy with other things, and hasn't been very active here lately, which is sad for this module, as he was doing some excellent things to it. So at the present time, I'm not sure 1) if there are any active developers 2) if there are any that would agree that moving the documentation to separate files would be a good thing 3) who would apply your documentation patches to the repository, even if you submitted them that way, rather than creating your own web site I don't remember if Reini has a commit bit or not, but I don't think he's ever built a release. There have been significant changes to sourceforge in the intervening period, as well, so it would take some learning curve for me (and probably for Reini, although maybe he's up on the sourceforge changes from other projects) to attempt to build a release, methinks. Or maybe Rob will poke his head in here, and say that he could find some time to commit some doc changes and build a new release... |
From: Kevin M. <kej...@ho...> - 2009-07-13 02:49:14
|
Glenn, Yes, you're right, the documentation for the module is contained within the source code and is extracted during the build process. For a module this large, it probably made sense in the beginning to use this method to create the docs, but as the module has grown, I imagine it has become more difficult to manage. Perhaps moving the documentation into their own files is something for the developers to look at for the next release. Most of the changes I made to the docs involved replacing the TBD sections with the required information, as well as supplying more information about input parameters and return values for most of the functions. Kevin. > Date: Sun, 12 Jul 2009 18:23:30 -0700 > From: pe...@ne... > To: kej...@ho... > CC: ru...@x-...; per...@li... > Subject: Re: [perl-win32-gui-users] Win32::GUI Documentation > > On approximately 7/12/2009 5:41 PM, came the following characters from > the keyboard of Kevin Marshall: > > Reini, > > > > I understand where you are coming from, a diff would make replacement > > of the original files easier. I was, however, considering a complete > > rewrite of the documentation, including the structure, which would > > make patching the existing files interesting. An alternative would be > > to copy my docs over the docs generated in the build process, before > > doing "make install". Another way would be to edit the makefile to > > prevent the docs being generated, then move my docs into their place, > > then do "make install". For those people who use the PPMs they > > have less options. The best they can do is copy my docs over the > > originals after installing the PPM. It was suggested I set up a > > dedicated website for the documentation. This would certainly overcome > > any of these problems. > > Well, a dedicated website for the documentation only works-around these > problems. I think presently the source for the documentation is in the > source code files for the modules. If that is preserved, it is more > likely that the documentation will get updated when the code gets updated. > > Even if you do a complete rewrite of the documentation, if it is not > integrated with the module source in some way, it will likely not get > maintained over time. > > That said, I agree that the documentation could use some help; last I > looked at it, there were lots of TBD areas. > > _________________________________________________________________ View photos of singles in your area Click Here http://dating.ninemsn.com.au/search/search.aspx?exec=go&tp=q&gc=2&tr=1&lage=18&uage=55&cl=14&sl=0&dist=50&po=1&do=2&trackingid=1046138&r2s=1&_t=773166090&_r=WLM_EndText |
From: Glenn L. <pe...@ne...> - 2009-07-13 01:50:20
|
On approximately 7/12/2009 5:41 PM, came the following characters from the keyboard of Kevin Marshall: > Reini, > > I understand where you are coming from, a diff would make replacement > of the original files easier. I was, however, considering a complete > rewrite of the documentation, including the structure, which would > make patching the existing files interesting. An alternative would be > to copy my docs over the docs generated in the build process, before > doing "make install". Another way would be to edit the makefile to > prevent the docs being generated, then move my docs into their place, > then do "make install". For those people who use the PPMs they > have less options. The best they can do is copy my docs over the > originals after installing the PPM. It was suggested I set up a > dedicated website for the documentation. This would certainly overcome > any of these problems. Well, a dedicated website for the documentation only works-around these problems. I think presently the source for the documentation is in the source code files for the modules. If that is preserved, it is more likely that the documentation will get updated when the code gets updated. Even if you do a complete rewrite of the documentation, if it is not integrated with the module source in some way, it will likely not get maintained over time. That said, I agree that the documentation could use some help; last I looked at it, there were lots of TBD areas. |
From: Kevin M. <kej...@ho...> - 2009-07-13 00:41:36
|
Reini, I understand where you are coming from, a diff would make replacement of the original files easier. I was, however, considering a complete rewrite of the documentation, including the structure, which would make patching the existing files interesting. An alternative would be to copy my docs over the docs generated in the build process, before doing "make install". Another way would be to edit the makefile to prevent the docs being generated, then move my docs into their place, then do "make install". For those people who use the PPMs they have less options. The best they can do is copy my docs over the originals after installing the PPM. It was suggested I set up a dedicated website for the documentation. This would certainly overcome any of these problems. Kevin. > Date: Sun, 12 Jul 2009 20:25:06 +0200 > From: ru...@x-... > To: kej...@ho...; per...@li... > Subject: Re: Win32::GUI Documentation > > Kevin Marshall schrieb: > > Reini, > > > > Here is my updated version of the Win32::GUI Documentation. If you have > > any questions or comments, please post them on the mailing list. > > That's the problem and that's what I've thought. > You were fixing the *generated* pod files, but not the source of the > documentation. The source for those pods are the comments in the > modules. On the next *make poddocs* your tree is overwritten. > > A diff will be preferred then, to merge it into the sources. I'll see > what I can do. > > > Attachment: > > Name: Win32-GUI-Docs-1.01.tar.gz > > Size: 148643 B > > MD5: 3095e99e8ae34c97fb1187ff432064bd > > > > The docs are in POD format. If you want them in HTML, use pod2html. > > Hope these are useful. > > -- > Reini Urban > http://phpwiki.org/ http://murbreak.at/ _________________________________________________________________ Looking for a place to rent, share or buy this winter? Find your next place with Ninemsn property http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Edomain%2Ecom%2Eau%2F%3Fs%5Fcid%3DFDMedia%3ANineMSN%5FHotmail%5FTagline&_t=774152450&_r=Domain_tagline&_m=EXT |
From: Reini U. <ru...@x-...> - 2009-07-12 18:23:21
|
Kevin Marshall schrieb: > Reini, > > Here is my updated version of the Win32::GUI Documentation. If you have > any questions or comments, please post them on the mailing list. That's the problem and that's what I've thought. You were fixing the *generated* pod files, but not the source of the documentation. The source for those pods are the comments in the modules. On the next *make poddocs* your tree is overwritten. A diff will be preferred then, to merge it into the sources. I'll see what I can do. > Attachment: > Name: Win32-GUI-Docs-1.01.tar.gz > Size: 148643 B > MD5: 3095e99e8ae34c97fb1187ff432064bd > > The docs are in POD format. If you want them in HTML, use pod2html. > Hope these are useful. -- Reini Urban http://phpwiki.org/ http://murbreak.at/ |
From: Reini U. <ru...@x-...> - 2009-07-12 12:10:53
|
Kevin Marshall schrieb: > Hey everyone, > > After digging through the Win32::GUI source and Win32 API Documentation, > I have created some updated Win32::GUI documentation. Let's face it, the > docs are lacking in some areas, so I decided to add to some of the > information that is provided. > > If anyone would like a copy of the updated docs, send me an email > directly (off the mailing lists). If anyone has any questions, comments, > or suggestions about the docs, please post them on the mailing lists. > > These docs are a work in progress, so if anyone has any ideas for any > extra content that could be included, such as more tutorials, I would be > happy to look into it. Where is the patch? The documentation is mainly just POD. -- Reini Urban http://phpwiki.org/ http://murbreak.at/ |
From: Kevin M. <kej...@ho...> - 2009-07-12 10:18:54
|
Guys, I got a suggestion from Peter to set up a dedicated website for the Win32::GUI Documentation, which would include things such as more examples and tutorials, illustrations, etc. I wouldn't mind some feedback on what people think about this idea. Kevin. From: kej...@ho... To: per...@li... Date: Sun, 12 Jul 2009 17:38:06 +1030 Subject: [perl-win32-gui-users] Win32::GUI Documentation Hey everyone, After digging through the Win32::GUI source and Win32 API Documentation, I have created some updated Win32::GUI documentation. Let's face it, the docs are lacking in some areas, so I decided to add to some of the information that is provided. If anyone would like a copy of the updated docs, send me an email directly (off the mailing lists). If anyone has any questions, comments, or suggestions about the docs, please post them on the mailing lists. These docs are a work in progress, so if anyone has any ideas for any extra content that could be included, such as more tutorials, I would be happy to look into it. Kevin. Make ninemsn your homepage! Get the latest news, goss and sport _________________________________________________________________ View photos of singles in your area Click Here http://dating.ninemsn.com.au/search/search.aspx?exec=go&tp=q&gc=2&tr=1&lage=18&uage=55&cl=14&sl=0&dist=50&po=1&do=2&trackingid=1046138&r2s=1&_t=773166090&_r=WLM_EndText |
From: Kevin M. <kej...@ho...> - 2009-07-12 07:08:11
|
Hey everyone, After digging through the Win32::GUI source and Win32 API Documentation, I have created some updated Win32::GUI documentation. Let's face it, the docs are lacking in some areas, so I decided to add to some of the information that is provided. If anyone would like a copy of the updated docs, send me an email directly (off the mailing lists). If anyone has any questions, comments, or suggestions about the docs, please post them on the mailing lists. These docs are a work in progress, so if anyone has any ideas for any extra content that could be included, such as more tutorials, I would be happy to look into it. Kevin. _________________________________________________________________ Get the latest news, goss and sport Make ninemsn your homepage! http://windowslive.ninemsn.com.au/article.aspx?id=813730 |
From: Peter O. <my_...@ya...> - 2009-07-11 15:46:26
|
Hi thanks kevin for the solutions, it is working perfectly. i have attached an example based on your second example, with a main window which have two buttons to display either a Triangle or a cube on a child window, the downloadable code from here: http://rapidshare.com/files/254608681/win32gui_opengl.pl best wishes the attached same code may displayed incorrectly, for some formatting problems: use strict; use warnings; #these constants are needed fWin32::API::Type->typedefor SetPixelFormat() but aren't defined in Win32::GUI use constant { PFD_TYPE_RGBA => 0, PFD_DOUBLEBUFFER => 0x00000001, PFD_DRAW_TO_WINDOW => 0x00000004, PFD_SUPPORT_OPENGL => 0x00000020, PFD_MAIN_PLANE => 0, }; use OpenGL qw(:glfunctions :glconstants :glufunctions); #use OpenGL qw(:all); use Win32::API; use Win32::GUI qw(); use Win32::GUI::Carp qw(warningsToDialog fatalsToDialog immediateWarnings winwarn windie); use Win32::GUI::Constants qw(IDI_APPLICATION WS_CLIPCHILDREN WS_CLIPSIBLINGS WM_CREATE WM_SIZE WM_CLOSE VK_ESCAPE CW_USEDEFAULT MB_OK MB_ICONEXCLAMATION); my $g_HDC; #global handle to device context my $hRC; #handle to rendering context my $rtri = 0.0; my $xrot = 0; my $yrot = 0; my $flag = 1; my $objectXRot = 0.0; my $objectYRot = 0.0; my $objectZRot = 0.0; #define PIXELFORMATDESCRIPTOR struct used for the SetPixelFormat function #refer to the Windows SDK documentation for more info about this structure Win32::API::Struct->typedef( PIXELFORMATDESCRIPTOR => qw( WORD nSize; WORD nVersion; DWORD dwFlags; BYTE iPixelType; BYTE cColorBits; BYTE cRedBits; BYTE cRedShift; BYTE cGreenBits; BYTE cGreenShift; BYTE cBlueBits; BYTE cBlueShift; BYTE cAlphaBits; BYTE cAlphaShift; BYTE cAccumBits; BYTE cAccumRedBits; BYTE cAccumGreenBits; BYTE cAccumBlueBits; BYTE cAccumAlphaBits; BYTE cDepthBits; BYTE cStencilBits; BYTE cAuxBuffers; BYTE iLayerType; BYTE bReserved; DWORD dwLayerMask; DWORD dwVisibleMask; DWORD dwDamageMask; ) ); #needed for the wglMakeCurrent functions Win32::API::Type->typedef('HGLRC', 'HANDLE'); #import some extra functions #more info can be found in the Windows SDK documentation #exchanges the front and back buffers of the current pixel format Win32::API->Import('gdi32', 'BOOL SwapBuffers(HDC hdc);') or windie "Win32::API->Import(SwapBuffers): $^E"; #attempts to match an appropriate pixel format supported by a device context to # a given pixel format specification. Win32::API->Import('gdi32', 'int ChoosePixelFormat(HDC hdc, PIXELFORMATDESCRIPTOR * ppfd);') or windie "Win32::API->Import(ChoosePixelFormat): $^E"; #sets the pixel format of the specified device context to the format specified # by the iPixelFormat index returned from ChoosePixelFormat(). Win32::API->Import('gdi32', 'BOOL SetPixelFormat(HDC hdc, int iPixelFormat, PIXELFORMATDESCRIPTOR * ppfd);') or windie "Win32::API->Import(SetPixelFormat): $^E"; #creates a new OpenGL rendering context, which is suitable for drawing on the # device referenced by hdc. Win32::API->Import('opengl32', 'HGLRC wglCreateContext(HDC hdc);') or windie "Win32::API->Import(wglCreateContext): $^E"; #makes a specified OpenGL rendering context the calling thread's current # rendering context. Win32::API->Import('opengl32', 'BOOL wglMakeCurrent(HDC hdc, HGLRC hglrc);') or windie "Win32::API->Import(wglMakeCurrent): $^E"; #deletes a specified OpenGL rendering context. Win32::API->Import('opengl32', 'BOOL wglDeleteContext(HGLRC hglrc);') or windie "Win32::API->Import(wglDeleteContext): $^E"; #;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; my $main = Win32::GUI::Window->new( -name => "main", -size => [640,480], -text => "OpenGL Child Windows", -pushstyle => WS_CLIPCHILDREN | WS_CLIPSIBLINGS, ); my $child = Win32::GUI::Window->new( -name => "child", -size => [$main->ScaleWidth() / 2, $main->ScaleHeight() / 2], -pos => [200,100], -pushstyle => 'WS_CHILD', -parent => $main, -onTerminate => sub { wglMakeCurrent($g_HDC->Handle(), 0); wglDeleteContext($hRC); return -1; }, -onResize => sub { my $self = shift; return 0 unless $self; my $height = $self->ScaleHeight(); my $width = $self->ScaleWidth(); $height = 1 if $height == 0; glViewport(0,0,$width,$height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(54.0, $width / $height, 1.0, 1000.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); return 1; }, ); #;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $main->AddButton( -text => "Triangle", -name => "Button1", -left => 23, -top => 10, -width => 56, -height => 36, -foreground => 0, ); $main->AddButton( -text => "Cube", -name => "Button2", -left => 23, -top => 55, -width => 56, -height => 36, -foreground => 0, ); my $textfield = $main->AddTextfield( -text => "", -name => "Textfield_1", -left => 120, -top => 10, -width => 150, -height => 100, -multiline => 1, -vscroll => 1, ); unless($main){ windie("Cannot create window: $^E"); } $main->SetIcon(Win32::GUI::Icon->new(IDI_APPLICATION)); #set window icon #WM_CREATE $g_HDC = $child->GetDC(); #set global device context to device context of main window unless(SetupPixelFormat($g_HDC->Handle())){ #setup pixel format for device context exit 1; #exit if setup fails } $hRC = wglCreateContext($g_HDC->Handle()); #create rendering context used by OpenGL to draw wglMakeCurrent($g_HDC->Handle(), $hRC); #select rendering context $hRC into $g_HDC #Initialize OpenGL #my ($width, $height) = (300,200); glClearColor(0.0, 0.0, 0.0, 0.0); # Enables clearing of the Depth buffer glClearDepth(1.0); # The type of depth test to do glDepthFunc(GL_LESS); # Enables depth testing with that type glEnable(GL_DEPTH_TEST); # Enables smooth color shading glShadeModel(GL_SMOOTH); # Reset the projection matrix glMatrixMode(GL_PROJECTION); glLoadIdentity; # Calculate the aspect ratio of the Window #gluPerspective(45.0, $width/$height, 0.1, 100.0); # Reset the modelview matrix $child->Show(); $main->Show(); $child->SetFocus(); while(Win32::GUI::DoEvents() != -1){ Render(); } #This function is used to set the pixel format for the device context. # Accepts a handle to the device context of the window and returns true if succeeds # or false if fails. #Adapted from code from OpenGL Game Programming (Premier Press, 2004) sub SetupPixelFormat { my $hDC = shift; #is a handle to DC my $nPixelFormat; my $pfd = Win32::API::Struct->new('PIXELFORMATDESCRIPTOR'); #create new structure $pfd->{nSize} = $pfd->sizeof(); #return sizeof structure $pfd->{nVersion} = 1; #default version $pfd->{dwFlags} = PFD_DRAW_TO_WINDOW | #window drawing support PFD_SUPPORT_OPENGL | #OpenGL support PFD_DOUBLEBUFFER; #double buffering support $pfd->{iPixelType} = PFD_TYPE_RGBA; #rgba colour mode $pfd->{cColorBits} = 32; #32 bit colour mode $pfd->{cRedBits} = 0; #ignore colour bits $pfd->{cRedShift} = 0; # $pfd->{cGreenBits} = 0; # $pfd->{cGreenShift} = 0; # $pfd->{cBlueBits} = 0; # $pfd->{cBlueShift} = 0; # $pfd->{cAlphaBits} = 0; #not alpha buffer $pfd->{cAlphaShift} = 0; #ignore alpha shift bit $pfd->{cAccumBits} = 0; #no accumulation buffer $pfd->{cAccumRedBits} = 0; #ignore accumulation bits $pfd->{cAccumGreenBits} = 0; # $pfd->{cAccumBlueBits} = 0; # $pfd->{cAccumAlphaBits} = 0; # $pfd->{cDepthBits} = 16; #16 bit z-buffer size $pfd->{cStencilBits} = 0; #no stencil buffer $pfd->{cAuxBuffers} = 0; #no auxiliary buffer $pfd->{iLayerType} = PFD_MAIN_PLANE; #main drawing plane $pfd->{bReserved} = 0; #reserved $pfd->{dwLayerMask} = 0; #layer masks ignored $pfd->{dwVisibleMask} = 0; # $pfd->{dwDamageMask} = 0; # # choose best matching pixel format unless( $nPixelFormat = ChoosePixelFormat($hDC, $pfd) ){ winwarn("Can't find an appropriate pixel format"); return 0; } # set pixel format to device context unless( SetPixelFormat($hDC, $nPixelFormat, $pfd) ){ winwarn("Unable to set pixel format"); return 0; } return 1; } #This function draws the cube of points. The colour of each point is based on its position #Adapted from code from OpenGL Game Programming (Premier Press, 2004) sub DrawTriangle { glRotatef( $yrot, 0.0, 1.0, 0.0 ); glRotatef( $xrot, 1.0, 0.0, 0.0 ); glPushMatrix(); glRotatef($rtri, 0.0, 1.0, 0.0); glBegin(GL_POLYGON); glColor3f(1.0, 0.0, 0.0); glVertex3f( 0.0, 50.0, 0.0); # Top vertex glColor3f(0.0, 1.0, 0.0); # Set The Color To Green glVertex3f( 50.0, -50.0, 0.0); # Bottom right vertex glColor3f(0.0, 0.0, 1.0); # Set The Color To Blue glVertex3f(-50.0, -50.0, 0.0); glEnd(); $rtri = $rtri + 2.0; glPopMatrix(); } sub DrawCube { my $size = 40; glRotatef($objectXRot, 1.0, 0.0, 0.0); glRotatef($objectYRot, 0.0, 1.0, 0.0); glRotatef($objectZRot, 0.0, 0.0, 1.0); glPushMatrix(); glRotatef($rtri, 0.0, 1.0, 0.0); glPushMatrix(); glScalef($size,$size,$size); glBegin(GL_QUADS); # bottom face glColor3f(0.0,0.0,0.0); #black glVertex3f(-1.0,-1.0,-1.0); glColor3f(1.0,0.0,0.0); #red glVertex3f(1.0,-1.0,-1.0); glColor3f(1.0,0.0,1.0); #magenta glVertex3f(1.0,-1.0,1.0); glColor3f(0.0,0.0,1.0); #blue glVertex3f(-1.0,-1.0,1.0); # front face glColor3f(0.0,0.0,0.0); #black glVertex3f(-1.0,-1.0,-1.0); glColor3f(0.0,1.0,0.0); #green glVertex3f(-1.0,1.0,-1.0); glColor3f(1.0,1.0,0.0); #yellow glVertex3f(1.0,1.0,-1.0); glColor3f(1.0,0.0,0.0); #red glVertex3f(1.0,-1.0,-1.0); # right face glColor3f(0.0,0.0,0.0); #black glVertex3f(-1.0, -1.0, -1.0); glColor3f(0.0,0.0,1.0); #blue glVertex3f(-1.0,-1.0,1.0); glColor3f(0.0,1.0,1.0); #cyan glVertex3f(-1.0,1.0,1.0); glColor3f(0.0,1.0,0.0); #green glVertex3f(-1.0,1.0,-1.0); # left face glColor3f(1.0,1.0,1.0); #white glVertex3f(1.0,1.0,1.0); glColor3f(1.0,0.0,1.0); #magenta glVertex3f(1.0,-1.0,1.0); glColor3f(1.0,0.0,0.0); #red glVertex3f(1.0,-1.0,-1.0); glColor3f(1.0,1.0,0.0); #yellow glVertex3f(1.0,1.0,-1.0); # top face glColor3f(1.0,1.0,1.0); #white glVertex3f(1.0,1.0,1.0); glColor3f(1.0,1.0,0.0); #yelllow glVertex3f(1.0,1.0,-1.0); glColor3f(0.0,1.0,0.0); #green glVertex3f(-1.0,1.0,-1.0); glColor3f(0.0,1.0,1.0); #cyan glVertex3f(-1.0,1.0,1.0); # back face glColor3f(1.0,1.0,1.0); #white glVertex3f(1.0,1.0,1.0); glColor3f(0.0,1.0,1.0); #cyan glVertex3f(-1.0,1.0,1.0); glColor3f(0.0,0.0,1.0); #blue glVertex3f(-1.0,-1.0,1.0); glColor3f(1.0,0.0,1.0); #magenta glVertex3f(1.0,-1.0,1.0); glEnd(); $objectXRot += 0.5; $objectYRot += 0.5; $objectZRot += 0.5; glPopMatrix(); } #This function is used to draw the cube and is called every frame #Adapted from code from OpenGL Game Programming (Premier Press, 2004) sub Render { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); #clear color and depth buffer glLoadIdentity(); #replaces the current matrix with the identity matrix.. glTranslatef(0.0, 0.0, -150.0); #move to 0,0,-150 glPushMatrix(); #save current matrix if ($flag == 1){DrawTriangle();}; #draw cube if ($flag == 2){DrawCube();}; #draw triangle glPopMatrix(); #restore matrix glFlush(); #clear buffers SwapBuffers($g_HDC->Handle()); #exchange front and back buffers of device context } #Conveniently, the Windows specific functions for setup of OpenGL accept and return # handles to windows or contexts, which are just numbers, and the handles to # these are stored in the Window and DC objects created by Win32::GUI. This method # provides an easy access to this value. Placing the method in the #Win32::GUI::DC # package allows both Windows and DCs to use it. sub Button1_Click { $textfield->Append("OpenGL example : rotating triangle\r\n"); $flag = 1; $main->SetFocus(); # } sub Button2_Click { $textfield->Append("OpenGL example : rotating Cube\r\n"); $flag = 2; $main->SetFocus(); # } package Win32::GUI::DC; sub Handle { return shift->{-handle}; } __END__ |
From: Kevin M. <kej...@ho...> - 2009-07-11 08:34:55
|
Peter, Nice to know that these examples have been useful to people. I'll admit that I am no OpenGL or Win32 API expert, so there may be different (or better) solutions to these problems. If anyone has any different solutions, I would be glad to here them. In response to your first question, the reason that the triangle no longer rotates is due to the keyboard focus. When the button is clicked, the focus switches to the button, and any keyboard events are sent to it, instead of the window, where the onKeyDown events are defined. To fix this problem, there are a number of solutions. The first is to define an onKeyDown event for the button, exactly the same as the window. This works, but may be prohibitive with more controls. An alternative is to set the focus back to the window as part of the button Click event, eg. sub Button1_Click { $textfield->Append("OpenGL example : rotating triangle\r\n"); $main->SetFocus(); #set focus back to main window } __END__ I'm sure that there are more ways to solve this problem, but these solutions should be sufficient. In response to your second question, one solution would be to create a child window and have OpenGL render to this window instead. Here is a basic example (this is missing some parts, such as the SetupPixelFormat() sub and Win32::API imports): #! c:\perl\bin\perl.exe use strict; use warnings; use OpenGL qw(:glfunctions :glconstants :glufunctions); use Win32::GUI qw(); use Win32::GUI::Carp qw(warningsToDialog fatalsToDialog immediateWarnings winwarn windie); use Win32::GUI::Constants qw(IDI_APPLICATION WS_CLIPCHILDREN WS_CLIPSIBLINGS WM_CREATE WM_SIZE WM_CLOSE WS_CHILD WS_CAPTION WS_SIZEBOX); my $g_HDC; my $hRC; my $objectXRot = 0.0; my $objectYRot = 0.0; my $objectZRot = 0.0; sub Render{ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glTranslatef(0.0, 0.0, -150.0); glPushMatrix(); glRotatef($objectXRot, 1.0, 0.0, 0.0); glRotatef($objectYRot, 0.0, 1.0, 0.0); glRotatef($objectZRot, 0.0, 0.0, 1.0); DrawCube(40.0); glPopMatrix(); glFlush(); SwapBuffers($g_HDC->Handle()); $objectXRot += 0.01; $objectYRot += 0.02; $objectZRot += 0.01; } my $main = Win32::GUI::Window->new( -name => "main", -size => [800,600], -text => "OpenGL Child Windows", -pushstyle => WS_CLIPCHILDREN | WS_CLIPSIBLINGS, ); my $child = Win32::GUI::Window->new( -name => "child", -size => [$main->ScaleWidth() / 2, $main->ScaleHeight() / 2], -pos => [0,0], -pushstyle => WS_CHILD, -parent => $main, -onTerminate => sub { wglMakeCurrent($g_HDC->Handle(), 0); wglDeleteContext($hRC); return -1; }, -onResize => sub { my $self = shift; return 0 unless $self; my $height = $self->ScaleHeight(); my $width = $self->ScaleWidth(); $height = 1 if $height == 0; glViewport(0,0,$width,$height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(54.0, $width / $height, 1.0, 1000.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); return 1; }, ); $main->SetIcon(Win32::GUI::Icon->new(IDI_APPLICATION)); $g_HDC = $child->GetDC(); SetupPixelFormat($g_HDC->Handle()); $hRC = wglCreateContext($g_HDC->Handle()); wglMakeCurrent($g_HDC->Handle(), $hRC); glShadeModel(GL_SMOOTH); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glFrontFace(GL_CCW); glClearColor(0.0, 0.0, 0.0, 0.0); $child->Show(); $main->Show(); $child->SetFocus(); while(Win32::GUI::DoEvents() != -1){ Render(); } sub main_Resize { $child->Resize($main->ScaleWidth() / 2, $main->ScaleHeight() / 2); return 1; } sub DrawCube { my $size = shift; glPushMatrix(); glScalef($size,$size,$size); glBegin(GL_QUADS); # bottom face glColor3f(0.0,0.0,0.0); #black glVertex3f(-1.0,-1.0,-1.0); glColor3f(1.0,0.0,0.0); #red glVertex3f(1.0,-1.0,-1.0); glColor3f(1.0,0.0,1.0); #magenta glVertex3f(1.0,-1.0,1.0); glColor3f(0.0,0.0,1.0); #blue glVertex3f(-1.0,-1.0,1.0); # front face glColor3f(0.0,0.0,0.0); #black glVertex3f(-1.0,-1.0,-1.0); glColor3f(0.0,1.0,0.0); #green glVertex3f(-1.0,1.0,-1.0); glColor3f(1.0,1.0,0.0); #yellow glVertex3f(1.0,1.0,-1.0); glColor3f(1.0,0.0,0.0); #red glVertex3f(1.0,-1.0,-1.0); # right face glColor3f(0.0,0.0,0.0); #black glVertex3f(-1.0, -1.0, -1.0); glColor3f(0.0,0.0,1.0); #blue glVertex3f(-1.0,-1.0,1.0); glColor3f(0.0,1.0,1.0); #cyan glVertex3f(-1.0,1.0,1.0); glColor3f(0.0,1.0,0.0); #green glVertex3f(-1.0,1.0,-1.0); # left face glColor3f(1.0,1.0,1.0); #white glVertex3f(1.0,1.0,1.0); glColor3f(1.0,0.0,1.0); #magenta glVertex3f(1.0,-1.0,1.0); glColor3f(1.0,0.0,0.0); #red glVertex3f(1.0,-1.0,-1.0); glColor3f(1.0,1.0,0.0); #yellow glVertex3f(1.0,1.0,-1.0); # top face glColor3f(1.0,1.0,1.0); #white glVertex3f(1.0,1.0,1.0); glColor3f(1.0,1.0,0.0); #yelllow glVertex3f(1.0,1.0,-1.0); glColor3f(0.0,1.0,0.0); #green glVertex3f(-1.0,1.0,-1.0); glColor3f(0.0,1.0,1.0); #cyan glVertex3f(-1.0,1.0,1.0); # back face glColor3f(1.0,1.0,1.0); #white glVertex3f(1.0,1.0,1.0); glColor3f(0.0,1.0,1.0); #cyan glVertex3f(-1.0,1.0,1.0); glColor3f(0.0,0.0,1.0); #blue glVertex3f(-1.0,-1.0,1.0); glColor3f(1.0,0.0,1.0); #magenta glVertex3f(1.0,-1.0,1.0); glEnd(); glPopMatrix(); } __END__ This example should display a rotating cube in the child window, although there is a weird bug where the child window isn't rendered to until it is resized. Can't quite pin down why this happens, but apart from that, it works fine. If anyone has any other solutions to these problems, I would be interested in hearing them. Hope this has helped. Kevin. Date: Fri, 10 Jul 2009 09:27:49 +0200 From: my....@gm... To: per...@li... Subject: [perl-win32-gui-users] win32-gui opengl hello thanks kevin for the opengl example. i have used his example to display a triangle which can be rotated in a 3D space using the up down left right keys. also added a button and a textbox, i have 2 question: 1- i can rotate the triangle by keys, until i click on the button to display some text in the textbox, why is this behaviour, and how i can restore the triangle rotating after clicking the button. 2- is it possible to make the opengl window smaller than the win32gui window !! best wishes peter _________________________________________________________________ Looking for a new car this winter? Let us help with car news, reviews and more http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fsecure%2Dau%2Eimrworldwide%2Ecom%2Fcgi%2Dbin%2Fa%2Fci%5F450304%2Fet%5F2%2Fcg%5F801459%2Fpi%5F1004813%2Fai%5F859641&_t=762955845&_r=tig_OCT07&_m=EXT |
From: peter <my....@gm...> - 2009-07-10 07:33:03
|
hello thanks kevin for the opengl example. i have used his example to display a triangle which can be rotated in a 3D space using the up down left right keys. also added a button and a textbox, i have 2 question: 1- i can rotate the triangle by keys, until i click on the button to display some text in the textbox, why is this behaviour, and how i can restore the triangle rotating after clicking the button. 2- is it possible to make the opengl window smaller than the win32gui window !! best wishes attached below the code, and for your convenience from here: http://rapidshare.com/files/254072142/triangle.rar peter use strict; use warnings; #these constants are needed for SetPixelFormat() but aren't defined in Win32::GUI use constant { PFD_TYPE_RGBA => 0, PFD_DOUBLEBUFFER => 0x00000001, PFD_DRAW_TO_WINDOW => 0x00000004, PFD_SUPPORT_OPENGL => 0x00000020, PFD_MAIN_PLANE => 0, }; use OpenGL qw(:glfunctions :glconstants :glufunctions); #use OpenGL qw(:all); use Win32::API; use Win32::GUI qw(); use Win32::GUI::Carp qw(warningsToDialog fatalsToDialog immediateWarnings winwarn windie); use Win32::GUI::Constants qw(IDI_APPLICATION WS_CLIPCHILDREN WS_CLIPSIBLINGS WM_CREATE WM_SIZE WM_CLOSE VK_ESCAPE CW_USEDEFAULT MB_OK MB_ICONEXCLAMATION); my $g_HDC; #global handle to device context my $hRC; #handle to rendering context my $rtri = 0.0; my $xrot = 0; my $yrot = 0; #define PIXELFORMATDESCRIPTOR struct used for the SetPixelFormat function #refer to the Windows SDK documentation for more info about this structure Win32::API::Struct->typedef( PIXELFORMATDESCRIPTOR => qw( WORD nSize; WORD nVersion; DWORD dwFlags; BYTE iPixelType; BYTE cColorBits; BYTE cRedBits; BYTE cRedShift; BYTE cGreenBits; BYTE cGreenShift; BYTE cBlueBits; BYTE cBlueShift; BYTE cAlphaBits; BYTE cAlphaShift; BYTE cAccumBits; BYTE cAccumRedBits; BYTE cAccumGreenBits; BYTE cAccumBlueBits; BYTE cAccumAlphaBits; BYTE cDepthBits; BYTE cStencilBits; BYTE cAuxBuffers; BYTE iLayerType; BYTE bReserved; DWORD dwLayerMask; DWORD dwVisibleMask; DWORD dwDamageMask; ) ); #needed for the wglMakeCurrent functions Win32::API::Type->typedef('HGLRC', 'HANDLE'); #import some extra functions #more info can be found in the Windows SDK documentation #exchanges the front and back buffers of the current pixel format Win32::API->Import('gdi32', 'BOOL SwapBuffers(HDC hdc);') or windie "Win32::API->Import(SwapBuffers): $^E"; #attempts to match an appropriate pixel format supported by a device context to # a given pixel format specification. Win32::API->Import('gdi32', 'int ChoosePixelFormat(HDC hdc, PIXELFORMATDESCRIPTOR * ppfd);') or windie "Win32::API->Import(ChoosePixelFormat): $^E"; #sets the pixel format of the specified device context to the format specified # by the iPixelFormat index returned from ChoosePixelFormat(). Win32::API->Import('gdi32', 'BOOL SetPixelFormat(HDC hdc, int iPixelFormat, PIXELFORMATDESCRIPTOR * ppfd);') or windie "Win32::API->Import(SetPixelFormat): $^E"; #creates a new OpenGL rendering context, which is suitable for drawing on the # device referenced by hdc. Win32::API->Import('opengl32', 'HGLRC wglCreateContext(HDC hdc);') or windie "Win32::API->Import(wglCreateContext): $^E"; #makes a specified OpenGL rendering context the calling thread's current # rendering context. Win32::API->Import('opengl32', 'BOOL wglMakeCurrent(HDC hdc, HGLRC hglrc);') or windie "Win32::API->Import(wglMakeCurrent): $^E"; #deletes a specified OpenGL rendering context. Win32::API->Import('opengl32', 'BOOL wglDeleteContext(HGLRC hglrc);') or windie "Win32::API->Import(wglDeleteContext): $^E"; #create main window my $main = Win32::GUI::Window->new( -name => "main", -text => "OpenGL Example: Colour Cube", -size => [640,480], -left => CW_USEDEFAULT, #let system position window -pushstyle => #Excludes the area occupied by child windows when drawing occurs # within the parent window. WS_CLIPCHILDREN | #When a particular child window needs to be painted, all other overlapping # child windows are clipped out of the region of the child window to be updated. WS_CLIPSIBLINGS, -onTerminate => sub { #WM_CLOSE wglMakeCurrent($g_HDC->Handle(), 0); #deselect rendering context from $hDC wglDeleteContext($hRC); #delete rendering context $hRC return -1; #exit main loop }, -onResize => sub { #WM_SIZE my $self = shift; return 0 unless $self; my $height = $self->Height(); #get height and width my $width = $self->Width(); $height = 1 if $height == 0; #don't divide by 0 glViewport(0,0,$width,$height); #set viewport to new dimensions glMatrixMode(GL_PROJECTION); #set matrix mode to projection matrix glLoadIdentity(); #reset projection matrix gluPerspective(54.0, $width / $height, 1.0, 1000.0); #calculate aspect ratio of window glMatrixMode(GL_MODELVIEW); #set modelview matrix glLoadIdentity(); #reset modelview matrix return 1; }, -onKeyDown => sub { #WM_KEYDOWN my ($self, $flags, $key) = @_; return -1 if $key == VK_ESCAPE; #exit if escape key pressed if ($key == 37) { $yrot -= 3.0; } elsif ($key == 39) { $yrot += 3.0; } elsif ($key == 38) { $xrot += 3.0; } elsif ($key == 40) { $xrot -= 3.0; } else { return; } #glutPostRedisplay(); return 1; }, ); $main->AddButton( -text => "Run", -name => "Button1", -left => 23, -top => 10, -width => 56, -height => 36, -foreground => 0, ); my $textfield = $main->AddTextfield( -text => "", -name => "Textfield_1", -left => 120, -top => 10, -width => 150, -height => 100, -multiline => 1, -vscroll => 1, ); unless($main){ windie("Cannot create window: $^E"); } $main->SetIcon(Win32::GUI::Icon->new(IDI_APPLICATION)); #set window icon #WM_CREATE $g_HDC = $main->GetDC(); #set global device context to device context of main window unless(SetupPixelFormat($g_HDC->Handle())){ #setup pixel format for device context exit 1; #exit if setup fails } $hRC = wglCreateContext($g_HDC->Handle()); #create rendering context used by OpenGL to draw wglMakeCurrent($g_HDC->Handle(), $hRC); #select rendering context $hRC into $g_HDC #Initialize OpenGL #my ($width, $height) = (300,200); glClearColor(0.0, 0.0, 0.0, 0.0); # Enables clearing of the Depth buffer glClearDepth(1.0); # The type of depth test to do glDepthFunc(GL_LESS); # Enables depth testing with that type glEnable(GL_DEPTH_TEST); # Enables smooth color shading glShadeModel(GL_SMOOTH); # Reset the projection matrix glMatrixMode(GL_PROJECTION); glLoadIdentity; # Calculate the aspect ratio of the Window #gluPerspective(45.0, $width/$height, 0.1, 100.0); # Reset the modelview matrix $main->Show(); #show window while(Win32::GUI::DoEvents() != -1){ Render(); } #This function is used to set the pixel format for the device context. # Accepts a handle to the device context of the window and returns true if succeeds # or false if fails. #Adapted from code from OpenGL Game Programming (Premier Press, 2004) sub SetupPixelFormat { my $hDC = shift; #is a handle to DC my $nPixelFormat; my $pfd = Win32::API::Struct->new('PIXELFORMATDESCRIPTOR'); #create new structure $pfd->{nSize} = $pfd->sizeof(); #return sizeof structure $pfd->{nVersion} = 1; #default version $pfd->{dwFlags} = PFD_DRAW_TO_WINDOW | #window drawing support PFD_SUPPORT_OPENGL | #OpenGL support PFD_DOUBLEBUFFER; #double buffering support $pfd->{iPixelType} = PFD_TYPE_RGBA; #rgba colour mode $pfd->{cColorBits} = 32; #32 bit colour mode $pfd->{cRedBits} = 0; #ignore colour bits $pfd->{cRedShift} = 0; # $pfd->{cGreenBits} = 0; # $pfd->{cGreenShift} = 0; # $pfd->{cBlueBits} = 0; # $pfd->{cBlueShift} = 0; # $pfd->{cAlphaBits} = 0; #not alpha buffer $pfd->{cAlphaShift} = 0; #ignore alpha shift bit $pfd->{cAccumBits} = 0; #no accumulation buffer $pfd->{cAccumRedBits} = 0; #ignore accumulation bits $pfd->{cAccumGreenBits} = 0; # $pfd->{cAccumBlueBits} = 0; # $pfd->{cAccumAlphaBits} = 0; # $pfd->{cDepthBits} = 16; #16 bit z-buffer size $pfd->{cStencilBits} = 0; #no stencil buffer $pfd->{cAuxBuffers} = 0; #no auxiliary buffer $pfd->{iLayerType} = PFD_MAIN_PLANE; #main drawing plane $pfd->{bReserved} = 0; #reserved $pfd->{dwLayerMask} = 0; #layer masks ignored $pfd->{dwVisibleMask} = 0; # $pfd->{dwDamageMask} = 0; # # choose best matching pixel format unless( $nPixelFormat = ChoosePixelFormat($hDC, $pfd) ){ winwarn("Can't find an appropriate pixel format"); return 0; } # set pixel format to device context unless( SetPixelFormat($hDC, $nPixelFormat, $pfd) ){ winwarn("Unable to set pixel format"); return 0; } return 1; } #This function draws the cube of points. The colour of each point is based on its position #Adapted from code from OpenGL Game Programming (Premier Press, 2004) sub DrawCube { glRotatef( $yrot, 0.0, 1.0, 0.0 ); glRotatef( $xrot, 1.0, 0.0, 0.0 ); glPushMatrix(); #glBegin(GL_POINTS); #glRotatef($rtri, 0.0, 1.0, 0.0); glBegin(GL_POLYGON); glColor3f(1.0, 0.0, 0.0); glVertex3f( 0.0, 20.0, 0.0); # Top vertex glColor3f(0.0, 1.0, 0.0); # Set The Color To Green glVertex3f( 20.0, -20.0, 0.0); # Bottom right vertex glColor3f(0.0, 0.0, 1.0); # Set The Color To Blue glVertex3f(-20.0, -20.0, 0.0); glEnd(); $rtri = $rtri + 3.0; glPopMatrix(); } #This function is used to draw the cube and is called every frame #Adapted from code from OpenGL Game Programming (Premier Press, 2004) sub Render { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); #clear color and depth buffer glLoadIdentity(); #replaces the current matrix with the identity matrix. glTranslatef(0.0, 0.0, -150.0); #move to 0,0,-150 glPushMatrix(); #save current matrix DrawCube(); #draw cube glPopMatrix(); #restore matrix glFlush(); #clear buffers SwapBuffers($g_HDC->Handle()); #exchange front and back buffers of device context } #Conveniently, the Windows specific functions for setup of OpenGL accept and return # handles to windows or contexts, which are just numbers, and the handles to # these are stored in the Window and DC objects created by Win32::GUI. This method # provides an easy access to this value. Placing the method in the #Win32::GUI::DC # package allows both Windows and DCs to use it. sub Button1_Click { $textfield->Append("OpenGL example : rotating triangle\r\n"); } package Win32::GUI::DC; sub Handle { return shift->{-handle}; } __END__ |
From: peter <my....@gm...> - 2009-07-10 07:27:56
|
hello thanks kevin for the opengl example. i have used his example to display a triangle which can be rotated in a 3D space using the up down left right keys. also added a button and a textbox, i have 2 question: 1- i can rotate the triangle by keys, until i click on the button to display some text in the textbox, why is this behaviour, and how i can restore the triangle rotating after clicking the button. 2- is it possible to make the opengl window smaller than the win32gui window !! best wishes peter |
From: Perl R. <pe...@co...> - 2009-06-19 18:19:11
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body bgcolor="#ffffff" text="#000000"> <font size="-1"><font face="Arial">Hi all,<br> <br> I'm running Perl 5.10 on Windows XP.<br> <br> I'm writing a program that must decrypt some data using Microsoft's CryptUnprotectData() function. If I use Luigino Masarati's Win32::CryptData module (<a class="moz-txt-link-freetext" href="http://search.cpan.org/~lmasara/Win32-CryptData-0.02/CryptData.pm">http://search.cpan.org/~lmasara/Win32-CryptData-0.02/CryptData.pm</a>), my program decrypts the data but then immediatley crashes. Sometimes I get an "Out of memory!" error. As an alternative, I've tried using Win32::API and simply making the call to </font></font><font size="-1"><font face="Arial">CryptUnprotectData() myself, but I can't get that to work either--I probably don't have the arguments right (no crash, it just always returns 0).<br> <br> Could anyone help me figure out what's wrong with </font></font><font size="-1"><font face="Arial">Win32::CryptData, or how to use Win32::API to </font></font><font size="-1"><font face="Arial">call </font></font><font size="-1"><font face="Arial">CryptUnprotectData() myself? I've been banging my head against the wall for days on this, so I'll take any help I can get.<br> <br> Thanks,<br> Rob<br> </font></font><font size="-1"><font face="Arial"><br> <br> </font></font> </body> </html> |
From: Waldemar B. <wb...@sa...> - 2009-06-19 04:37:16
|
I should add I used it Perl 5.8 Aactivestate. Strange but it works in 5.10? Bad new is that I am using PerlApp to wrap the application and this 8.01 Activestate wrapper does NOT work on all Windows XP machines whereas that version 6 of PerllApp does. Waldemar |
From: Waldemar B. <wb...@sa...> - 2009-06-16 10:23:19
|
Hello! I have spent much time to force my program working on my way and finally lost... Below is the code. The question is: how to force the comboboxes (f2,f3) to catch TAB event similarly to that of the textfields(f0,f1)? The mark of such behavior would be printing the "gogo" letters. regards Waldemar PS I do not want use Win32::GUI::DialogBox; just want to catch keyboard events in comboboxes. ######################################################### use Win32::GUI qw(); use warnings; use strict; my $where = 0; my $mw = new Win32::GUI::Window( -title => "Tab problem", -name => "hmmm", -pos => [ 100, 100 ], -size => [ 310, 200 ], ); my $f0 = $mw->AddTextfield( -name => "f0", -text => "1", -pos => [ 10, 10], -size => [ 100, 20], -onKeyDown => \&::gogo, ); my $f1 = $mw->AddTextfield( -name => "f1", -text => "2", -pos => [ 120, 10], -size => [ 100, 20], -onKeyDown => \&::gogo, ); my $f2 = $mw->AddCombobox( -name => "f2", -pos => [ 10, 50 ], -size => [ 100, 100 ], -dropdown => 1, -dropdownlist => 1, -onKeyDown => \&::gogo, ); $f2->InsertItem(0); $f2->InsertItem(1); $f2->InsertItem(2); $f2->InsertItem(3); $f2->SetCurSel(2); my $f3 = $mw->AddCombobox( -name => "f3", -pos => [ 120, 50 ], -size => [ 100, 100 ], -dropdown => 1, -dropdownlist => 1, -onKeyDown => \&::gogo, ); $f3->InsertItem(4); $f3->InsertItem(5); $f3->InsertItem(6); $f3->SetCurSel(0); $f0->SetFocus(); sub gogo { print "gogo\n"; $f0->SetFocus() if $where == 3; $f3->SetFocus() if $where == 2; $f2->SetFocus() if $where == 1; $f1->SetFocus() if $where == 0; $where++; $where = 0 if $where > 3; } $mw->Show(); Win32::GUI::Dialog(); __END__ ######################################################### |
From: Stephen C. <kni...@gm...> - 2009-06-07 16:20:40
|
Howdy guys, I have been a long time user of Perl and just stumbled across this package. Oh let me tell you how much I have needed something like this! Trying to go back to VB6 and trying to do things that I can in Perl was giving me a headache! I got a quick question. I am setting up a menu on an MDI Parent Window. On start up, I want all the MenuButtons disabled while the user "logs in" to the program. Upon log in, I want to the menus to enable. I have figured out how to disable the menus during design, but for the life of me I can't figure out how to re-enable them on command. I can change the enable property of MenuItems, but not MenuButtons. What would the syntax be for MenuButtons? Thanks in advance! Stephen |
From: Waldemar B. <wb...@sa...> - 2009-06-02 18:40:29
|
Kevin! This is what I was looking for and your example is perfect. > Hope this will help. It's already helped :) Thank you! Waldemar |
From: Kevin M. <kej...@ho...> - 2009-06-02 06:18:02
|
Waldmar, One solution I have would be to install a hook for one or more of the various keyboard messages that are available. These messages give you access to flags that give extended information, which could be used to determine if the ALT key is down. My suggestion would be to use the WM_SYSKEYDOWN message. Here is a very basic example: use strict; use warnings; use Data::Dump qw(dump); use Win32::GUI qw(); use Win32::GUI::Constants qw(/^WM_/); #gets all WM_ message constants my $win = Win32::GUI::Window->new( -name => 'main', -size => [320,240],); $win->Hook( WM_SYSKEYDOWN, sub{ dump \@_; #shows all parameters; my($this,$wParam,$lParam,$type,$msgcode) = @_; return unless $type == 0; #make sure message isn't WM_COMMAND or WM_NOTIFY return unless $msgcode == WM_SYSKEYDOWN; #make sure message is WM_SYSKEYDOWN #process event return 0; } ); $win->Show(); Win32::GUI::Dialog(); __END__ This may be what you were looking for. Check out the Windows SDK documentation for more info about the various messages that could be used. Hope this will help. Kevin. > From: wb...@sa... > To: per...@li... > Date: Sat, 30 May 2009 19:02:02 +0200 > Subject: [perl-win32-gui-users] How to catch keyboard event like LeftAlt+F5? > > Hello! > > I have the following problem: I can manage AltGr+F5 (RightAlt+F5) and all > keyboard events with OEM and NEM. > > However I don't know how to catch the LeftAlt+F5 and similar. > > Can anyone help me? > > regards > Waldemar > > > ------------------------------------------------------------------------------ > Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT > is a gathering of tech-side developers & brand creativity professionals. Meet > the minds behind Google Creative Lab, Visual Complexity, Processing, & > iPhoneDevCamp as they present alongside digital heavyweights like Barbarian > Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Per...@li... > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > http://perl-win32-gui.sourceforge.net/ _________________________________________________________________ Looking for a place to rent, share or buy this winter? Find your next place with Ninemsn property http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Edomain%2Ecom%2Eau%2F%3Fs%5Fcid%3DFDMedia%3ANineMSN%5FHotmail%5FTagline&_t=774152450&_r=Domain_tagline&_m=EXT |
From: Waldemar B. <wb...@sa...> - 2009-05-30 17:28:53
|
Hello! I have the following problem: I can manage AltGr+F5 (RightAlt+F5) and all keyboard events with OEM and NEM. However I don't know how to catch the LeftAlt+F5 and similar. Can anyone help me? regards Waldemar |
From: Jeremy W. <jez...@ho...> - 2009-05-22 19:30:06
|
Win32::GUI supports threading - if you use the module below, it makes Win32::GUI thread safe(er): Win32::GUI::ThreadUtils http://rob.themayfamily.me.uk/win32-gui/win32-gui-threadutils Cheers, jez. Date: Fri, 22 May 2009 11:50:11 -0700 From: apu...@ya... To: jez...@ho...; rob...@us...; per...@li...; kej...@ho... Subject: Re: [perl-win32-gui-users] Win32::GUI + OpenGL Does this mean, we will be able to make some kick ass 2D games using Win32::GUI and PERL? Shouldn't that need some type of threading ? ------------------------------ Apu Islam ( E Pluribus Unum) From: Jeremy White <jez...@ho...> To: rob...@us...; per...@li...; kej...@ho... Sent: Friday, May 22, 2009 12:50:50 PM Subject: Re: [perl-win32-gui-users] Win32::GUI + OpenGL > I have also experimented with OpenGL and Win32::GUI. I started to > write a module to integrate the two, but never completed it - I did > get it running though, and successfully ported most of the examples > that some with the OpenGL module. I've played with this too. Got the basics working, but found OpenGL (and DirectX for that matter) to heavy for what I needed at the time (fast simple 2D graphics). > I'll make make my code available sometime next week, once I get back > home; if anyone wants to pick this up I can give some direction on > what needs doing to complete it. Nice. Win32::GUI::OpenGL then? :) > Rob. > [snip] >>> It is possible to create child windows that are rendered to using OpenGL >>> instead of rendering to the parent window, but requires a lot more setup. >>> One of the tricks needed is to specify the right styles for the window. I >>> have yet to perfect this technique, but perhaps when I get it working >>> correctly I'll post an example. Good work - and thanks for the example. Feel free to drop me a mail off list as I can probably help here - I have got a 3rd party C++ graphics module painting into a Win32::GUI child window. Cheers, Jeremy. Windows Live Messenger just got better. Find out more! _________________________________________________________________ View your Twitter and Flickr updates from one place – Learn more! http://clk.atdmt.com/UKM/go/137984870/direct/01/ |
From: Apu i. <apu...@ya...> - 2009-05-22 18:50:28
|
Does this mean, we will be able to make some kick ass 2D games using Win32::GUI and PERL? Shouldn't that need some type of threading ? ------------------------------ Apu Islam ( E Pluribus Unum) ________________________________ From: Jeremy White <jez...@ho...> To: rob...@us...; per...@li...; kej...@ho... Sent: Friday, May 22, 2009 12:50:50 PM Subject: Re: [perl-win32-gui-users] Win32::GUI + OpenGL > I have also experimented with OpenGL and Win32::GUI. I started to > write a module to integrate the two, but never completed it - I did > get it running though, and successfully ported most of the examples > that some with the OpenGL module. I've played with this too. Got the basics working, but found OpenGL (and DirectX for that matter) to heavy for what I needed at the time (fast simple 2D graphics). > I'll make make my code available sometime next week, once I get back > home; if anyone wants to pick this up I can give some direction on > what needs doing to complete it. Nice. Win32::GUI::OpenGL then? :) > Rob. > [snip] > >> It is possible to create child windows that are rendered to using OpenGL > >> instead of rendering to the parent window, but requires a lot more setup. > >> One of the tricks needed is to specify the right styles for the window. I > >> have yet to perfect this technique, but perhaps when I get it working > >> correctly I'll post an example. Good work - and thanks for the example. Feel free to drop me a mail off list as I can probably help here - I have got a 3rd party C++ graphics module painting into a Win32::GUI child window. Cheers, Jeremy. ________________________________ Windows Live Messenger just got better. Find out more! |