
Here's some C code i want to translate to haskell, but i can't find the proper bindings. I've been greping OpenGL and OpenGLRaw, but i can't find anything: // Let us create an FBO; to do this add the following at the end of initGL: glGenFramebuffers(1, &frameBuffer); // Bind the framebuffer such that following commands will affect it. glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer); // Then we will create a texture into which we will be rendering, directly after add: // Create a texture for the frame buffer, with specified filtering, // rgba-format and size glGenTextures(1, &texFrameBuffer); glBindTexture(GL_TEXTURE_2D, texFrameBuffer); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, 4, 512, 512, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); // Next we will attach the texture to the FBO: glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texFrameBuffer, 0); And this is the end of initGL: texture = ilutGLLoadImage("flake.ppm"); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, texture); glGenerateMipmap(GL_TEXTURE_2D); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); So far i have a modified version of my texture loader but i don't know if this is correct or what: whatIsThisIDontEven :: TextureSize2D -> IO TextureObject whatIsThisIDontEven size = do [texObj] <- genObjectNames 1 activeTexture $= TextureUnit 0 textureBinding Texture2D $= Just texObj generateMipmap Texture2D $= Enabled textureFilter Texture2D $= ((Nearest, Just Nearest), Nearest) texImage2D Nothing NoProxy 1 RGBA' size 0 (PixelData RGBA Float nullPtr) return texObj My problem is that glBindFramebuffer isn't available in the haskell bindings. At least i can't find it after extensive searching :( What to do? // Alexander

Hi,
I have patches against an older version of the OpenGL library (namely,
2.2.1.1),
which introduce the necessary functionality:
http://code.haskell.org/~bkomuves/hopengl_2009-03-13.patch
Render to texture works pretty well with that (except that some drivers
crash sometimes
when querying the framebuffer status...). The FBO part is in the module
Graphics.Rendering.OpenGL.GL.FBO
For example the C call `glBindFramebuffer' will become the statevar
`framebufferBinding'.
However, these patches are incompatible with the newer versions of the
OpenGL binding,
which builds on OpenGLRaw; probably it wouldn't be too much work to port
them, but
I haven't had time to investigate that.
Balazs
2010/4/27 Alexander Göransson
Here's some C code i want to translate to haskell, but i can't find the proper bindings. I've been greping OpenGL and OpenGLRaw, but i can't find anything:
// Let us create an FBO; to do this add the following at the end of initGL: glGenFramebuffers(1, &frameBuffer); // Bind the framebuffer such that following commands will affect it. glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer);
[...]
My problem is that glBindFramebuffer isn't available in the haskell bindings. At least i can't find it after extensive searching :(
What to do?
// Alexander _______________________________________________ HOpenGL mailing list HOpenGL@haskell.org http://www.haskell.org/mailman/listinfo/hopengl
participants (2)
-
Alexander Göransson
-
Balazs Komuves