From basvandijk at home.nl Mon Mar 5 18:25:01 2007 From: basvandijk at home.nl (Bas van Dijk) Date: Mon Mar 5 18:18:22 2007 Subject: [HOpenGL] Textures from SDL upside down Message-ID: <200703060025.01699.basvandijk@home.nl> Hi, I am using HOpenGL in combination with hsSDL (http://darcs.haskell.org/~lemmih/hsSDL). This works great except for texture loading. All my textures are mirrored over the v-axis. So the top of a texture becomes the bottom. I first thought that I got the texture coordinates wrong. But the textures are also flipped on the GLU quadrics. Is there some way to tell (H)OpenGL that a texture is mirrored? I tried glPixelStore parameters but I don't think it is possible that way. Perhaps it is possible to change a hsSDL surface before loading the pixel data. Any advice is welcome. regards, Bas van Dijk From shelarcy at gmail.com Fri Mar 9 01:28:46 2007 From: shelarcy at gmail.com (shelarcy) Date: Fri Mar 9 01:21:55 2007 Subject: [HOpenGL] OpenGL and GLUT packages on Windows cause undefeined reference problem if build theirs myself Message-ID: Hello all, I tried to build OpenGL and GLUT packages on Windows by myself. Then runhaskell Setup.hs build cause below problem. $ runhaskell Setup.hs build Reading parameters from c:\home\ghc-6.7.20070305\libraries\GLUT\GLUT.buildinfo Preprocessing library GLUT-2.1... Building GLUT-2.1... (snip) c:\home\ghc-6.7.20070305\ghc-6.7.20070305\bin\ar.exe q dist\build\libHSGLUT-2.1.a dist\build\Graphics\UI\GLUT.o d (snip) dist\build\Graphics\UI\GLUT\Callbacks\Registration_stub.o Warning: resolving _hs_GLUT_getProcAddress@4 by linking to _hs_GLUT_getProcAddress Use --enable-stdcall-fixup to disable these warnings Use --disable-stdcall-fixup to disable these fixups This problem is already noticed by Pepe Gallardo. http://www.haskell.org/pipermail/hopengl/2006-December/000680.html And same problem cause if build GHC head snapshot myself, too. C:\home\ghc-6.7.20070305\libraries\GLUT\examples\OrangeBook\ogl2brick>C:\home\gh c-6.7.20070305\ghc-6.7.20070305\bin\ghc.exe --make Brick.hs [1 of 1] Compiling Main ( Brick.hs, Brick.o ) Linking Brick.exe ... C:/home/ghc-6.7.20070305/ghc-6.7.20070305/libHSGLUT.a(Extensions__3.o)(.text+0x1 4):fake: undefined reference to `hs_GLUT_getProcAddress@4' C:/home/ghc-6.7.20070305/ghc-6.7.20070305/libHSOpenGL.a(Extensions__3.o)(.text+0 x14):fake: undefined reference to `hs_OpenGL_getProcAddress@4' collect2: ld returned 1 exit status This problem doesn't occure Sigbjorn Finne's build snapshot ... http://www.haskell.org/ghc/dist/current/dist/ http://www.haskell.org/pipermail/cvs-ghc/2007-March/034396.html I don't know why .. but I know why reference is unresolved. CALLCONV is defined stdcall on Windows, but hs_**_getProcAddress (and other cbits's c functions) are build with ccall convention. Attached are darcs patch to fix these problem. But ... I don't know this patch doesn't cause any ptoblem Sigbjorn's next binary release. Because I don't know why OpenGL and GLUT can build correctly under his environment. Best Regars, -- shelarcy http://page.freett.com/shelarcy/ -------------- next part -------------- A non-text attachment was scrubbed... Name: opengl_fix_getProcAddress.dpatch Type: application/octet-stream Size: 3692 bytes Desc: not available Url : http://www.haskell.org/pipermail/hopengl/attachments/20070309/5f369a53/opengl_fix_getProcAddress-0001.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: glut_fix_getProcAddress.dpatch Type: application/octet-stream Size: 3085 bytes Desc: not available Url : http://www.haskell.org/pipermail/hopengl/attachments/20070309/5f369a53/glut_fix_getProcAddress-0001.obj From sven.panne at aedion.de Tue Mar 13 10:48:01 2007 From: sven.panne at aedion.de (Sven Panne) Date: Tue Mar 13 10:48:00 2007 Subject: [HOpenGL] OpenGL and GLUT packages on Windows cause undefeined reference problem if build theirs myself In-Reply-To: References: Message-ID: <200703131548.01203.sven.panne@aedion.de> On Friday 09 March 2007 07:28, shelarcy wrote: > [...] > This problem doesn't occure Sigbjorn Finne's build snapshot ... > http://www.haskell.org/ghc/dist/current/dist/ > http://www.haskell.org/pipermail/cvs-ghc/2007-March/034396.html > > I don't know why .. but I know why reference is unresolved. > > CALLCONV is defined stdcall on Windows, but hs_**_getProcAddress > (and other cbits's c functions) are build with ccall convention. > > Attached are darcs patch to fix these problem. > But ... I don't know this patch doesn't cause any ptoblem Sigbjorn's > next binary release. Because I don't know why OpenGL and GLUT can > build correctly under his environment. Nice analysis of the problem. Your patch looks correct, but I don't have a clue why Sigbjorn's binary release works. Before I commit these patches I'd like to understand the current state of affairs in detail, otherwise the "official" release might get broken. Sigbjorn? Cheers, S. From sven.panne at aedion.de Tue Mar 13 11:11:09 2007 From: sven.panne at aedion.de (Sven Panne) Date: Tue Mar 13 11:11:09 2007 Subject: [HOpenGL] Textures from SDL upside down In-Reply-To: <200703060025.01699.basvandijk@home.nl> References: <200703060025.01699.basvandijk@home.nl> Message-ID: <200703131611.09967.sven.panne@aedion.de> On Tuesday 06 March 2007 00:25, Bas van Dijk wrote: > I am using HOpenGL in combination with hsSDL > (http://darcs.haskell.org/~lemmih/hsSDL). This works great except for > texture loading. All my textures are mirrored over the v-axis. So the > top of a texture becomes the bottom. I first thought that I got the > texture coordinates wrong. But the textures are also flipped on the GLU > quadrics. IIRC, in SDL the y-coordinate increases when going down the screen, while OpenGL uses the usual mathematical convention of y increasing when going up. Therefore your images are flipped, I guess. > Is there some way to tell (H)OpenGL that a texture is mirrored? I tried > glPixelStore parameters but I don't think it is possible that way. > Perhaps it is possible to change a hsSDL surface before loading the > pixel data. Any advice is welcome. Usually the easiest and most efficient way is to simply flip your t texture coordinate, i.e. use 1-t instead of t. Using pixelStore should be possible, too (using negative offsets etc.), but often this is not really needed. Cheers, S. From sven.panne at aedion.de Tue Mar 13 11:58:14 2007 From: sven.panne at aedion.de (Sven Panne) Date: Tue Mar 13 11:58:18 2007 Subject: [HOpenGL] OpenGL and GLUT packages on Windows cause undefeined reference problem if build theirs myself In-Reply-To: <45F6C4DE.3070400@galois.com> References: <200703131548.01203.sven.panne@aedion.de> <45F6C4DE.3070400@galois.com> Message-ID: <200703131658.14901.sven.panne@aedion.de> On Tuesday 13 March 2007 16:35, Sigbjorn Finne wrote: > Some (early morning & obvious) guesses that might explain > the difference in behaviour: > > - one version is compiled via the NCG, the other via-C > (i.e., the latter gets its calling conventions from the header files.) I think this might it explain it best, so I'll commit those patches. Thanks, S. From sebastian.sylvan at gmail.com Tue Mar 13 14:13:12 2007 From: sebastian.sylvan at gmail.com (Sebastian Sylvan) Date: Tue Mar 13 14:13:11 2007 Subject: [HOpenGL] Textures from SDL upside down In-Reply-To: <200703131611.09967.sven.panne@aedion.de> References: <200703060025.01699.basvandijk@home.nl> <200703131611.09967.sven.panne@aedion.de> Message-ID: <3d96ac180703131113v312893deld97ed8481576ef4b@mail.gmail.com> On 3/13/07, Sven Panne wrote: > On Tuesday 06 March 2007 00:25, Bas van Dijk wrote: > > I am using HOpenGL in combination with hsSDL > > (http://darcs.haskell.org/~lemmih/hsSDL). This works great except for > > texture loading. All my textures are mirrored over the v-axis. So the > > top of a texture becomes the bottom. I first thought that I got the > > texture coordinates wrong. But the textures are also flipped on the GLU > > quadrics. > > IIRC, in SDL the y-coordinate increases when going down the screen, while > OpenGL uses the usual mathematical convention of y increasing when going up. > Therefore your images are flipped, I guess. > > > Is there some way to tell (H)OpenGL that a texture is mirrored? I tried > > glPixelStore parameters but I don't think it is possible that way. > > Perhaps it is possible to change a hsSDL surface before loading the > > pixel data. Any advice is welcome. > > Usually the easiest and most efficient way is to simply flip your t texture > coordinate, i.e. use 1-t instead of t. Texture coordinates are not always guarnteed to be in the [0,1] range though. So a coordinate of 1.2 would become -0.2 which will not always sample the correct texel (depending on texture wrapping mode). -- Sebastian Sylvan +46(0)736-818655 UIN: 44640862 From shelarcy at gmail.com Thu Mar 15 10:55:57 2007 From: shelarcy at gmail.com (shelarcy) Date: Thu Mar 15 10:56:17 2007 Subject: [HOpenGL] OpenGL and GLUT packages on Windows cause undefeined reference problem if build theirs myself In-Reply-To: <200703131658.14901.sven.panne@aedion.de> References: <200703131548.01203.sven.panne@aedion.de> <45F6C4DE.3070400@galois.com> <200703131658.14901.sven.panne@aedion.de> Message-ID: I checked that latest Sigbjorn's snapshot (ghc-6.7.20070314.20070314) is also works well. So we're not afraid of any problem on Windows. Thanks, On Wed, 14 Mar 2007 00:58:14 +0900, Sven Panne wrote: >> Some (early morning & obvious) guesses that might explain >> the difference in behaviour: >> >> - one version is compiled via the NCG, the other via-C >> (i.e., the latter gets its calling conventions from the header files.) > > I think this might it explain it best, so I'll commit those patches. -- shelarcy http://page.freett.com/shelarcy/