[Solved] BRL.Max2D SDL Equivalent
BlitzMax Forums/Brucey's Modules/[Solved] BRL.Max2D SDL Equivalent
| ||
Still learning how to switch from BRL to SDL Max2D drivers and setup. I have a module that uses Import BRL.Max2D and I was wondering what is the equivalent import to SDL that works. |
| ||
Not sure what problems you're having but according to Brucey: For graphics, you can choose to use either sdl.gl2sdlmax2d, for Max2D compatibility, or go with mky.mojo2 (which is a port of Monkey's Mojo2), which isn't Max2D compatible but is a fairly modern shader-based renderer. So sdl.gl2sdlmax2d is GL2/GLES sdl.glsdlmax2d is GL only (so shouldn't work on mobiles, I haven't tested) brl.max2d is equal to sdl.glsdlmax2d any module name with graphics in it is the driver which max2d imports |
| ||
Import BRL.Max2D Doesn't do any rendering itself. You need the backend-specific Max2D module too, like GLMax2D, or a DirectX Max2D module. sdl.gl2sdlmax2d is a shader based version of the GLMax2D that is OpenGL ES compatible. However Max2D isn't an ideal platform to use on lesser systems. For example, things like DrawText are horrendously inefficient, which means you can only render a small amount of text before your frame rate tumbles. Mojo2's text stuff is much better, but obviously it's not Max2D, so YMMV as far as migrating any Max2D code goes. |
| ||
Thanks guys. So can I use GLMax2D on all platforms including Android? Yes, I assume Mojo2 commands are not similar to Max2D but I'm slowly making the transition. |
| ||
So can I use GLMax2D on all platforms including Android? No :-) Because BRL.GLMax2D is not compatible with OpenGL ES. For mobile/Pi platforms, you need to use sdl.gl2sdlmax2d. |
| ||
Ok got it Brucey. My problem is my module uses brl.max2d to work. Particularly TPIXMAPS.. trying to add sdl.gl2sdlmax2d either framework or import shows blank screen even on desktop How do I use sdl driver in modules? |
| ||
I thought Brucey already explained this: "brl.max2d" provides "DrawImage" and similar convenience helpers. It sits on top of the used graphics driver. Which you "enable" by importing "sdl.gl2sdlmax2d" (or others). After importing them, you are able to "SetGraphicsDriver whateveryouwanted". Each graphicsdriver has something like "myimagetype.draw()", then "max2d" calls "selecteddriver.imagetype.draw()". Think of it as some kind of "wrapper". So: max2D is there to enable to you to call "DrawImage" (and the likes) but it is not directly deciding which graphics renderer/engine is used. bye Ron |
| ||
So what do you think would be the replacement for brl.max2d if I need to use sdl? |
| ||
There is no need to replace it. As long as you do not try to use "mky.mod" (Mojo conversion) you should be able to use "sdl.gl2sdlmax2d" and "brl.max2d" as if you would use "brl.glmax2d" and "brl.max2d". bye Ron |
| ||
you should be able to use "sdl.gl2sdlmax2d" and "brl.max2d" Great. I'm currently playing with android build so I'm trying to figure this out. S Main app.. Framework brl.blitz Import sdl.gl2sdlmax2d Where import is formerely BRL.glMax2D Import brl.max2d I'm still getting a blank screen.. :/ |
| ||
This is my full import section when trying for androidSuperStrict Framework sdl.gl2sdlmax2d Import brl.blitz Import rusty.custommod Import brl.pngloader Import BRL.Max2D on rusty.custommod part I did not know if this would match well. I noticed sdl.gl2sdlmax2d works with Framework, I had Framework brl.blitz on the non sdl version, not sure if this affects the whole thing. |
| ||
This works.. (with brl.max2d on module)Framework brl.blitz Import sdl.glsdlmax2d Import brl.pngloader I'm confused why the sdl.gl2sdlmax2d driver which works on desktop on other examples does not work here.. Technically it runs but I'm getting a blank screen. Edit: Desktop now works with following setting.. module: Import BRL.GLMax2D (Pixmap functions) Main: Framework sdl.gl2sdlmax2D Import SDL.SDL Import brl.standardio Import rusty.custom Import brl.pngloader |