letters appear as squares
BlitzMax Forums/BlitzMax Programming/letters appear as squares
| ||
Some people trying my game say that everything ( letters and images) appear as squares. This seems to be mostly on Vista machines I'm using the Max2D module (with opengl, not directX), does anybody know what's the problem? Should I switch to directx? |
| ||
I would guess it is a driver issue so switching to DX is a good idea or let the user decide. |
| ||
I would always default to DirectX and only allow OpenGL if the user chooses it. |
| ||
I noticed this happens especially when you use Pixmaps in stead of images. And strangly only in graphics mode. The Pixmaps used in MaxGUI handled themselves fine to me (except those which were in a Canvas). |
| ||
It could be that there isn't enough graphics memory available on the video card... Any idea how much they have? |
| ||
I suspect it's a GL-driver-on-Vista issue - try DirectX, or see if one of the people experiencing the problem can update their video drivers. |
| ||
I get this too on windowsXP with an intel integrated graphics card |
| ||
dbl post |
| ||
update the driver or forget OpenGL. The GMA 900 for example falls back into Microsoft OpenGL 1.1 emulation mode ... this is less than Max2D needs (OGL 1.2) |
| ||
ive played lots of commercial games which use opengl without any problems, the drivers are updated |
| ||
What is the simplest example which shows the problem? How many graphics are involved? What happens with DX? What happens if you use smaller graphics or less of them? What is the machine specs?What level of Bmax are you using? What OGL driver levels? |
| ||
I did some investigation and its because I was setting the blend mode to alpha blend. dont know why it behaves differently from GL to D3d |
| ||
Just got a laptop with Intel GMA965 graphics and Vista on it - OpenGL in Blitzmax simply doesn't work (white squares for everything), whereas all the other GL stuff I tried, does. There has to be a way to fix this? PS. My drivers are bang up-to-date - got them from the Intel website and they were only released 9 days ago, so they're about as new as you can get. |
| ||
What about pixmaps? |
| ||
Three screenshots taken on a Mobile Intel GMA X3100. I was planning just to tell you the results, but how the hell do you describe this?: DrawPixmap works if I use JPG format, but I need PNGs with alpha, and DrawPixmap is phenomenally slow. DrawImage with a JPG is solid white, as above. |
| ||
Can someone post a code sample? |
| ||
Here's more or less what I used to get the results above (flare1.png is a 24-bit PNG with alpha channel):SetGraphicsDriver GLMax2DDriver() Graphics 800,600 Global img:timage = LoadImage("flare1.png") Global px:TPixmap = LockImage(img) While Not KeyDown(KEY_ESCAPE) Cls DrawImage img,200,300 DrawPixmap px,400,300 Flip Wend |
| ||
Can you please post a link to flare1.png or email it to me. |
| ||
Check your e-mail (the one in your profile). Didn't want to post it here cos its an asset from my current game. |
| ||
Hi, I don't get your 'whiterect' effect with the GL driver, so I assume this is a driver thing. Use 'SetBlend ALPHABLEND' to perform proper alpha blending instead of the default MASKBLEND-ing. Adding this to your example works for me. DrawPixmap does not perform blending at all - it effectively works in SOLIDBLEND mode. |
| ||
Mark - sorry, should have said. I tried all the blendmodes before and I get the same results as above, whatever I do. What hardware are you testing on? |
| ||
What hardware are you testing on? Windows XP + GeForce8800. What does this do? Strict GLGraphics 640,480 glEnable GL_TEXTURE_2D glBindTexture GL_TEXTURE_2D,1 glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR Local pixmap:TPixmap=LoadPixmap( "flare1.png" ) glTexImage2D GL_TEXTURE_2D,0,GL_RGBA8,pixmap.width,pixmap.height,0,GL_RGBA,GL_UNSIGNED_BYTE,pixmap.pixels glEnable GL_BLEND glBlendFunc GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA While Not KeyHit( KEY_ESCAPE ) glClear GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT glBegin GL_QUADS glTexCoord2f 0,0 glVertex2f -1,-1 glTexCoord2f 1,0 glVertex2f 1,-1 glTexCoord2f 1,1 glVertex2f 1,1 glTexCoord2f 0,1 glVertex2f -1,1 glEnd Flip Wend |
| ||
I get the flare image, stretched out across the full window. Is that right? (That GL stuff frightens me). BTW: I'm testing on a Compaq Presario C757, Pentium Dual Core 1.46GHz, Intel GMA X3100 graphics, 2GB RAM, Vista Home Premium. From what I've read, the shared graphics memory on these things is allocated as needed up to something like 384MB. I'm not sure if this is anything to do with textures not appearing in Blitzmax under GLMax2DDriver. Probably worth mentioning anyway. |
| ||
How about this:Strict GLGraphics 640,480 Local pixmap:TPixmap=LoadPixmap( "flare1.png" ),flags=MASKEDIMAGE | FILTEREDIMAGE Local tex=CreateTex( pixmap.width,pixmap.height,flags ) glEnable GL_TEXTURE_2D glBindTexture GL_TEXTURE_2D,tex UploadTex pixmap,flags glEnable GL_BLEND glBlendFunc GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA While Not KeyHit( KEY_ESCAPE ) glClear GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT glBegin GL_QUADS glTexCoord2f 0,0 glVertex2f -1,-1 glTexCoord2f 1,0 glVertex2f 1,-1 glTexCoord2f 1,1 glVertex2f 1,1 glTexCoord2f 0,1 glVertex2f -1,1 glEnd Flip Wend End Function CreateTex( width,height,flags ) Local name glGenTextures 1,Varptr name glBindTexture GL_TEXTURE_2D,name 'set texture parameters glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE If flags & FILTEREDIMAGE glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR If flags & MIPMAPPEDIMAGE glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR Else glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR EndIf Else glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST If flags & MIPMAPPEDIMAGE glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST_MIPMAP_NEAREST Else glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST EndIf EndIf Local mip_level Repeat glTexImage2D GL_TEXTURE_2D,mip_level,GL_RGBA8,width,height,0,GL_RGBA,GL_UNSIGNED_BYTE,Null If Not (flags & MIPMAPPEDIMAGE) Exit If width=1 And height=1 Exit If width>1 width:/2 If height>1 height:/2 mip_level:+1 Forever Return name End Function Function UploadTex( pixmap:TPixmap,flags ) Local mip_level Repeat glPixelStorei GL_UNPACK_ROW_LENGTH,pixmap.pitch/BytesPerPixel[pixmap.format] glTexSubImage2D GL_TEXTURE_2D,mip_level,0,0,pixmap.width,pixmap.height,GL_RGBA,GL_UNSIGNED_BYTE,pixmap.pixels If Not (flags & MIPMAPPEDIMAGE) Exit If pixmap.width>1 And pixmap.height>1 pixmap=ResizePixmap( pixmap,pixmap.width/2,pixmap.height/2 ) Else If pixmap.width>1 pixmap=ResizePixmap( pixmap,pixmap.width/2,pixmap.height ) Else If pixmap.height>1 pixmap=ResizePixmap( pixmap,pixmap.width,pixmap.height/2 ) Else Exit EndIf mip_level:+1 Forever glPixelStorei GL_UNPACK_ROW_LENGTH,0 End Function |
| ||
Same as your first bit of code. Flare texture, stretched across the whole window. |
| ||
One more:Strict GLGraphics 640,480 Local pixmap:TPixmap=LoadPixmap( "flare1.png" ),flags=MASKEDIMAGE | FILTEREDIMAGE GLGraphicsDriver().SwapSharedContext Local tex=CreateTex( pixmap.width,pixmap.height,flags ) UploadTex pixmap,flags GLGraphicsDriver().SwapSharedContext glEnable GL_TEXTURE_2D glBindTexture GL_TEXTURE_2D,tex glEnable GL_BLEND glBlendFunc GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA While Not KeyHit( KEY_ESCAPE ) glClear GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT glBegin GL_QUADS glTexCoord2f 0,0 glVertex2f -1,-1 glTexCoord2f 1,0 glVertex2f 1,-1 glTexCoord2f 1,1 glVertex2f 1,1 glTexCoord2f 0,1 glVertex2f -1,1 glEnd Flip Wend End Function CreateTex( width,height,flags ) Local name glGenTextures 1,Varptr name glBindTexture GL_TEXTURE_2D,name 'set texture parameters glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE If flags & FILTEREDIMAGE glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR If flags & MIPMAPPEDIMAGE glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR Else glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR EndIf Else glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST If flags & MIPMAPPEDIMAGE glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST_MIPMAP_NEAREST Else glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST EndIf EndIf Local mip_level Repeat glTexImage2D GL_TEXTURE_2D,mip_level,GL_RGBA8,width,height,0,GL_RGBA,GL_UNSIGNED_BYTE,Null If Not (flags & MIPMAPPEDIMAGE) Exit If width=1 And height=1 Exit If width>1 width:/2 If height>1 height:/2 mip_level:+1 Forever Return name End Function Function UploadTex( pixmap:TPixmap,flags ) Local mip_level Repeat glPixelStorei GL_UNPACK_ROW_LENGTH,pixmap.pitch/BytesPerPixel[pixmap.format] glTexSubImage2D GL_TEXTURE_2D,mip_level,0,0,pixmap.width,pixmap.height,GL_RGBA,GL_UNSIGNED_BYTE,pixmap.pixels If Not (flags & MIPMAPPEDIMAGE) Exit If pixmap.width>1 And pixmap.height>1 pixmap=ResizePixmap( pixmap,pixmap.width/2,pixmap.height/2 ) Else If pixmap.width>1 pixmap=ResizePixmap( pixmap,pixmap.width/2,pixmap.height ) Else If pixmap.height>1 pixmap=ResizePixmap( pixmap,pixmap.width,pixmap.height/2 ) Else Exit EndIf mip_level:+1 Forever glPixelStorei GL_UNPACK_ROW_LENGTH,0 End Function (Make sure to test on GMA!) |
| ||
That last one results in a white screen. |
| ||
Aha! GMA doesn't like shared GL contexts... |
| ||
I have no idea what that means! :D Can you mend it? |
| ||
don't know how large the texture is but tested both of the codes with a 32x32 png image on XP with 8800GTS 640MB (169.28 drivers, most current from eVGA and newer than the WHQL certified on nvidia.com) and they both stretch the image over the whole screen. |
| ||
Can you mend it? Maybe. Any particular reason you're not using DX driver? |
| ||
I am, mainly. But a lot of people prefer to use OpenGL so I'd like to at least give them the option. There's a hell of a lot of these Intel GMA things about nowadays. It'd be great if it could be made to work. |
| ||
Any news on this being fixed yet? Its really annoying that I can't run any BlitzMax stuff that uses GL! |
| ||
Yeah, I'm waiting this to be fixed too... it's what been putting me off to purchase blitzmax and eventually using it on my next game =( |
| ||
Any particular reason you're not using DX driver? Personally I find the GL driver quite a bit faster than the DX version, so a fix with others incompatibilities would be very welcome indeed :) |
| ||
This can't be fixed that easy, its a gfx driver (hardware)) problem, not a problem with max2d. On Windows dx is the most comaptible one. Even if opengl maybe faster on your machine it doesn't mean it will be on others. thats the reason why we add dx support to minib3d extended. |
| ||
Its absolutely a problem with Max2D. Everything else I've ever tried that uses GL works without problems. It needs to be fixed, otherwise BRL might as well terminate GL support in Blitzmax if it can't be relied upon to work correctly under Windows. |
| ||
what is your hardware? If you say intel, then it is a driver issue. If you say ATI: get current drivers. 8.1 is known to solve a fair load of OpenGL bugs. And OGL is faster on any DX9 level hardware actually mainly because DX7 drivers never got really 3D optimized, while OpenGL ones did. |
| ||
The main reason to stick with OGL is portability. Even if you can specify the use of DX on Windows, If I need to write some custom function to do something not implemented that I need - I wouldnt want to have to write that twice to work both on OpenGL *and* Direct-X. If I wanted some 2D DX7 code, I still have my own 2D engine I did when DX7 was out (which didnt use any 3D at all and could run even on a Trident 1mb card hehehe), even made some games out of it (Revenge of the TimeLord and Frosted if anyone here ever saw them) My point is, the best feature of BMax is portability and the "write once, compile everywhere" idea. And if it's having trouble with Intel's GMA chipset (which is now everywhere on laptops), it is a big problem in my book. Have anyone tested to see if this also happens on Linux machines with those GMAs? This would clarify if it's a drivers problem or an incompatibility with the way BlitzMax handles OGL stuff. |
| ||
If you say intel, then it is a driver issue. Argh! ITS NOT A DRIVER ISSUE! Stop telling me its a driver problem when I know 100% it isn't! Everything else for GL works perfectly. Blitzmax GL stuff does not work. It is not the drivers! OK?! :/If you bothered to actually read threads instead of just bombarding the forums with a hundred replies a day and an opinion on everything, you'd already know its Intel GMA hardware (actually you would have known that when you pointlessly 'tested' an Intel GMA problem on Nvidia hardware last week in this very thread). This would clarify if it's a drivers problem or an incompatibility with the way BlitzMax handles OGL stuff. This is what Mark said it is, above (shared GL contexts). Can it be fixed? Mark says "maybe". |
| ||
Argh! ITS NOT A DRIVER ISSUE! Stop telling me its a driver problem when I know 100% it isn't! Our experiments above suggest that Intel's implementation of shared GL contexts is either borked or, at the least, flaky. The same shared context code works fine on a bunch of other OS/card combos. Not all GL apps use shared contexts (esp. games) so not all apps suffer from problems like this - which of course doesn't mean there isn't a problem. I have some ideas for hacks/fixes which I'll try out soon, but in the meantime I'm locking this as it's getting shouty. |