Graphics command used more than once?
BlitzMax Forums/BlitzMax Programming/Graphics command used more than once?
| ||
This code doesn't work although I suspect it should. Anyone want to venture a guess? It will draw the first image just fine, but when I press a key and it tries to reinitialize the graphics window, load the image again and display it - it just draws a white quad. Is the graphics command not designed to be issued more than once? Graphics 640,480,0 Local img:TImage = LoadImage( "images/email.png" ) DrawImage( img, 16, 16 ) Flip WaitKey Graphics 640,480,0 Local img2 = LoadImage( "images/email.png" ) DrawImage( img2, 64,64 ) Flip WaitKey |
| ||
An extension to this question, for me, is, is it possible to open multiple contexts at the same time and somehow switch between them? |
| ||
Am I the only one curious about this? |
| ||
Should work...possibly a Max bug. |
| ||
OK, fair enough. I'll wait for the next update then, I guess... Thanks! |
| ||
ends up in blank white quads for me ( the same behavior when you minimize the window ) |
| ||
I get the same issue but no idea why. It might have something to do with Blitzmax opening a new window for the second graphics command (which is very ugly)while B3D seems to use the same one. |
| ||
It probably won't make the slightest bit of difference, but has anyone tried the EndGraphics command before the second Graphics call? |
| ||
Yep... same problem. |
| ||
Yeah, I tried that as well. Nada. |
| ||
Ah well, t'was just a thought. |
| ||
Just a possibility - I had a problem with blank white quads showing and it was happening where I was trying to do direct OpenGL commands along with blitzMax 2d commands. Because Max2D keeps track of some internal variables, some states for example need to be tracked and with certain OpenGL calls it messes with Max's system. I got white rectangles come up and I needed to surround my OpenGL code with: GLDisable GLTexture2D 'then do the OpenGL code GLEnable GLTexture2D I'm not exactly sure why I needed to do it this way around, you might think you should be enabling it first. Anyway, it worked, and I only had this problem on my iMac, not on my iBook. So it was weird. So basically, try putting something like GLDisable GLTexture2D after your second "Graphics" command and see if it will display the texture instead of a white blank (or use the other command if that doesn't work). Maybe that'll work for you. |
| ||
Yeah, but my code sample above isn't doing any OpenGL calls... |
| ||
same "Error" here win32 |
| ||
to me it looks like the Max2D system loses the contact to the own media when you minimize or use graphics a second time ( even if endgraphics was in front of it ) on windows |
| ||
oh, try it anyway? |
| ||
Not sure whether I have done this correct but it seems to work adding... glEnable GL_TEXTURE_2D after the second graphics command. <edit> It seems a lower resolution (or maybe smoother) but the second image isn't so clear. Could it enable default gl values? |
| ||
AngelDaniel I'll try it again when the time comes. I just don't like working around things because once Mark fixes it, the hack will probably then start screwing things up and I'll have to debug the problem all over again. I prefer to keep things clean. |