pyopengl-users Mailing List for PyOpenGL (Page 46)
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: Tim S. (25121) <tk...@mi...> - 2009-10-19 22:05:54
|
Can anyone recommend a tutorial for someone familiar with python but a beginner at opengl and it's concepts? I'd like to use wxpython with it's opengl canvas as well, as I've written applications in it before and it'll make the gui a snap. ********************************************************************** IMPORTANT - This email and any attachments may contain confidential or privileged information intended solely for the intended recipient and / or copyrighted material. If you are not the intended recipient you must not use, interfere with, disclose, copy or take any action with reliance on this email or any part of it. If you have received this email in error please advise the sender via return email and delete or destroy all copies of this email and attachments. Any claim to confidentiality or privilege is not waived or lost by reason of mistaken transmission of this message. Any unauthorised use, copying or distribution is prohibited. Minara Resources Limited does not warrant that this email or any attachments are free of viruses and cannot guarantee the accuracy, reliability or completeness of this email and any attachments. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.clearswift.com ********************************************************************** |
From: Cata <cat...@gm...> - 2009-10-19 16:58:52
|
You can use this simple soft from http://www.opengl.org/sdk/tools/ShaderDesigner/ Is simple to use it . -- My sites: http://free-tutorials.org - tutorials http://tv.free-tutorials.org - video tutorials |
From: Mads I. <mp...@co...> - 2009-10-19 06:11:53
|
I keep adding typos. Here's what it should be (sorry): 1. Works in a pure PyOpenGL setting on Ubuntu 8.04 with an ATI card (fglrx). 2. *Fails* in a QGLWidget on Ubuntu 8.04 with an ATI card (fglrx). 3. Works in a pure PyOpenGL setting on Ubuntu 9.04 with an NVidia card. 4. Works in a QGLWidget Ubuntu 9.04 with an NVidia card. -- +-------------------------------------------------------------+ | Mads Ipsen, Scientific developer | +-------------------------------+-----------------------------+ | QuantumWise A/S | phone: +45-29716388 | | Nørre Søgade 27A | www: www.quantumwise.com | | DK-1370 Copenhagen K, Denmark | email: mp...@qu... | +-------------------------------+-----------------------------+ |
From: Mads I. <mp...@co...> - 2009-10-19 06:09:19
|
Christian wrote: > Hi, > > thank you for your answer that should match my needs. And it seems that > the deprecation model isn't that hard as announced first. For example > NVidia says: > > "5) Will existing applications still work on current and future shipping > hardware? > > NVIDIA has /no/ plans for dropping support for OpenGL 2.1, and earlier > versions, on our existing /and/ future shipping hardware. As a result, > /all/ currently shipping applications will continue to work on NVIDIA's > existing and future hardware." [1] > > Christian > > [1] http://developer.nvidia.com/object/opengl_3_driver.html > > > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > PyOpenGL Homepage > http://pyopengl.sourceforge.net > _______________________________________________ > PyOpenGL-Users mailing list > PyO...@li... > https://lists.sourceforge.net/lists/listinfo/pyopengl-users > > You'll find a good GLSL primer here: http://www.lighthouse3d.com/opengl/glsl Best regards, Mads -- +-------------------------------------------------------------+ | Mads Ipsen, Scientific developer | +-------------------------------+-----------------------------+ | QuantumWise A/S | phone: +45-29716388 | | Nørre Søgade 27A | www: www.quantumwise.com | | DK-1370 Copenhagen K, Denmark | email: mp...@qu... | +-------------------------------+-----------------------------+ |
From: Christian <chr...@ya...> - 2009-10-18 12:45:27
|
Hi, thank you for your answer that should match my needs. And it seems that the deprecation model isn't that hard as announced first. For example NVidia says: "5) Will existing applications still work on current and future shipping hardware? NVIDIA has /no/ plans for dropping support for OpenGL 2.1, and earlier versions, on our existing /and/ future shipping hardware. As a result, /all/ currently shipping applications will continue to work on NVIDIA's existing and future hardware." [1] Christian [1] http://developer.nvidia.com/object/opengl_3_driver.html |
From: Ian M. <geo...@gm...> - 2009-10-18 04:41:52
|
Hi, Shaders and VBOs are the future. That's why they're so highly advocated. That doesn't mean the old ways are wrong; on the contrary, they're excellent for whipping up a quick demo. Don't even worry about OpenGL 3.0 or 3.1. PyOpenGL versions for these, as far as I know, don't even exist yet. Both shaders and VBOs are widely supported, particularly on nVidia hardware. Shaders, for instance, go back a long ways. You'll probably want shader model 1.2 or 1.3. Both run on my old laptop (nVidia 7600). If you want to use shader model 1.1, you can use really old hardware. Wikipedia says the 4xxx series supported it. If you're just going for data visualization, though, you may not even need shaders. Likewise, a simple display list is usually just as fast as a VBO. I do definitely recommend learning how to use shaders at least at some point, however. Ian |
From: Christian <chr...@ya...> - 2009-10-18 03:21:10
|
Hi, I want to write a new program which visualize some data with OpenGL. While reading the docs I am told everywhere to use the new OpenGL 3.x model and prevent using deprecated functions. Further I should write my own shaders and use VBOs. This sounds very exciting and I would immediately use the learned stuff. But I have some concerns regarding portability. The program doesn't require much render power and has to run on old or low-end hardware. If I would use the new model with GLSL 1.30 and VBO the program would require very new hardware with OpenGL 3.x support (GF 8 series or better) and an updated driver, right? An alternative would be to use the old interface which would only require let's say OpenGL 1.x. But that's against anything I have been told to. In which API should I write the program? What are the possibilities (extension library, Mesa)? I appreciate your help! Christian |
From: Mads I. <mp...@co...> - 2009-10-16 10:46:07
|
No, I haven't solved this one yet. Here's what I found out: 1. Works in a pure PyOpenGL setting on Ubuntu 8.04 with an ATI card (fglrx). 2. *Fails* in a QGLWidget on Ubuntu 8.04 with an ATI card (fglrx). 3. Works in a pure PyOpenGL setting on Ubuntu 9.04 with an NVidia card. 4. Works in a QGLWidget Ubuntu 8.04 with an ATI card. It's really strange! Anyway I have attached my PyOpenGL version below. If you think I am doing something that potentially could mess things up, please let me know. from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * theta = 0.0 def InitGL(Width, Height): glClearColor(1.0, 1.0, 1.0, 1.0) glEnable(GL_DEPTH_TEST) glShadeModel(GL_SMOOTH) glMatrixMode(GL_PROJECTION) glLoadIdentity() gluPerspective(45.0, float(Width)/float(Height), 0.1, 100.0) glMatrixMode(GL_MODELVIEW) setShaders() def ReSizeGLScene(w, h): ratio = 1.0 * w / h glMatrixMode(GL_PROJECTION) glLoadIdentity() glViewport(0, 0, w, h); gluPerspective(45,ratio,1,1000) glMatrixMode(GL_MODELVIEW); def DrawGLScene(): global theta glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glLoadIdentity() gluLookAt(0.0, 0.0, 5.0, 0.0, 0.0,-1.0, 0.0, 1.0, 0.0) glRotatef(theta, 0, 1, 1); glColor(0.0, 0.5, 0.5, 1.0) glutSolidTeapot(1) glutSwapBuffers() theta += 0.1 def setShaders(): v = glCreateShader(GL_VERTEX_SHADER) f = glCreateShader(GL_FRAGMENT_SHADER) vs = ['''void main() { gl_Position = ftransform(); }'''] fs = ['''void main() { gl_FragColor = vec4(1.0, 0.5, 0.5, 1.0); }'''] glShaderSource(v, vs) glShaderSource(f, fs) glCompileShader(v) glCompileShader(f) p = glCreateProgram() glAttachShader(p,v) glAttachShader(p,f) glLinkProgram(p) glUseProgram(p) def keyPressed(*args): if args[0] == '\x1b': sys.exit() def main(): glutInit(sys.argv) glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH) glutInitWindowSize(640, 480) glutInitWindowPosition(0, 0) glutCreateWindow("Shader") glutDisplayFunc(DrawGLScene) glutIdleFunc(DrawGLScene) glutReshapeFunc(ReSizeGLScene) glutKeyboardFunc(keyPressed) InitGL(640, 480) glutMainLoop() # Print message to console, and kick off the main to get it rolling. if __name__ == "__main__": print "Hit ESC key to quit." main() Ben De Luca wrote: > Did you figure it out? your shader looks to be ok, which implies the > issue is out side of your shader some where? > > > What platform are you on? > > > On 12/10/2009, at 8:56 AM, Mads Ipsen wrote: > >> Please ignore the first post which had errors. This one is correct >> >> OK, so its time to write the first most simple fragment shader ever. But >> it doesn't work: >> >> void main() >> { >> gl_FragColor = vec4(0.5, 0.5, 0.5, 1.0); >> } >> >> No teapot - just black. Changing to >> >> gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); >> >> gives red teapot, and vec4(0.0, 1.0, 0.0, 1.0) and vec4(0.0, 0.0, 1.0, >> 1.0) gives green and blue teapot. But any RGB triplet with values < 1.0 >> are always truncated to 0.0. For example: >> >> >> vec4(1.0, 0.5, 0.0, 1.0) -> pure red >> vec4(0.0, 0.5, 0.5, 1.0) -> pure black >> >> I have no clue about whats up. >> >> Best regards, >> >> Mads >> >> -- >> +-------------------------------------------------------------+ >> | Mads Ipsen, Scientific developer | >> +-------------------------------+-----------------------------+ >> | QuantumWise A/S | phone: +45-29716388 | >> | Nørre Søgade 27A | www: www.quantumwise.com | >> | DK-1370 Copenhagen K, Denmark | email: mp...@qu... | >> +-------------------------------+-----------------------------+ >> >> >> >> ------------------------------------------------------------------------------ >> >> Come build with us! The BlackBerry(R) Developer Conference in SF, CA >> is the only developer event you need to attend this year. Jumpstart your >> developing skills, take BlackBerry mobile applications to market and >> stay >> ahead of the curve. Join us from November 9 - 12, 2009. Register now! >> http://p.sf.net/sfu/devconference >> _______________________________________________ >> PyOpenGL Homepage >> http://pyopengl.sourceforge.net >> _______________________________________________ >> PyOpenGL-Users mailing list >> PyO...@li... >> https://lists.sourceforge.net/lists/listinfo/pyopengl-users > -- +-------------------------------------------------------------+ | Mads Ipsen, Scientific developer | +-------------------------------+-----------------------------+ | QuantumWise A/S | phone: +45-29716388 | | Nørre Søgade 27A | www: www.quantumwise.com | | DK-1370 Copenhagen K, Denmark | email: mp...@qu... | +-------------------------------+-----------------------------+ |
From: Frédéric <fre...@gb...> - 2009-10-16 08:29:51
|
Le vendredi 16 octobre 2009 08:08, Mads Ipsen a écrit : > The QGLWidget from PyQt4 provides a generic framework for doing OpenGL > graphics. But if you have PyQt4 related questions you should consult the > PyQt4 mailing list: http://www.riverbankcomputing.co.uk/support/lists. Sure; for this PyQt4 specific problem, I won't bother you here. But I really plan to use native OpenGL functions inside PyQt4 widget, so I need your help. Qt Widget and OpenGL have to work together, and it is not very easy to mix both worlds! > The double buffering behavior of the QGLWidget, however, is pretty > well-described in the Qt documentation > http://doc.trolltech.com/4.5/qglwidget.html. Thanks. > In general, I suggest you start off by developing a very simple example > that displays, say, a sphere or a torus and make sure this works as > intended. Then, you can start off by doing more complex things. Ok. -- Frédéric http://www.gbiloba.org |
From: Mads I. <mp...@co...> - 2009-10-16 08:08:54
|
Frédéric wrote: > On vendredi 16 octobre 2009, Ian Mallett wrote: > > >> I can't really help you directly, as I have no idea what PyQt4 is. >> >> The flickering screen might be caused by vsync issues and/or >> double/single buffering issues. >> >> To your second question, OpenGL also has many blending modes, so you can >> use those. I don't know how that works with PyQt4. >> > > Thanks for your answer. I will dig for that vsync/double buffering issue. > > PyQt4 is the Python binding for the Qt graphical toolkit. > > The QGLWidget from PyQt4 provides a generic framework for doing OpenGL graphics. But if you have PyQt4 related questions you should consult the PyQt4 mailing list: http://www.riverbankcomputing.co.uk/support/lists. The double buffering behavior of the QGLWidget, however, is pretty well-described in the Qt documentation http://doc.trolltech.com/4.5/qglwidget.html. In general, I suggest you start off by developing a very simple example that displays, say, a sphere or a torus and make sure this works as intended. Then, you can start off by doing more complex things. Best regards, Mads -- +-------------------------------------------------------------+ | Mads Ipsen, Scientific developer | +-------------------------------+-----------------------------+ | QuantumWise A/S | phone: +45-29716388 | | Nørre Søgade 27A | www: www.quantumwise.com | | DK-1370 Copenhagen K, Denmark | email: mp...@qu... | +-------------------------------+-----------------------------+ |
From: Frédéric <fre...@gb...> - 2009-10-16 06:12:50
|
On vendredi 16 octobre 2009, Ian Mallett wrote: > I can't really help you directly, as I have no idea what PyQt4 is. > > The flickering screen might be caused by vsync issues and/or > double/single buffering issues. > > To your second question, OpenGL also has many blending modes, so you can > use those. I don't know how that works with PyQt4. Thanks for your answer. I will dig for that vsync/double buffering issue. PyQt4 is the Python binding for the Qt graphical toolkit. -- Frédéric http://www.gbiloba.org |
From: Ian M. <geo...@gm...> - 2009-10-15 23:21:48
|
I can't really help you directly, as I have no idea what PyQt4 is. The flickering screen might be caused by vsync issues and/or double/single buffering issues. To your second question, OpenGL also has many blending modes, so you can use those. I don't know how that works with PyQt4. Ian |
From: Frédéric <fre...@gb...> - 2009-10-15 14:22:05
|
Hi, I'm new to OpenGL, and I need your help to start a project: an open-source cross-platform photo slideshow software, like Pictures-To-Exe[1], ProShow[2] or m.objects[3]. It will probably be a mix of their main features. I started to write the engine, using PyQt4, which has nice features for both audio and display. Here is the part of the code I currently use to draw the images with their respective luminosity, to simulate the projectors: class PreviewDialogObject(QtGui.QWidget): def __init__(self, projectors): QtGui.QWidget.__init__(self) self.__projectors = projectors layout = QtGui.QHBoxLayout() self.__previewLabel = QtGui.QLabel("Preview") layout.addWidget(self.__previewLabel) self.setLayout(layout) self.resize(WIDTH, HEIGHT) def refresh(self): image = QtGui.QImage(WIDTH, HEIGHT, QtGui.QImage.Format_ARGB32_Premultiplied) painter = QtGui.QPainter(image) painter.setCompositionMode(QtGui.QPainter.CompositionMode_Source) painter.fillRect(QtCore.QRect(0, 0, WIDTH, HEIGHT), QtCore.Qt.black) painter.setCompositionMode(QtGui.QPainter.CompositionMode_Screen) for d in self.__projectors.itervalues(): painter.setOpacity(d['opacity']) painter.drawImage((WIDTH - d['image'].width()) / 2, (HEIGHT - d['image'].height()) / 2, d['image']) painter.end() self.__previewLabel.setPixmap(QtGui.QPixmap.fromImage(image)) But even on my fast machine (quad core Q6600), I get some flickering ; so I think I need to switch to OpenGL to get very smooth transitions. I found some code on the web to use a QGLWidget, instead of the QWidget: class PreviewDialogGLObject(QtGui.QGraphicsView): def __init__(self, projectors): QtGui.QGraphicsView.__init__(self) self.__projectors = projectors format = QtOpenGL.QGLFormat() format.setSampleBuffers(True) format.setDoubleBuffer(True) widget = QtOpenGL.QGLWidget(format) self.setViewport(widget) self.setViewportUpdateMode(QtGui.QGraphicsView.FullViewportUpdate) self.__previewScene = PreviewScene(self.__projectors) self.setScene(self.__previewScene) self.resize(WIDTH, HEIGHT) def refresh(self): self.__previewScene.update() class PreviewScene(QtGui.QGraphicsScene): def __init__(self, projectors): QtGui.QGraphicsScene.__init__(self) self.__projectors = projectors def drawBackground(self, painter, rect): painter.save() painter.setCompositionMode(QtGui.QPainter.CompositionMode_Source) painter.fillRect(QtCore.QRect(-WIDTH / 2, -HEIGHT / 2, WIDTH, HEIGHT), QtCore.Qt.black) #painter.setCompositionMode(QtGui.QPainter.CompositionMode_Screen) painter.setCompositionMode(QtGui.QPainter.CompositionMode_Source) for d in self.__projectors.itervalues(): painter.setOpacity(d['opacity']) painter.drawImage(-d['image'].width() / 2, -d['image'].height() / 2, d['image']) painter.restore() But it does not improve anything at all! I get the same issue. The only difference is that I can't use the 'Screen' composition mode anymore :o/ This is why I'm here! I guess that I have to use native OpenGL functions in the drawBackground() method, to crossfade my images. But I can't get it work. I spent days on the web looking at tutorials or books, but I'm lost. I understand that I need to use textures, but all tutorials use different methods, and my tests does not lead to anything usable (it takes several seconds to refresh a simple image!). More, I think I should start using OpenGL3, but all functions used in the tutorials are deprecated, and I didn't find any information for replacement. So, it would be nice if someone could help me to start, with bases. I also would like to know if OpenGL will allow me to use complex composition modes, like 'screen' or 'addition', to simulate different projection results? Thanks for reading, [1] http://www.wnsoft.com/apr/index.html [2] http://www.photodex.com/products/proshowgold [3] http://www.mobjects.com -- Frédéric http://www.gbiloba.org |
From: Mads I. <mp...@co...> - 2009-10-12 07:56:49
|
Please ignore the first post which had errors. This one is correct OK, so its time to write the first most simple fragment shader ever. But it doesn't work: void main() { gl_FragColor = vec4(0.5, 0.5, 0.5, 1.0); } No teapot - just black. Changing to gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); gives red teapot, and vec4(0.0, 1.0, 0.0, 1.0) and vec4(0.0, 0.0, 1.0, 1.0) gives green and blue teapot. But any RGB triplet with values < 1.0 are always truncated to 0.0. For example: vec4(1.0, 0.5, 0.0, 1.0) -> pure red vec4(0.0, 0.5, 0.5, 1.0) -> pure black I have no clue about whats up. Best regards, Mads -- +-------------------------------------------------------------+ | Mads Ipsen, Scientific developer | +-------------------------------+-----------------------------+ | QuantumWise A/S | phone: +45-29716388 | | Nørre Søgade 27A | www: www.quantumwise.com | | DK-1370 Copenhagen K, Denmark | email: mp...@qu... | +-------------------------------+-----------------------------+ |
From: Mads I. <mp...@co...> - 2009-10-12 07:04:15
|
OK, so its time to write the first most simple fragment shader ever. But it doesn't work: void main() { gl_FragColor = vec4(0.5, 0.5, 0.5, 1.0); } No teapot. Changing to gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); gives red teapot, and vec4(0.0, 0.5, 0.0, 1.0) and vec4(0.0, 0.0, 1.0, 1.0) gives green and blue teapot. But any RGB triplet with values < 1.0 are always truncated to 0.0. For example: vec4(1.0, 0.5, 0.0, 1.0) -> pure red vec4(0.0, 0.5, 0.5, 1.0) -> pure black I have no clue about whats up. Best regards, Mads -- +-------------------------------------------------------------+ | Mads Ipsen, Scientific developer | +-------------------------------+-----------------------------+ | QuantumWise A/S | phone: +45-29716388 | | Nørre Søgade 27A | www: www.quantumwise.com | | DK-1370 Copenhagen K, Denmark | email: mp...@qu... | +-------------------------------+-----------------------------+ |
From: Ian M. <geo...@gm...> - 2009-10-07 02:44:05
|
Hello, I'm trying to debug a weird FBO/depth problem, and it would be great to have screenshots of the depth. My current method does not work: def ScreenSurf(rect=AUTO,type=RGB,framebuffer=0): if rect == AUTO: size = glGetFloatv(GL_VIEWPORT) size = [int(round(size[2])),int(round(size[3]))] rect = [0,0,size[0],size[1]] glPixelStorei(GL_PACK_ROW_LENGTH,0) glPixelStorei(GL_PACK_SKIP_ROWS,0) glPixelStorei(GL_PACK_SKIP_PIXELS,0) if type==RGBA: glPixelStorei(GL_PACK_ALIGNMENT,4) elif type==RGB: glPixelStorei(GL_PACK_ALIGNMENT,1) elif type==DEPTH: glPixelStorei(GL_PACK_ALIGNMENT,2) try: data = glReadPixels(rect[0],rect[1],rect[2],rect[3],type,GL_UNSIGNED_BYTE) print len(data) except: previous = glGetIntegerv(GL_READ_BUFFER) glReadBuffer(GL_COLOR_ATTACHMENT0_EXT+framebuffer) data = glReadPixels(rect[0],rect[1],rect[2],rect[3],type,GL_UNSIGNED_BYTE) glReadBuffer(previous) if type==RGBA: return pygame.image.fromstring(data,(rect[2],rect[3]),'RGBA',1) elif type==RGB: return pygame.image.fromstring(data,(rect[2],rect[3]),'RGB',1) elif type==DEPTH: #What goes here? The surface that is returned is then saved (pygame.image.save()). The issue is that in the case of depth, data is of length x*y. In the case of RGB color, it is 3*rect[2]*rect[3]. In the case of RGBA, it is 4*rect[2]*rect[3]. PyGame doesn't know how to convert it (there's no pygame.image.fromstring(data,size,'R',1), for instance). What's a decent way to save the depth as an image? Thanks, Ian |
From: Ian M. <geo...@gm...> - 2009-10-04 05:16:00
|
Hi, I rediscovered a weird problem and I don't know how to fix it. A cubemap is created: texture = glGenTextures(1) glBindTexture(GL_TEXTURE_CUBE_MAP,texture) glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X,0,GL_RGB,512,512,0,GL_RGB,GL_UNSIGNED_BYTE,None) glTexParameterf(paramtype,GL_TEXTURE_MIN_FILTER,GL_NEAREST) glTexParameterf(paramtype,GL_TEXTURE_MAG_FILTER,GL_NEAREST) glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X,0,GL_RGB,512,512,0,GL_RGB,GL_UNSIGNED_BYTE,None) glTexParameterf(paramtype,GL_TEXTURE_MIN_FILTER,GL_NEAREST) glTexParameterf(paramtype,GL_TEXTURE_MAG_FILTER,GL_NEAREST) glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y,0,GL_RGB,512,512,0,GL_RGB,GL_UNSIGNED_BYTE,None) glTexParameterf(paramtype,GL_TEXTURE_MIN_FILTER,GL_NEAREST) glTexParameterf(paramtype,GL_TEXTURE_MAG_FILTER,GL_NEAREST) glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,0,GL_RGB,512,512,0,GL_RGB,GL_UNSIGNED_BYTE,None) glTexParameterf(paramtype,GL_TEXTURE_MIN_FILTER,GL_NEAREST) glTexParameterf(paramtype,GL_TEXTURE_MAG_FILTER,GL_NEAREST) glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z,0,GL_RGB,512,512,0,GL_RGB,GL_UNSIGNED_BYTE,None) glTexParameterf(paramtype,GL_TEXTURE_MIN_FILTER,GL_NEAREST) glTexParameterf(paramtype,GL_TEXTURE_MAG_FILTER,GL_NEAREST) glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z,0,GL_RGB,512,512,0,GL_RGB,GL_UNSIGNED_BYTE,None) glTexParameterf(paramtype,GL_TEXTURE_MIN_FILTER,GL_NEAREST) glTexParameterf(paramtype,GL_TEXTURE_MAG_FILTER,GL_NEAREST) Later, it is updated: x,y,z=pos update = [1,2,3,4,5,6] faces = [GL_TEXTURE_CUBE_MAP_POSITIVE_X,GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Y,GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z,GL_TEXTURE_CUBE_MAP_NEGATIVE_Z] for i in update: glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT) glLoadIdentity() cubemapview.set_view() if i == 1: gluLookAt(x,y,z, x+1, y, z, 0,-1, 0) elif i == 2: gluLookAt(x,y,z, x-1, y, z, 0,-1, 0) elif i == 3: gluLookAt(x,y,z, x,y+1, z, 0, 0, 1) elif i == 4: gluLookAt(x,y,z, x,y-1, z, 0, 0,-1) elif i == 5: gluLookAt(x,y,z, x, y,z+1, 0,-1, 0) elif i == 6: gluLookAt(x,y,z, x, y,z-1, 0,-1, 0) drawreflectees() glCopyTexImage2D(faces[i-1],0,GL_RGBA,0,0,512,512,0) When it is time to draw an object, the cubemap is passed to the shader as active texture 1: glActiveTexture(num) active_texture = glGetIntegerv(GL_ACTIVE_TEXTURE) - GL_TEXTURE0 glBindTexture(GL_TEXTURE_CUBE_MAP,texturecube) glUniform1i(glGetUniformLocation(program,name),active_texture) glLibActiveTexture(0) ...drawing with that object crashes with an invalid operation! Two things will fix it. If the cubemap is not updated before (specifically, no call to glCopyTexImage2D), the problem does not happen. If another texture (a 2D one) is passed to active texture 2: glActiveTexture(num) active_texture = glGetIntegerv(GL_ACTIVE_TEXTURE) - GL_TEXTURE0 glBindTexture(GL_TEXTURE_2D,texture2d) glUniform1i(glGetUniformLocation(program,name),active_texture) glLibActiveTexture(0) ...the problem also goes away. My question is, why is it doing this? Help? Thanks, Ian |
From: Ian M. <geo...@gm...> - 2009-10-02 02:29:50
|
This was the subject of horrendous trouble for me a while back. On my old and new laptops, the argument can be either a string or a [string]. On my friend's ATI card, however, it MUST be a [string]. It was funny; it took months to track it down to that. It was my fault really; I had edited it out in a very early version as it didn't seem to be be necessary...for me but not for the rest of the world, it turned out. |
From: Mike C. F. <mcf...@vr...> - 2009-10-01 17:55:59
|
Nikolai Ugelvik wrote: > As far as I can see in the documentation, the python wrapper for > glShaderSource takes a shaderObj and string as parameters. However, > after a lot of problems testing my application on ATI cards, having > weird shader linking bugs, I decided to check out "shaders.py" in the > pyopengl package. As it turns out, it doesn't really take a string as a > parameter, it takes a list with a string in it. This works for both > Nvidia and ATI, so i expect that it is correct. > > This is just a request to get the documentation correctly updated (or > have the wrapper convert this automatically?). It took me quite a while > to figure this out, so I just want to make sure others don't have to go > down the same road. > > I've updated the documentation in the package. There's auto-conversion in the convenience code (OpenGL.GL.shaders), but I'm growing wary of putting convenience wrappers into the core code-paths... still, this is likely one of the places it would be worthwhile. Take care, and thanks for the bug report, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: Nikolai U. <ni...@ne...> - 2009-10-01 17:20:19
|
As far as I can see in the documentation, the python wrapper for glShaderSource takes a shaderObj and string as parameters. However, after a lot of problems testing my application on ATI cards, having weird shader linking bugs, I decided to check out "shaders.py" in the pyopengl package. As it turns out, it doesn't really take a string as a parameter, it takes a list with a string in it. This works for both Nvidia and ATI, so i expect that it is correct. This is just a request to get the documentation correctly updated (or have the wrapper convert this automatically?). It took me quite a while to figure this out, so I just want to make sure others don't have to go down the same road. -Nikolai |
From: René D. <re...@gm...> - 2009-09-26 01:06:37
|
On Fri, Sep 25, 2009 at 1:26 PM, Mads Ipsen <mp...@co...> wrote: > > How do I in the simplest possible manner set up an OpenGL context > so I can query the vendor string? > > Depends on which windowing toolkit you want to use. I know it's possible to create a context without a visible window on most platforms... but it's platform specific. I'm not sure how to do it in qt without one... but maybe it's possible. Either just load one of their widgets... or ask on a qt mailing list. cheers. |
From: Mads I. <mp...@co...> - 2009-09-25 12:31:47
|
Greg Ewing wrote: > Mads Ipsen wrote: > >> How come glGetString(GL_VENDOR) returns None if I don't have an OpenGL >> context? >> > > Because you don't *have* an OpenGL vendor until you > have a context. Contexts belonging to different > display devices can be using drivers from different > vendors, so it's a property of the context rather > than something global. > > Something it's easy to overlook about OpenGL is > that it's really an object-oriented system, with > almost all of the functions being methods of the > context. But the API does a good job of hiding this > by making the current context an implicit global > parameter. > > Thanks for the answer. My question can then be boiled down to: How do I in the simplest possible manner set up an OpenGL context so I can query the vendor string? Best regards, Mads -- +------------------------------------------------------------+ | Mads Ipsen, Scientific developer | +------------------------------+-----------------------------+ | QuantumWise A/S | phone: +45-29716388 | | Nørresøgade 27A | www: www.quantumwise.com | | DK-1370 Copenhagen, Denmark | email: mp...@qu... | +------------------------------+-----------------------------+ |
From: Greg E. <gre...@ca...> - 2009-09-25 01:09:12
|
Mads Ipsen wrote: > How come glGetString(GL_VENDOR) returns None if I don't have an OpenGL > context? Because you don't *have* an OpenGL vendor until you have a context. Contexts belonging to different display devices can be using drivers from different vendors, so it's a property of the context rather than something global. Something it's easy to overlook about OpenGL is that it's really an object-oriented system, with almost all of the functions being methods of the context. But the API does a good job of hiding this by making the current context an implicit global parameter. -- Greg |
From: Mads I. <mp...@co...> - 2009-09-24 19:37:16
|
René Dudfield wrote: > On Thu, Sep 24, 2009 at 7:48 AM, Mads Ipsen <mp...@co...> wrote: > >> How come glGetString(GL_VENDOR) returns None if I don't have an OpenGL >> context? >> >> My innocent purpose of querying the vendor string is to display some >> driver info in an 'about box'. Normally I get the context by launching a >> QGLWidget from Qt, but it would be really silly to do this for the >> purpose of displaying an about box. >> >> All tricks and suggestions are most welcome, >> >> Mads >> >> > Hi, > > That can crash on some machines too without a connection. It's for > querying the GL connection, so you need a connection to use it. > > Reading from the glxinfo program might be another idea to try... if > it's there on the platform. > > cheers, > > OK, so how do I in the simplest possible manner set up an OpenGL context so I can query the vendor string, i.e. without opening any redundant windows? Calling glxinfo (or any other external program) is not an option, since we do cross platform development. Mads -- +------------------------------------------------------------+ | Mads Ipsen, Scientific developer | +------------------------------+-----------------------------+ | QuantumWise A/S | phone: +45-29716388 | | Nørresøgade 27A | www: www.quantumwise.com | | DK-1370 Copenhagen, Denmark | email: mp...@qu... | +------------------------------+-----------------------------+ |
From: René D. <re...@gm...> - 2009-09-24 14:05:24
|
On Thu, Sep 24, 2009 at 7:48 AM, Mads Ipsen <mp...@co...> wrote: > How come glGetString(GL_VENDOR) returns None if I don't have an OpenGL > context? > > My innocent purpose of querying the vendor string is to display some > driver info in an 'about box'. Normally I get the context by launching a > QGLWidget from Qt, but it would be really silly to do this for the > purpose of displaying an about box. > > All tricks and suggestions are most welcome, > > Mads > Hi, That can crash on some machines too without a connection. It's for querying the GL connection, so you need a connection to use it. Reading from the glxinfo program might be another idea to try... if it's there on the platform. cheers, |