What module(s) do I need to create PixMaps?

BlitzMax Forums/BlitzMax Beginners Area/What module(s) do I need to create PixMaps?

Gabriel(Posted 2005) [#1]
Is there somewhere where dependencies are listed? I've spent hours searching for why certain commands aren't working ( and not erroring either, just dying randomly ) and it seems that it's all about Framework and Import ( well it has been so far. )

Now CreatePixMap() is returning a null instance. What module do I need to stop it doing that?

So far I have

brl.linkedlist,brl.standardio,brl.keycodes,brl.system,brl.jpgloader and brl.blitzgl so it's none of those. I tried brl.pixmap ( it seemed like the obvious choice ) but that made no difference.

And if there isn't some kind of reference point for all these, there really should be.


Augen(Posted 2005) [#2]
There is a program someone wrote that will check for you and tell you which modules need to be included. Let me see if I can find that post.

Edit: jb did this, its free, and it works great! http://www.blitzmax.com/Community/posts.php?topic=47141


Gabriel(Posted 2005) [#3]
Thanks, I should have mentioned, but I already tried that. It misses a couple of modules that I know I need and doesn't find any ones that I don't already have. So it doesn't fix the problem.

EDIT: On closer examination, it's not modules this time ( though it's exactly the same as a previous problem which was a modules issue. )

Why else would a call to CreatePixMap() fail? It's returning a null instance, but I can't see any reason for it.


N(Posted 2005) [#4]
To create Pixmaps? Brl.Pixmap.

To load various formats, you should import Brl.*Loader (e.g., TGALoader, PNGLoader, BMPLoader).


Gabriel(Posted 2005) [#5]
Yup, got all of them. It's something else, but I have no clue what.

EDIT: Weirdly, LoadPixMap() seems to work just fine.


klepto2(Posted 2005) [#6]
Try to load something like this:

Framework brl.glmax2d '<---- This is a must when needed
Import brl.pixmap ' Sometimes seems not to load
Import brl.standardIO ' properly when it doesn't stay in
.. top.
..
..


tonyg(Posted 2005) [#7]
Sybixsus, Can you show any sample code?


Gabriel(Posted 2005) [#8]
Try to load something like this:

Framework brl.glmax2d '<---- This is a must when needed
Import brl.pixmap ' Sometimes seems not to load
Import brl.standardIO ' properly when it doesn't stay in
.. top.



I'm already importing standardIO and pixmap. I tried glmax2d as well, but I'm not actually using any 2d stuff. It's all raw opengl.

Sybixsus, Can you show any sample code?


There's actually quite a lot of code and I don't think any of it is revelant. Unless you have to call an official blitz command before creating a pixmap ( which would be odd, since you don't before loading one ) it's literally just dropping on the createpixmap command.

I'll see if I can cut it down to a more manageable chunk of code to post that still doesn't work. Maybe it's the pixel format that's wrong? I just copied that from somewhere.

TextureImage.Create(W,H,PF_RGBA8888)


W and H are both powers of 2.


klepto2(Posted 2005) [#9]
I know that you already got imported the others.

But I had have a similar problem everytime I try to use opengl
stuff without making a Framework that uses brl.glmax2d .
Don't know why, but by using it I have no problems anymore.


Gabriel(Posted 2005) [#10]
Yeah, it was definitely worth a shot, but it doesn't do it, even with it as the framework. Something is weird here, particularly since loading a pixmap actually does work ( or seems to, it doesn't return a null instance anyway. )


Gabriel(Posted 2005) [#11]
I'm obviously missing something, and it's probably something stupid and obvious. I have no idea what else I should be doing before I'm able to create a pixmap. I tried setting a 2d video mode with graphics 640,480..etc, but that makes no odds.

I've commented out all the framework/import stuff to verify that it isn't the problem.

' PIXMAP NO WORKY DEALY

'Framework brl.BlitzGL   ' CHANGE TO IMPORT
'Import brl.linkedlist   ' REMOVE ALL OTHER IMPORTS
'Import brl.standardio   ' REMOVE ALL OTHER IMPORTS
'Import brl.keycodes     ' REMOVE ALL OTHER IMPORTS
'Import brl.system       ' REMOVE ALL OTHER IMPORTS
'Import brl.jpgloader    ' REMOVE ALL OTHER IMPORTS



Global PM:TPixmap


PM.Create(128,128,PF_RGBA8888)
If PM=Null RuntimeError "PIX MAP NO LOADY"


I've tried all four documented pixel formats but it makes no difference.


Yan(Posted 2005) [#12]
You're trying to call a function from an object that doesn't yet exist.

You can use..
Global PM:TPixmap = TPixmap.Create(128, 128, PF_RGBA8888)
If PM=Null RuntimeError "PIX MAP NO LOADY"
or
Global PM:TPixmap = CreatePixmap(128, 128, PF_RGBA8888)
If PM=Null RuntimeError "PIX MAP NO LOADY"



Gabriel(Posted 2005) [#13]
Doh, you're right. I grabbed a chunk of code posted on here and it never occurred to me that someone would post code that wasn't even tested. The stupid thing is, my code is full of OO stuff and I've not got a single error in my own stuff. Just got a mental blank on the section that I'd nicked.

Thanks.