pyopengl-users Mailing List for PyOpenGL (Page 28)
Brought to you by:
mcfletch
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(81) |
Oct
(41) |
Nov
(55) |
Dec
(14) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(34) |
Feb
(3) |
Mar
(16) |
Apr
(5) |
May
(10) |
Jun
(13) |
Jul
(24) |
Aug
(14) |
Sep
(14) |
Oct
(9) |
Nov
(10) |
Dec
(16) |
2003 |
Jan
(25) |
Feb
(59) |
Mar
(9) |
Apr
(21) |
May
(54) |
Jun
(4) |
Jul
(16) |
Aug
(19) |
Sep
(19) |
Oct
(15) |
Nov
(13) |
Dec
(22) |
2004 |
Jan
(19) |
Feb
(8) |
Mar
(20) |
Apr
(16) |
May
(13) |
Jun
(18) |
Jul
(18) |
Aug
(14) |
Sep
(24) |
Oct
(47) |
Nov
(20) |
Dec
(10) |
2005 |
Jan
(23) |
Feb
(31) |
Mar
(11) |
Apr
(29) |
May
(18) |
Jun
(7) |
Jul
(11) |
Aug
(12) |
Sep
(8) |
Oct
(4) |
Nov
(11) |
Dec
(7) |
2006 |
Jan
(7) |
Feb
(8) |
Mar
(15) |
Apr
(3) |
May
(8) |
Jun
(25) |
Jul
(19) |
Aug
(3) |
Sep
(17) |
Oct
(27) |
Nov
(24) |
Dec
(9) |
2007 |
Jan
(6) |
Feb
(43) |
Mar
(33) |
Apr
(8) |
May
(20) |
Jun
(11) |
Jul
(7) |
Aug
(8) |
Sep
(11) |
Oct
(22) |
Nov
(15) |
Dec
(18) |
2008 |
Jan
(14) |
Feb
(6) |
Mar
(6) |
Apr
(37) |
May
(13) |
Jun
(17) |
Jul
(22) |
Aug
(16) |
Sep
(14) |
Oct
(16) |
Nov
(29) |
Dec
(13) |
2009 |
Jan
(7) |
Feb
(25) |
Mar
(38) |
Apr
(57) |
May
(12) |
Jun
(32) |
Jul
(32) |
Aug
(35) |
Sep
(10) |
Oct
(28) |
Nov
(16) |
Dec
(49) |
2010 |
Jan
(57) |
Feb
(37) |
Mar
(22) |
Apr
(15) |
May
(45) |
Jun
(25) |
Jul
(32) |
Aug
(7) |
Sep
(13) |
Oct
(2) |
Nov
(11) |
Dec
(28) |
2011 |
Jan
(35) |
Feb
(39) |
Mar
|
Apr
(25) |
May
(32) |
Jun
(17) |
Jul
(29) |
Aug
(10) |
Sep
(26) |
Oct
(9) |
Nov
(28) |
Dec
(4) |
2012 |
Jan
(24) |
Feb
(47) |
Mar
(4) |
Apr
(8) |
May
(9) |
Jun
(6) |
Jul
(4) |
Aug
(1) |
Sep
(4) |
Oct
(28) |
Nov
(2) |
Dec
(2) |
2013 |
Jan
(11) |
Feb
(3) |
Mar
(4) |
Apr
(38) |
May
(15) |
Jun
(11) |
Jul
(15) |
Aug
(2) |
Sep
(2) |
Oct
(4) |
Nov
(3) |
Dec
(14) |
2014 |
Jan
(24) |
Feb
(31) |
Mar
(28) |
Apr
(16) |
May
(7) |
Jun
(6) |
Jul
(1) |
Aug
(10) |
Sep
(10) |
Oct
(2) |
Nov
|
Dec
|
2015 |
Jan
(6) |
Feb
(5) |
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
(2) |
Oct
(1) |
Nov
(19) |
Dec
|
2016 |
Jan
(6) |
Feb
(1) |
Mar
(7) |
Apr
|
May
(6) |
Jun
|
Jul
(3) |
Aug
(7) |
Sep
|
Oct
(2) |
Nov
(2) |
Dec
|
2017 |
Jan
|
Feb
(6) |
Mar
(8) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(4) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
|
2018 |
Jan
(9) |
Feb
(1) |
Mar
|
Apr
|
May
(1) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(6) |
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
(7) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2021 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Abhijeet R. <abh...@gm...> - 2011-04-17 22:36:39
|
Hi guyz, I need your help. After a day long process, I have finally completed a C++ pyopengl+glut project to python. Thanks for your help in making me move forward when I was stuck. Now, I have made to the code line by line same, all variable names same & even the order in which functions are written (even comments copied :P) but still the code is not executing perfectly. So the issue is about converting C++ to python successfully. Window0 ie left one doesnt load successfully, There is some problem of loading the windows.. DETAILS:- ^^^^^^^^^^ Screenshot of the issue:- http://i.imgur.com/qDax9.png C++ & python source code + images (SIZE 23KB) : http://dl.dropbox.com/u/7728421/paint.tar.gz C++ code (if you dont want to download): http://sprunge.us/JLOC?cpp Python source (if you dont want to download): http://sprunge.us/IVdG?python Error in console, ^^^^^^^^^^^^^^^ http://sprunge.us/gQRI I have tried my best to explain the issue. Its *probably a very small issue with textures variable acquiring None value but I am not able to solve the bug.* Please guyz help me making a working python clone of the code. I have to get this done till tomorrow somehow. Any kind of help would be greatly appreciated. -- Regards, Abhijeet Rastogi (shadyabhi) http://www.google.com/profiles/abhijeet.1989 |
From: Mike C. F. <mcf...@vr...> - 2011-04-17 21:15:15
|
On 11-04-15 11:28 AM, Abhijeet Rastogi wrote: > I installed the package, now I see this in interpreter. > > >>> from OpenGLContext import testingcontext > INFO:OpenGL.acceleratesupport:OpenGL_accelerate module loaded > PREFERENCELIST ('pygame', 'wx', 'glut', 'tk') > >>> > > What does that mean? It means that OpenGLContext will use, in order of preference, pygame, wxPython, GLUT and Tk on your machine. There's a mechanism to allow you to override that for your machine, but it's probably the correct order for most users who are just planning to test the code. Pygame is the most-tested and well supported context, wx is very close, but has a few long-standing bugs with multiple contexts. GLUT works fine, and is a good fallback, while Tk is pretty much not ready for prime-time due to my not really caring all that much about it. The log message really is just an "info" level thing, just telling you what the context preference order is. HTH, Mike > > On Fri, Apr 15, 2011 at 8:34 PM, Derakon <de...@gm... > <mailto:de...@gm...>> wrote: > > On Fri, Apr 15, 2011 at 7:11 AM, Abhijeet Rastogi > <abh...@gm... <mailto:abh...@gm...>> wrote: > > > >>>> from OpenGLContext import testingcontext > > INFO:OpenGL.acceleratesupport:No OpenGL_accelerate module > loaded: No module > > named OpenGL_accelerate > > You're missing the OpenGL-accelerate package, which you can grab > from here: > http://pypi.python.org/pypi/PyOpenGL-accelerate > It may have other dependencies as well. This isn't necessary for > normal OpenGL use, but apparently the testing context requires it. > > -Chris > > > > -- > Regards, > Abhijeet Rastogi (shadyabhi) > http://www.google.com/profiles/abhijeet.1989 > > > ------------------------------------------------------------------------------ > Benefiting from Server Virtualization: Beyond Initial Workload > Consolidation -- Increasing the use of server virtualization is a top > priority.Virtualization can reduce costs, simplify management, and improve > application availability and disaster protection. Learn more about boosting > the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev > > > _______________________________________________ > PyOpenGL Homepage > http://pyopengl.sourceforge.net > _______________________________________________ > PyOpenGL-Users mailing list > PyO...@li... > https://lists.sourceforge.net/lists/listinfo/pyopengl-users -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: Derakon <de...@gm...> - 2011-04-17 19:24:34
|
On Sun, Apr 17, 2011 at 11:44 AM, Abhijeet Rastogi <abh...@gm...> wrote: > > Original author has implemented figureSet as vector, I implemented it as > python list while converting the code. In the below code snippet, "in the > if-else part", I am not able to make out, how will I convert the code in > python? > > void drawSel() { > glColor3f(0, 0, 0); > int size = figureSet.size(); > Figure *f = figureSet[selected]; > > /* getPoint() is a virtual method: every figure has at least > two points (is at least a line) */ > int *pt1 = f->getPoint(1)->getCoords(); > int *pt2 = f->getPoint(2)->getCoords(); > > if (Triangle *t = dynamic_cast<Triangle*>(f)) { // triangle: one more > point > int *pt3 = t->getPoint(3)->getCoords(); > //something happens here > } > else if (Quad *q = dynamic_cast<Quad*>(f)) { // quad: two more point > int *pt3 = q->getPoint(3)->getCoords(); > int *pt4 = q->getPoint(4)->getCoords(); > //Something happens here > } > } In this code we have a guarantee that there are at least 2 points to draw, but if the figure is a triangle, then there's only one more, while if it's a quad then there's two more. These need different drawing logic, hence the if/else split. The conditionals are basically saying "How many points are in this polygon?" and then drawing differently depending on the result. In other words, dynamic_cast is being used to check if the figure variable is representing a Triangle or a Quad. The direct way to do this in Python would be something along the lines of if type(figure) == Triangle: draw as if it's a triangle elif type(figure) == Quad: draw as if it's a quad Assuming you have Triangle and Quad classes declared, of course. The more elegant way would be to have Triangle and Quad have their own draw functions; then you just do figure.draw() and the appropriate function is automatically invoked. -Chris |
From: Abhijeet R. <abh...@gm...> - 2011-04-17 18:44:48
|
OK. May be as the topic is same I should continue here only. There is one more function in that cpp file. The query is small, but the code I have given displays more lines. Basically, I have a base class Figure; and from that I have derived classes like Line, Triangle, Quad.... Original author has implemented figureSet as vector, I implemented it as python list while converting the code. In the below code snippet, "in the if-else part", I am not able to make out, how will I convert the code in python? Guyz please help. I need to get the full working python clone by tomorrow & I am stuck at few places. Full c code -> http://sprunge.us/OUKM?cpp & header file is here http://sprunge.us/OUKM?cpp *void drawSel() { glColor3f(0, 0, 0); int size = figureSet.size(); Figure *f = figureSet[selected]; /* getPoint() is a virtual method: every figure has at least two points (is at least a line) */ int *pt1 = f->getPoint(1)->getCoords(); int *pt2 = f->getPoint(2)->getCoords(); if (Triangle *t = dynamic_cast<Triangle*>(f)) { // triangle: one more point int *pt3 = t->getPoint(3)->getCoords(); //something happens here } else if (Quad *q = dynamic_cast<Quad*>(f)) { // quad: two more point int *pt3 = q->getPoint(3)->getCoords(); int *pt4 = q->getPoint(4)->getCoords(); //Something happens here } } * On Sun, Apr 17, 2011 at 10:49 PM, Joshua R. Davis <joshuardavis@q.com>wrote: > Converting C/C++ OpenGL code to PyOpenGL code takes a little practice, due > to small alterations in how PyOpenGL function calls use parameters. Rather > than directly answering your question, let me point you to completely > abstracted PyOpenGL picking and collision-testing functions on my web site: > > http://www.joshuadavis.us/software/selection.py > > You can use this code as-is, or you can view it as a tutorial. Also, please > be aware that the selection mechanism is deprecated in OpenGL now. It is > preferable to pick using the back buffer, for example. Hope this helps. > > Josh > > -- Regards, Abhijeet Rastogi (shadyabhi) http://www.google.com/profiles/abhijeet.1989 |
From: Joshua R. D. <joshuardavis@q.com> - 2011-04-17 17:55:44
|
Converting C/C++ OpenGL code to PyOpenGL code takes a little practice, due to small alterations in how PyOpenGL function calls use parameters. Rather than directly answering your question, let me point you to completely abstracted PyOpenGL picking and collision-testing functions on my web site: http://www.joshuadavis.us/software/selection.py You can use this code as-is, or you can view it as a tutorial. Also, please be aware that the selection mechanism is deprecated in OpenGL now. It is preferable to pick using the back buffer, for example. Hope this helps. Josh On 2011 Apr 17, at 12:02 PM, Abhijeet Rastogi wrote: > I have a function in C++ which goes like this . > > void selection(int x, int y, int win) { > // Space for selection buffer > static GLuint selectBuff[BUFFER_LENGTH]; > GLint hits, viewport[4]; > > // Setup selection buffer and get the view port > glSelectBuffer(BUFFER_LENGTH, selectBuff); > glGetIntegerv(GL_VIEWPORT, viewport); > > // Switch to projection and save the matrix > glMatrixMode(GL_PROJECTION); > glPushMatrix(); > ... > ... > > OK. So, now, first of all, in C++ code, it has defined the variables and then called glGetIntegerv. How am I supposed to do the same in python code. > Please help. I am just beginner trying to learn opengl. > > For the full code, you can search for function selection in http://sprunge.us/fAaf > > -- > Regards, > Abhijeet Rastogi (shadyabhi) > http://www.google.com/profiles/abhijeet.1989 > ------------------------------------------------------------------------------ > Benefiting from Server Virtualization: Beyond Initial Workload > Consolidation -- Increasing the use of server virtualization is a top > priority.Virtualization can reduce costs, simplify management, and improve > application availability and disaster protection. Learn more about boosting > the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev_______________________________________________ > PyOpenGL Homepage > http://pyopengl.sourceforge.net > _______________________________________________ > PyOpenGL-Users mailing list > PyO...@li... > https://lists.sourceforge.net/lists/listinfo/pyopengl-users |
From: Abhijeet R. <abh...@gm...> - 2011-04-17 17:40:26
|
So, there is no need of defining anything because python will return it during the function call. That helped. Thanks Derakon. On Sun, Apr 17, 2011 at 10:44 PM, Derakon <de...@gm...> wrote: > > Any time that the C version of OpenGL code returns something by > reference, the Python version will just return the value directly. So > you should be able to do this: > > selectBuff = glSelectBuffer(BUFFER_LENGTH) > viewport = glGetIntegerv(GL_VIEWPORT) > > -- Regards, Abhijeet Rastogi (shadyabhi) http://www.google.com/profiles/abhijeet.1989 |
From: Derakon <de...@gm...> - 2011-04-17 17:14:54
|
On Sun, Apr 17, 2011 at 10:02 AM, Abhijeet Rastogi <abh...@gm...> wrote: > I have a function in C++ which goes like this . > void selection(int x, int y, int win) { > // Space for selection buffer > static GLuint selectBuff[BUFFER_LENGTH]; > GLint hits, viewport[4]; > > // Setup selection buffer and get the view port > glSelectBuffer(BUFFER_LENGTH, selectBuff); > glGetIntegerv(GL_VIEWPORT, viewport); > > // Switch to projection and save the matrix > glMatrixMode(GL_PROJECTION); > glPushMatrix(); > ... > ... > OK. So, now, first of all, in C++ code, it has defined the variables and > then called glGetIntegerv. How am I supposed to do the same in python > code. Any time that the C version of OpenGL code returns something by reference, the Python version will just return the value directly. So you should be able to do this: selectBuff = glSelectBuffer(BUFFER_LENGTH) viewport = glGetIntegerv(GL_VIEWPORT) |
From: Abhijeet R. <abh...@gm...> - 2011-04-17 17:03:21
|
I have a function in C++ which goes like this . void selection(int x, int y, int win) { // Space for selection buffer static GLuint selectBuff[BUFFER_LENGTH]; GLint hits, viewport[4]; // Setup selection buffer and get the view port glSelectBuffer(BUFFER_LENGTH, selectBuff); glGetIntegerv(GL_VIEWPORT, viewport); // Switch to projection and save the matrix glMatrixMode(GL_PROJECTION); glPushMatrix(); ... ... OK. So, now, first of all, in C++ code, it has defined the variables and then called glGetIntegerv. How am I supposed to do the same in python code. Please help. I am just beginner trying to learn opengl. For the full code, you can search for function selection in http://sprunge.us/fAaf -- Regards, Abhijeet Rastogi (shadyabhi) http://www.google.com/profiles/abhijeet.1989 |
From: Abhijeet R. <abh...@gm...> - 2011-04-15 15:28:50
|
I installed the package, now I see this in interpreter. >>> from OpenGLContext import testingcontext INFO:OpenGL.acceleratesupport:OpenGL_accelerate module loaded PREFERENCELIST ('pygame', 'wx', 'glut', 'tk') >>> What does that mean? On Fri, Apr 15, 2011 at 8:34 PM, Derakon <de...@gm...> wrote: > On Fri, Apr 15, 2011 at 7:11 AM, Abhijeet Rastogi > <abh...@gm...> wrote: > > > >>>> from OpenGLContext import testingcontext > > INFO:OpenGL.acceleratesupport:No OpenGL_accelerate module loaded: No > module > > named OpenGL_accelerate > > You're missing the OpenGL-accelerate package, which you can grab from here: > http://pypi.python.org/pypi/PyOpenGL-accelerate > It may have other dependencies as well. This isn't necessary for > normal OpenGL use, but apparently the testing context requires it. > > -Chris > > -- Regards, Abhijeet Rastogi (shadyabhi) http://www.google.com/profiles/abhijeet.1989 |
From: Derakon <de...@gm...> - 2011-04-15 15:04:09
|
On Fri, Apr 15, 2011 at 7:11 AM, Abhijeet Rastogi <abh...@gm...> wrote: > >>>> from OpenGLContext import testingcontext > INFO:OpenGL.acceleratesupport:No OpenGL_accelerate module loaded: No module > named OpenGL_accelerate You're missing the OpenGL-accelerate package, which you can grab from here: http://pypi.python.org/pypi/PyOpenGL-accelerate It may have other dependencies as well. This isn't necessary for normal OpenGL use, but apparently the testing context requires it. -Chris |
From: Abhijeet R. <abh...@gm...> - 2011-04-15 14:12:19
|
Hi, I am new to opengl and I am using python to learn the library. As a start, I started following the tutorial http://pyopengl.sourceforge.net/context/tutorials/shader_1.xhtml I opened up python interpreter & I got this error. Googling didnt help much. There is no sure shot answer as to why is this error coming. >>> from OpenGLContext import testingcontext INFO:OpenGL.acceleratesupport:No OpenGL_accelerate module loaded: No module named OpenGL_accelerate PREFERENCELIST ('pygame', 'wx', 'glut', 'tk') >>> And I want to make a point that simply importing OpenGLContext doesnt cause any errors. >>> import OpenGLContext >>> Please help me and guide as to what is the issue? -- Regards, Abhijeet Rastogi (shadyabhi) http://www.google.com/profiles/abhijeet.1989 |
From: Jonathan H. <ta...@ta...> - 2011-04-15 09:41:06
|
There are some tutorials built into the PyOpenGL documentation itself. They are ostensibly about using shaders, but they provide complete stand-alone working code that shows exactly how to write OpenGL code using PyOpenGL: http://pyopengl.sourceforge.net/context/tutorials/index.xhtml Once you've done a few of those and are starting to become familiar with PyOpenGL, then you can pretty much use any C tutorial, and convert them to Python yourself, usually quite easily. If you want modern '>=version3' OpenGL, there are two C-based tutorials which seem to be of very high quality: An Intro to Modern OpenGL http://duriansoftware.com/joe/An-intro-to-modern-OpenGL.-Table-of-Contents.html Learning Modern Graphics Programming Through OpenGL http://www.arcsynthesis.org/gltut/index.html I just started converting the C samples for the last of these into Python using PyOpenGL, and just this morning emailed the author to ask if he minds me making those public. More as it happens. Jonathan On 15/04/2011 06:13, Abhijeet Rastogi wrote: > Hi, > > I am a beginner to opengl. I want to learn pyopengl but I cant find an > ebook which teaches that using python. I am kind of stuck. Guide me > through a nice ebook for learning pyopengl. > > -- > Regards, > Abhijeet Rastogi (shadyabhi) > http://www.google.com/profiles/abhijeet.1989 > > > ------------------------------------------------------------------------------ > Benefiting from Server Virtualization: Beyond Initial Workload > Consolidation -- Increasing the use of server virtualization is a top > priority.Virtualization can reduce costs, simplify management, and improve > application availability and disaster protection. Learn more about boosting > the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev > > > _______________________________________________ > PyOpenGL Homepage > http://pyopengl.sourceforge.net > _______________________________________________ > PyOpenGL-Users mailing list > PyO...@li... > https://lists.sourceforge.net/lists/listinfo/pyopengl-users -- Jonathan Hartley ta...@ta... http://tartley.com Made of meat. +44 7737 062 225 twitter/skype: tartley |
From: Jonathan H. <ta...@ta...> - 2011-04-15 09:41:02
|
If you use cross-platform libraries for windowing, like pyglet, then your Python OpenGL scripts should run fine on any platform. I routinely make games for PyWeek using pyglet and PyOpenGL, and I'll develop for one platform (often windows, so I can send my game to my friends) without even testing them on any other platform, and at the end of the week find that my game works on all of (windows, linux, mac) On 15/04/2011 06:51, Abhijeet Rastogi wrote: > I referred to OpenGL SuperBible which has code in C++. But, the issue > is that its windows specific. Can I atleast get any good resources > which are for linux? I know that opengl code is portable but > window-handling code is platform specific. So, codes that actually > compile in linux would be great. > > On Fri, Apr 15, 2011 at 11:04 AM, Ian Mallett <geo...@gm... > <mailto:geo...@gm...>> wrote: > > On Thu, Apr 14, 2011 at 11:13 PM, Abhijeet Rastogi > <abh...@gm... <mailto:abh...@gm...>> wrote: > > Hi, > > I am a beginner to opengl. I want to learn pyopengl but I cant > find an ebook which teaches that using python. I am kind of > stuck. Guide me through a nice ebook for learning pyopengl. > > -- > Regards, > Abhijeet Rastogi (shadyabhi) > http://www.google.com/profiles/abhijeet.1989 > > One thing I learned to do very early on when learning Python was > to translate algorithms from other languages almost compulsively. > There are comparatively scant resources for learning Python, as > compared to C, or C++. The Python subdomain of graphics (which is > already a small group) is miniscule--so, in short, the resource > you're looking for (probably) doesn't exist. > > That said, I learned a great deal by reverse engineering existing > code. Google NeHe, and follow those tutorials (there are Python > ports available). > > Ian > > > > > -- > Regards, > Abhijeet Rastogi (shadyabhi) > http://www.google.com/profiles/abhijeet.1989 > > > ------------------------------------------------------------------------------ > Benefiting from Server Virtualization: Beyond Initial Workload > Consolidation -- Increasing the use of server virtualization is a top > priority.Virtualization can reduce costs, simplify management, and improve > application availability and disaster protection. Learn more about boosting > the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev > > > _______________________________________________ > PyOpenGL Homepage > http://pyopengl.sourceforge.net > _______________________________________________ > PyOpenGL-Users mailing list > PyO...@li... > https://lists.sourceforge.net/lists/listinfo/pyopengl-users -- Jonathan Hartley ta...@ta... http://tartley.com Made of meat. +44 7737 062 225 twitter/skype: tartley |
From: Abhijeet R. <abh...@gm...> - 2011-04-15 05:51:41
|
I referred to OpenGL SuperBible which has code in C++. But, the issue is that its windows specific. Can I atleast get any good resources which are for linux? I know that opengl code is portable but window-handling code is platform specific. So, codes that actually compile in linux would be great. On Fri, Apr 15, 2011 at 11:04 AM, Ian Mallett <geo...@gm...> wrote: > On Thu, Apr 14, 2011 at 11:13 PM, Abhijeet Rastogi < > abh...@gm...> wrote: > >> Hi, >> >> I am a beginner to opengl. I want to learn pyopengl but I cant find an >> ebook which teaches that using python. I am kind of stuck. Guide me through >> a nice ebook for learning pyopengl. >> >> -- >> Regards, >> Abhijeet Rastogi (shadyabhi) >> http://www.google.com/profiles/abhijeet.1989 > > One thing I learned to do very early on when learning Python was to > translate algorithms from other languages almost compulsively. There are > comparatively scant resources for learning Python, as compared to C, or > C++. The Python subdomain of graphics (which is already a small group) is > miniscule--so, in short, the resource you're looking for (probably) doesn't > exist. > > That said, I learned a great deal by reverse engineering existing code. > Google NeHe, and follow those tutorials (there are Python ports available). > > Ian > -- Regards, Abhijeet Rastogi (shadyabhi) http://www.google.com/profiles/abhijeet.1989 |
From: Abhijeet R. <abh...@gm...> - 2011-04-15 05:14:04
|
Hi, I am a beginner to opengl. I want to learn pyopengl but I cant find an ebook which teaches that using python. I am kind of stuck. Guide me through a nice ebook for learning pyopengl. -- Regards, Abhijeet Rastogi (shadyabhi) http://www.google.com/profiles/abhijeet.1989 |
From: Nicolas R. <Nic...@in...> - 2011-02-24 09:42:25
|
On Feb 24, 2011, at 9:55 AM, Michka Popoff wrote: > Thanks for answering > > Dirk : > generally the most generic and efficient way for that is to use glTexGen to turn > your height into a texture coordinate and use a 1D texture for the colors to > interpolate between. This allows you to fully specify the color that are > interpolated and also enables you to do non-linear mappings (e.g. have a bright > band at a specific height). Give it a try! > > Ian Mallett : > I'd use a vertex shader. > Have a look at glumpy that implement those two ideas (1D texture + shader): http://code.google.com/p/glumpy/ Nicolas |
From: Duong D. <dan...@gm...> - 2011-02-24 09:41:01
|
On Thu, Feb 24, 2011 at 3:33 AM, Alejandro Segovia <as...@gm...> wrote: > Dear Sovannara, > > On Wed, Feb 23, 2011 at 3:03 PM, Sovannara Hak <hak...@gm...> > wrote: >> >> Hello, >> I ran gdb on the hello.py using Ubuntu 10.04 and intel graphic card >> (There was no problem with the same computer in fedora 12.) >> (gdb) r >> Starting program: /usr/bin/python hello.py >> [Thread debugging using libthread_db enabled] >> Program received signal SIGSEGV, Segmentation fault. >> 0x004fb256 in glGetError () from /usr/lib/mesa/libGL.so.1 >> (gdb) bt >> #0 0x004fb256 in glGetError () from /usr/lib/mesa/libGL.so.1 >> #1 0x0049301f in ffi_call_SYSV () >> from /usr/lib/python2.6/lib-dynload/_ctypes.so >> #2 0x00492e4c in ffi_call () from >> /usr/lib/python2.6/lib-dynload/_ctypes.so >> #3 0x0048d48d in _CallProc () from >> /usr/lib/python2.6/lib-dynload/_ctypes.so >> #4 0x00484e1e in ?? () from /usr/lib/python2.6/lib-dynload/_ctypes.so >> #5 0x0806245a in PyObject_Call () >> #6 0x080e0471 in PyEval_EvalFrameEx () >> #7 0x080e2807 in PyEval_EvalCodeEx () >> #8 0x0816b2ac in ?? () >> #9 0x0806245a in PyObject_Call () >> #10 0x0806a45c in ?? () >> #11 0x08066573 in PyObject_CallFunctionObjArgs () >> #12 0x00484f4a in ?? () from /usr/lib/python2.6/lib-dynload/_ctypes.so >> #13 0x0806245a in PyObject_Call () >> #14 0x080e0471 in PyEval_EvalFrameEx () >> #15 0x080e2807 in PyEval_EvalCodeEx () >> #16 0x080e2907 in PyEval_EvalCode () >> #17 0x081005ad in PyRun_FileExFlags () >> #18 0x08100812 in PyRun_SimpleFileExFlags () >> #19 0x0805de5c in Py_Main () >> #20 0x0805d03b in main () >> it seems that the intel driver doesn't handle very well the glGetError() >> called by glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB) >> because there was no context at this point. >> but if we put a glCreateWindow("hello") just before glutInitDisplay >> the program doesnt segfault anymore. > > I'm glad you were able to find a workaround for this issue. > I am not very familiar with GLUT, but I think normally glutInit should be > the first function called, as it's the one that initializes the library. My > guess is that for some reason glutInit is failing to initialize and when it > tries to get the error message (using glError), then a segfault is produced > because no valid OpenGL context is available. > The reasons glutInit might fail include not supporting OpenGL on the system, > not being able to connect to the window system (Xorg) or invalid command > line options. > In any case, maybe the Intel driver needs to have the window created first. > Definitely weird... have you tried using pygame to create the window or do > you *have* to use GLUT? > Alejandro.- > >> Hi Alejandro, It is weird indeed since the hello.c program did work on the Itel card without the workaround. We also tried this simple program #include <GL/gl.h> int main(int argc, char* argv[]) { glGetError(); return 0; } which runs ok on a nvidia but segfaults on the Intel card. My guess is that the GL implementation on the Intel card requires a proper context be created before calling glGetError. Somewhere in the python wrapper of glutInitDisplayMode, it calls glGetError and causes the segfaults on the Intel card since there is no context. We haven't try pygame but I think we're happy with the workaround right now since we don't want to add an extra dependency to our project. Best, Duong |
From: Michka P. <mic...@gm...> - 2011-02-24 08:55:19
|
Thanks for answering Dirk : generally the most generic and efficient way for that is to use glTexGen to turn your height into a texture coordinate and use a 1D texture for the colors to interpolate between. This allows you to fully specify the color that are interpolated and also enables you to do non-linear mappings (e.g. have a bright band at a specific height). Give it a try! Ian Mallett : I'd use a vertex shader. The two ideas seem okay for me, but I think I am stuck : I have no influence on the nurb displayed, because I don't know how to modify it before it is displayed. (or after). I tried a few things : 1) I used gluNurbsProperty(nurb, GLU_NURBS_MODE, GLU_NURBS_TESSELLATOR) and gluNurbsCallback(nurb,GLU_NURBS_COLOR,color). I was able to print the colors of every point in the callback function. But I can not modify them. So why does this function exist ? And as the nurb is now tesselated, how can I display it ? 2) I used gluNurbsSurface(nurb, knots, knots, ctrlpts, GL_MAP2_COLOR_4). In the callback documentation for gluNurbsCallback() I have found : This callback is effective only when the user provides a color map (*GL**_**MAP1**_**COLOR**_**4* or *GL**_**MAP2**_**COLOR**_**4*). ``color'' contains four components: R,G,B,A So where can I provide my own color map ? Documentation never says anything about this. My ideas : 1) I could subdivide my big nurb surface in a lot of little nurb patches, and put a colored texture on it. Like the typical molehill.py tutorial you can find everywhere. I think it is quite the same as Dirk's idea ? 2) I could rewrite everything with my own polygons, where I can define the colors myself. Will not be as smooth as it is now, but should work. Michka Popoff |
From: Alejandro S. <as...@gm...> - 2011-02-24 02:37:04
|
Dear Sovannara, On Wed, Feb 23, 2011 at 3:03 PM, Sovannara Hak <hak...@gm...>wrote: > Hello, > > I ran gdb on the hello.py using Ubuntu 10.04 and intel graphic card > (There was no problem with the same computer in fedora 12.) > > (gdb) r > Starting program: /usr/bin/python hello.py > [Thread debugging using libthread_db enabled] > > Program received signal SIGSEGV, Segmentation fault. > 0x004fb256 in glGetError () from /usr/lib/mesa/libGL.so.1 > (gdb) bt > #0 0x004fb256 in glGetError () from /usr/lib/mesa/libGL.so.1 > #1 0x0049301f in ffi_call_SYSV () > from /usr/lib/python2.6/lib-dynload/_ctypes.so > #2 0x00492e4c in ffi_call () from > /usr/lib/python2.6/lib-dynload/_ctypes.so > #3 0x0048d48d in _CallProc () from > /usr/lib/python2.6/lib-dynload/_ctypes.so > #4 0x00484e1e in ?? () from /usr/lib/python2.6/lib-dynload/_ctypes.so > #5 0x0806245a in PyObject_Call () > #6 0x080e0471 in PyEval_EvalFrameEx () > #7 0x080e2807 in PyEval_EvalCodeEx () > #8 0x0816b2ac in ?? () > #9 0x0806245a in PyObject_Call () > #10 0x0806a45c in ?? () > #11 0x08066573 in PyObject_CallFunctionObjArgs () > #12 0x00484f4a in ?? () from /usr/lib/python2.6/lib-dynload/_ctypes.so > #13 0x0806245a in PyObject_Call () > #14 0x080e0471 in PyEval_EvalFrameEx () > #15 0x080e2807 in PyEval_EvalCodeEx () > #16 0x080e2907 in PyEval_EvalCode () > #17 0x081005ad in PyRun_FileExFlags () > #18 0x08100812 in PyRun_SimpleFileExFlags () > #19 0x0805de5c in Py_Main () > #20 0x0805d03b in main () > > it seems that the intel driver doesn't handle very well the glGetError() > called by glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB) > because there was no context at this point. > > but if we put a glCreateWindow("hello") just before glutInitDisplay > the program doesnt segfault anymore. > I'm glad you were able to find a workaround for this issue. I am not very familiar with GLUT, but I think normally glutInit should be the first function called, as it's the one that initializes the library. My guess is that for some reason glutInit is failing to initialize and when it tries to get the error message (using glError), then a segfault is produced because no valid OpenGL context is available. The reasons glutInit might fail include not supporting OpenGL on the system, not being able to connect to the window system (Xorg) or invalid command line options. In any case, maybe the Intel driver needs to have the window created first. Definitely weird... have you tried using pygame to create the window or do you *have* to use GLUT? Alejandro.- > > Sovannara. > > On 23 February 2011 17:22, Alejandro Segovia <as...@gm...> wrote: > >> Hello Duong, >> >> On Wed, Feb 23, 2011 at 2:08 PM, Duong Dang <dan...@gm...> wrote: >> >>> On Wed, Feb 23, 2011 at 4:53 PM, Ian Mallett <geo...@gm...> >>> wrote: >>> > On Wed, Feb 23, 2011 at 8:38 AM, Alejandro Segovia <as...@gm...> >>> > wrote: >>> >> >>> >> Hello Duong, >>> >> >>> >> On Wed, Feb 23, 2011 at 11:55 AM, Duong Dang <dan...@gm...> >>> wrote: >>> >>> >>> >>> Hello there, >>> >>> >>> >>> We are having a problem with PyOpenGL on a Ubuntu 10.04 machine with >>> a >>> >>> Intel GMA945 graphics card. The following code works in C++, but its >>> >>> counterpart seg-faults in python. Any idea why that is? >>> >> >>> >> I can't reproduce the problem on an NVIDIA video card, >>> > >>> > Nor I. >>> >>> Thanks for testing, we also tried >>> http://www.opengl.org/resources/code/samples/redbook/hello.c >>> and >>> >>> http://bazaar.launchpad.net/~mcfletch/pyopengl-demo/trunk/annotate/head:/PyOpenGL-Demo/redbook/hello.py >>> >>> which should be identical. The c program displays a white square just >>> fine but the python script seg faults again on the Intel card. >>> On another PC with a nvidia card, both programs work fine. >>> >> >> Do you have any other information on the crash? What OS are you running >> the script on? If you're on Linux, maybe you could record and inspect a >> valgrind dump. I don't know of any equivalent tools for Windows. >> >> Alejandro.- >> >> >> -- >> Alejandro Segovia Azapian >> Director, Algorithmia: Visualization & Acceleration >> http://web.algorithmia.net >> > > -- Alejandro Segovia Azapian Director, Algorithmia: Visualization & Acceleration http://web.algorithmia.net |
From: Sovannara H. <hak...@gm...> - 2011-02-23 17:04:39
|
Hello, I ran gdb on the hello.py using Ubuntu 10.04 and intel graphic card (There was no problem with the same computer in fedora 12.) (gdb) r Starting program: /usr/bin/python hello.py [Thread debugging using libthread_db enabled] Program received signal SIGSEGV, Segmentation fault. 0x004fb256 in glGetError () from /usr/lib/mesa/libGL.so.1 (gdb) bt #0 0x004fb256 in glGetError () from /usr/lib/mesa/libGL.so.1 #1 0x0049301f in ffi_call_SYSV () from /usr/lib/python2.6/lib-dynload/_ctypes.so #2 0x00492e4c in ffi_call () from /usr/lib/python2.6/lib-dynload/_ctypes.so #3 0x0048d48d in _CallProc () from /usr/lib/python2.6/lib-dynload/_ctypes.so #4 0x00484e1e in ?? () from /usr/lib/python2.6/lib-dynload/_ctypes.so #5 0x0806245a in PyObject_Call () #6 0x080e0471 in PyEval_EvalFrameEx () #7 0x080e2807 in PyEval_EvalCodeEx () #8 0x0816b2ac in ?? () #9 0x0806245a in PyObject_Call () #10 0x0806a45c in ?? () #11 0x08066573 in PyObject_CallFunctionObjArgs () #12 0x00484f4a in ?? () from /usr/lib/python2.6/lib-dynload/_ctypes.so #13 0x0806245a in PyObject_Call () #14 0x080e0471 in PyEval_EvalFrameEx () #15 0x080e2807 in PyEval_EvalCodeEx () #16 0x080e2907 in PyEval_EvalCode () #17 0x081005ad in PyRun_FileExFlags () #18 0x08100812 in PyRun_SimpleFileExFlags () #19 0x0805de5c in Py_Main () #20 0x0805d03b in main () it seems that the intel driver doesn't handle very well the glGetError() called by glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB) because there was no context at this point. but if we put a glCreateWindow("hello") just before glutInitDisplay the program doesnt segfault anymore. Sovannara. On 23 February 2011 17:22, Alejandro Segovia <as...@gm...> wrote: > Hello Duong, > > On Wed, Feb 23, 2011 at 2:08 PM, Duong Dang <dan...@gm...> wrote: > >> On Wed, Feb 23, 2011 at 4:53 PM, Ian Mallett <geo...@gm...> >> wrote: >> > On Wed, Feb 23, 2011 at 8:38 AM, Alejandro Segovia <as...@gm...> >> > wrote: >> >> >> >> Hello Duong, >> >> >> >> On Wed, Feb 23, 2011 at 11:55 AM, Duong Dang <dan...@gm...> >> wrote: >> >>> >> >>> Hello there, >> >>> >> >>> We are having a problem with PyOpenGL on a Ubuntu 10.04 machine with a >> >>> Intel GMA945 graphics card. The following code works in C++, but its >> >>> counterpart seg-faults in python. Any idea why that is? >> >> >> >> I can't reproduce the problem on an NVIDIA video card, >> > >> > Nor I. >> >> Thanks for testing, we also tried >> http://www.opengl.org/resources/code/samples/redbook/hello.c >> and >> >> http://bazaar.launchpad.net/~mcfletch/pyopengl-demo/trunk/annotate/head:/PyOpenGL-Demo/redbook/hello.py >> >> which should be identical. The c program displays a white square just >> fine but the python script seg faults again on the Intel card. >> On another PC with a nvidia card, both programs work fine. >> > > Do you have any other information on the crash? What OS are you running the > script on? If you're on Linux, maybe you could record and inspect a valgrind > dump. I don't know of any equivalent tools for Windows. > > Alejandro.- > > > -- > Alejandro Segovia Azapian > Director, Algorithmia: Visualization & Acceleration > http://web.algorithmia.net > |
From: Alejandro S. <as...@gm...> - 2011-02-23 16:26:35
|
Hello Duong, On Wed, Feb 23, 2011 at 2:08 PM, Duong Dang <dan...@gm...> wrote: > On Wed, Feb 23, 2011 at 4:53 PM, Ian Mallett <geo...@gm...> wrote: > > On Wed, Feb 23, 2011 at 8:38 AM, Alejandro Segovia <as...@gm...> > > wrote: > >> > >> Hello Duong, > >> > >> On Wed, Feb 23, 2011 at 11:55 AM, Duong Dang <dan...@gm...> > wrote: > >>> > >>> Hello there, > >>> > >>> We are having a problem with PyOpenGL on a Ubuntu 10.04 machine with a > >>> Intel GMA945 graphics card. The following code works in C++, but its > >>> counterpart seg-faults in python. Any idea why that is? > >> > >> I can't reproduce the problem on an NVIDIA video card, > > > > Nor I. > > Thanks for testing, we also tried > http://www.opengl.org/resources/code/samples/redbook/hello.c > and > > http://bazaar.launchpad.net/~mcfletch/pyopengl-demo/trunk/annotate/head:/PyOpenGL-Demo/redbook/hello.py > > which should be identical. The c program displays a white square just > fine but the python script seg faults again on the Intel card. > On another PC with a nvidia card, both programs work fine. > Do you have any other information on the crash? What OS are you running the script on? If you're on Linux, maybe you could record and inspect a valgrind dump. I don't know of any equivalent tools for Windows. Alejandro.- -- Alejandro Segovia Azapian Director, Algorithmia: Visualization & Acceleration http://web.algorithmia.net |
From: Ian M. <geo...@gm...> - 2011-02-23 16:25:26
|
Minor off-topic note: Intel cards suck. Majorly. When they aren't being incapable and underpowered, they cause bizaare problems like this and have mediocre support for GL functionality that's been core since 1998, let alone extensions.</hate> |
From: Duong D. <dan...@gm...> - 2011-02-23 16:08:48
|
On Wed, Feb 23, 2011 at 4:53 PM, Ian Mallett <geo...@gm...> wrote: > On Wed, Feb 23, 2011 at 8:38 AM, Alejandro Segovia <as...@gm...> > wrote: >> >> Hello Duong, >> >> On Wed, Feb 23, 2011 at 11:55 AM, Duong Dang <dan...@gm...> wrote: >>> >>> Hello there, >>> >>> We are having a problem with PyOpenGL on a Ubuntu 10.04 machine with a >>> Intel GMA945 graphics card. The following code works in C++, but its >>> counterpart seg-faults in python. Any idea why that is? >> >> I can't reproduce the problem on an NVIDIA video card, > > Nor I. Thanks for testing, we also tried http://www.opengl.org/resources/code/samples/redbook/hello.c and http://bazaar.launchpad.net/~mcfletch/pyopengl-demo/trunk/annotate/head:/PyOpenGL-Demo/redbook/hello.py which should be identical. The c program displays a white square just fine but the python script seg faults again on the Intel card. On another PC with a nvidia card, both programs work fine. Cheers, --- Duong |
From: Ian M. <geo...@gm...> - 2011-02-23 15:54:17
|
On Wed, Feb 23, 2011 at 8:38 AM, Alejandro Segovia <as...@gm...>wrote: > Hello Duong, > > On Wed, Feb 23, 2011 at 11:55 AM, Duong Dang <dan...@gm...> wrote: > >> Hello there, >> >> We are having a problem with PyOpenGL on a Ubuntu 10.04 machine with a >> Intel GMA945 graphics card. The following code works in C++, but its >> counterpart seg-faults in python. Any idea why that is? >> > > I can't reproduce the problem on an NVIDIA video card, > Nor I. |
From: Alejandro S. <as...@gm...> - 2011-02-23 15:39:43
|
Hello Duong, On Wed, Feb 23, 2011 at 11:55 AM, Duong Dang <dan...@gm...> wrote: > Hello there, > > We are having a problem with PyOpenGL on a Ubuntu 10.04 machine with a > Intel GMA945 graphics card. The following code works in C++, but its > counterpart seg-faults in python. Any idea why that is? > I can't reproduce the problem on an NVIDIA video card, however, I find it strange that you are not providing any callbacks for rendering or handling window resize events. Have you tried adding stubs for these callbacks and checking if the problem persists? Good luck! Alejandro.- > > ------------------------------------------------------------------------------ > Free Software Download: Index, Search & Analyze Logs and other IT data in > Real-Time with Splunk. Collect, index and harness all the fast moving IT > data > generated by your applications, servers and devices whether physical, > virtual > or in the cloud. Deliver compliance at lower cost and gain new business > insights. http://p.sf.net/sfu/splunk-dev2dev > _______________________________________________ > PyOpenGL Homepage > http://pyopengl.sourceforge.net > _______________________________________________ > PyOpenGL-Users mailing list > PyO...@li... > https://lists.sourceforge.net/lists/listinfo/pyopengl-users > > -- Alejandro Segovia Azapian Director, Algorithmia: Visualization & Acceleration http://web.algorithmia.net |