Render Target or Render to Texture code ?
BlitzMax Forums/BlitzMax Programming/Render Target or Render to Texture code ?
| ||
Hi, I was using grabImage until now but some textures may be greater than the display so I need a Render Target or Render to Texture code that is working with OpenGL. Does anybody have such a thing ? Older modules or code (HighGfX or RTT, etc.) work no more with the current version of BlitzMax. Thanks EDIT I discover this on the Code Archives : http://blitzmax.com/codearcs/codearcs.php?code=2222 But I don't know if FBO (OpenGL 3.0 I think) is supported on old graphic cards plus it's using glewInit() The glOrtho isn't properly set in this example, should be glOrtho(0, image.width, 0, image.Height, -1, 1) or something |
| ||
Framebuffer objects require, I think, something like OpenGL 1.5, and support for the appropriate ARB extensions. Bearing in mind the framebuffer cannot be larger than the computer's maximum texture size, which is probably either 2048 or 4096 on most cards. Also Blitz does some stuff to mangle with flipping of textures and stuff, due to how OpenGL messes with it. Just set up a viewport vertically flipped? As for code, there is good working code in the OpenGL forum for using an FBO. I also posted a bunch of code in the 3rd Blitz community framework competition entry. |
| ||
Thanks ImaginaryHuman I will look at the framework entry. Since only 2 objects are using the grabimage shortcut I will simply limit their sizes to 480px since the minimal resolution allowed in my game is 640x480. By the way is there a compatibility list or something to know which card cannot use ARB extensions and certain OpenGL version ? |
| ||
By the way is there a compatibility list or something to know which card cannot use ARB extensions and certain OpenGL version ? You can get a list of extensions from the driver itself, like so: SetGraphicsDriver (GLGraphicsDriver ()) Graphics 640, 480 Local a:Byte Ptr Print "" a = glGetString (GL_VERSION) Print String.FromCString (a) Print "" a = glGetString (GL_EXTENSIONS) Print String.FromCString (a) ' See http://www.opengl.org/sdk/docs/man/xhtml/glGetString.xml |
| ||
EDIT: Nevermind =# |
| ||
Since only 2 objects are using the grabimage shortcut I will simply limit their sizes to 480px since the minimal resolution allowed in my game is 640x480. Well this is not working as it should yet. When the software is minimized or Alt-Tabbed the Grabimage isn't working correctly. ![]() As you can see I'm creating an extensible sprite from 9 tiny textures. Isn't there any better solution than grabimage for doing such thing ? A solution compatible with old graphic card preferably... I tried to use Pixmap too but that function is driver dependent with OpenGL so it's behavior is unpredictable. Plus all the 9 parts can be any existing textures of the game (so no dynamic flag to support lock and unlock pixmap features). |
| ||
Render to texture is supported on opengl 1.1, via a texture framebuffer. Just make the texture FBO, then bind it, set your scissor and size, then render as normal... but thats opengl only. http://www.google.co.uk/search?sourceid=chrome&ie=UTF-8&q=opengl+render+to+texture Should work fine for blitzmax using nehe code. |