GLBasic forum

Main forum => GLBasic - en => Topic started by: makis on 2009-Feb-15

Title: Weird GLBasic problem
Post by: makis on 2009-Feb-15
Hi all
I've just downloaded GLBasic in order to compare it to BlitzMax. Many times i thought of learning programming however all my attempts failed miserably! when i try to run the "hello world" example thescreen goes blank and nothing happens! The programm returns to the GLBasic IDE!

Any help would be much appreciated!

System Specs
Win XP SP2 + all updates
6600 C2D
8800GTX 768Mb ram

P.S
Any links to good GLBasic tutorials besides the ones mentioned in the Tutorials subforum?
Title: Re: Weird GLBasic problem
Post by: Moru on 2009-Feb-15
Hello and welcome to the wonderful world of GLBasic :-)

There is some tutorials in the help if you press F1 and look thru the contents tab on the top left.

As for your problem with the hello world example, if you activate the debug mode you should get an error message. You activate debugging in the menu "Compiler" -> "Debug mode". Try that and see if it works. Also make sure you have the latest version by using the menu Web -> Internet update each day, there is very often a new version.
Title: Re: Weird GLBasic problem
Post by: makis on 2009-Feb-15
Thanks for the reply Moru, however the problem remains unsolved.
Due to the lack of tutorials i lean towards BlitzMax or Playbasic!
Title: Re: Weird GLBasic problem
Post by: amarliani on 2009-Feb-15
Ahm.. just a quick thought: How's your code? If it just looks like this:
Code (glbasic) Select
PRINT "Hello world!",10,10
SHOWSCREEN


this behaviour is just normal, because nothing behind the SHOWSCREEN says that the program should wait, so it goes to the next expression - which is an implicit END 'cause nothing else ist there. Try putting KEYWAIT after SHOWSCREEN. This orders the program to wait for you pressing any key to end the run.
Title: Re: Weird GLBasic problem
Post by: makis on 2009-Feb-15
Still the same. A window opens up (displaying the ''hello world'' text i suppose) and it disappear instantly.
Title: Re: Weird GLBasic problem
Post by: FutureCow on 2009-Feb-16
Please post your complete code.

You should find plenty of examples and a tutorial in the "help" (F1) to get you going.

Blitzmax will have a LOT steeper learning curve as it's based around OO programming.
Title: Re: Weird GLBasic problem
Post by: Hatonastick on 2009-Feb-16
Hmm if you want to learn to program, BlitzMax is not the one for you.  For a BASIC-like language it is fairly advanced and you need to put a lot of work into it to get something useful out of it.  Heck, you almost might as well go out and learn C++.  PlayBASIC is more games orientated than BlitzMax and a little easier to use (but not much).  I'm not a fan of the way Kevin chose to do the language syntax though.  That really isn't a beginner language either to be honest.  If you decide GLB isn't for you, you might want to consider GameMaker, but ignore the drag and drop parts and get into the scripting side.  Personally I own BlitzMax, Blitz3D, Blitz 3D SDK, DarkBASIC Pro (and most of its add-ons), PlayBASIC, PureBASIC, GameMaker and GLBasic, but GLBasic is the only one I use now.

Firstly you didn't respond to the suggestion as to whether or not you did an update.  You are using GLB version 6.164 right?

Do the other samples that came with it work ok for you?  Or do you get the same sort of issue?  Standard place the samples are 'saved' when you first start the IDE is My Documents\GLBasic\Samples\ (but I think you already found them).

You do have the latest drivers for your graphics card too right?  GLBasic uses OpenGL due to it being cross platform unlike DirectX.  I don't imagine that this is the problem though as you aren't running Windows Vista, which is where there were a lot of problems when it first came out due to card manufacturers leaving out OpenGL support for some cards.  That and you are using a NVidia chipset.  I've always had more issues with OpenGL under (some versions) of ATI cards.  Quite frankly the wide variety of cards, the on-the-cheap nature of development and construction of some of them (eg. an Nvidia chipset doesn't mean the card is made by Nvidia.  Same for ATI etc.), drivers and lack of any real guidelines for driver development has led to a massive headache for any developer of computer games on the Windows platform.  That's one of the reasons why they like consoles more -- standardized hardware.  It's been worse for MMO developers as the life of their software (if it survives) can last for years -- and as new cards are being manufactured all the time... Well...  You can imagine.  Anyway if none of the samples work for you, or you get odd behavior for all, then the graphics card drivers would be my main suspect.

This might sound daft, but in the Project menu, click on Options: WIN32 is selected in the Platform Configuration right?

This should give you a window with 'Hello World' in it, then close when you click the mouse button.  It isn't really that much different to what has already been suggested but I thought it was worth a shot.

Code (glbasic) Select

PRINT "Hello world!", 10, 10
SHOWSCREEN
MOUSEWAIT


Lastly, as FutureCow suggested, if you ever have a problem with something not running it's best to post the code being used.  Although it does sound in this case as if you are just running the sample and not altering it.

Edit: Edited multiple times due to just getting up, and not having had coffee yet.  Argh!
Title: Re: Weird GLBasic problem
Post by: makis on 2009-Feb-16
Here is my code:
PRINT "helo world" ,100,200
SHOWSCREEN
KEYWAIT
END

I've allready created a game with Gamemaker using the drag and drop icons. It's a remake of Pharoh's Tomb an old DOS platform game.
Even though it is much easier and quicker for me to create a game with GM using D&D, when it comes down to coding using the Gamemaker Language (GML) i get confused. All these step events, timers etc are quite complicated!
Title: Re: Weird GLBasic problem
Post by: MrTAToad on 2009-Feb-16
I would set a default screen resolution, and thus the code becomes :

Code (glbasic) Select
SETSCREEN 640,480,1
PRINT "hello world" ,100,200
SHOWSCREEN
KEYWAIT
END


Press F8 to compile, after which press F5 to run it.
Title: Re: Weird GLBasic problem
Post by: Hatonastick on 2009-Feb-16
Yeah that side of GameMaker is quite hard.  I'm hoping you'll give GLB a go.  It's pretty easy to get results with it.  We just need to work out what the problem here is.

Oh, BTW the other main reason why I like GLB over the other languages: This forum is by far the best of any of those languages I just mentioned.  That and Gernot supports his product and listens to the people who use it.  That's pretty rare.

Hmm ok that example code works fine for me.  I get a small window with the text in the bottom right quadrant.

Edit: My brain wasn't functioning.  I would up the resolution to 1024, 768 for full screen though as minimum, as some of the newer cards don't support the 'traditional' low end rez modes.  Course that issue wouldn't affect a window on a screen, hence why I removed what I typed earlier.  My brain really isn't awake yet...
Title: Re: Weird GLBasic problem
Post by: FutureCow on 2009-Feb-16
As per the earlier two postings, maybe either you're having a resolution problem, or if your output is in a window then your window may not be on the screen.

Let us know if the suggestions by MrTAToad or Hatonastick work.
Title: Re: Weird GLBasic problem
Post by: Hatonastick on 2009-Feb-16
I'd be listening to MrTAToad.  The Hat is non compus mentis this morning due to lack of sleep and coffee, and it shows.  :S
Title: Re: Weird GLBasic problem
Post by: MrTAToad on 2009-Feb-16
It is so nice to get very regular updates - its something you wont get with BlitzMax - or DBPro for that matter.  Plus the updates actually fix problems first time too! All hail Gernot!

Anyhoo, my code does work - if you just get a blank screen (and there is no reason why it should happen), use :

Code (glbasic) Select

SETSCREEN 640,480,0


to replace with my original one.

QuoteI would up the resolution to 1024, 768 for full screen though as minimum, as some of the newer cards don't support the 'traditional' low end rez modes
I haven't see a card yet that can't handle 640x480 :)

Title: Re: Weird GLBasic problem
Post by: FutureCow on 2009-Feb-16
If all else fails, make sure your OpenGL drivers are up to date.
Title: Re: Weird GLBasic problem
Post by: makis on 2009-Feb-16
still no luck guys. I suspect it's a driver issue.
How do i update the opengl drivers? sorry to be a a pain but it started getting on my nerves :S
Title: Re: Weird GLBasic problem
Post by: Hatonastick on 2009-Feb-16
Edit: Never mind.
Title: Re: Weird GLBasic problem
Post by: makis on 2009-Feb-16
Downloaded the newest Nvidia and OpenGL 3 drivers and also I've installed GLBasic on another PC with no luck!
Heeelp pleeease:(
Title: Re: Weird GLBasic problem
Post by: MrTAToad on 2009-Feb-16
The last thing to try is :

Find smalfont.png from one of the examples (there are plenty, and it doesn't matter which one is used), and copy it into the same place as the executable.  Then compile & run the program.

Are you still getting a black screen ?

In addition, can you try the Hello World program from : http://www.nicholaskingsley.co.uk/MiscThings/HelloWorld.zip (http://www.nicholaskingsley.co.uk/MiscThings/HelloWorld.zip)
Title: Re: Weird GLBasic problem
Post by: Kitty Hello on 2009-Feb-16
You're opening the gbap, not gbas file, right? gbap = project, gbas = source code.

Try DRAWRECT 0,0,320,320, RGB(255,0,0)
Does that do a red square?
Title: Re: Weird GLBasic problem
Post by: makis on 2009-Feb-16
Ok i give up. I'll tried everything you said guys (copying the png file to the glbasic folder, typing the rectangle command) but no luck. A small screen is being displayed for a split second and then back to the IDE.
Title: Re: Weird GLBasic problem
Post by: Moru on 2009-Feb-16
You tried activating the debug mode? If you enter the command DEBUG "test" between each line you can see where the program hangs, like this:

Code (glbasic) Select

DEBUG "line 1\n"
PRINT "Hello world", 50, 50
DEBUG "line 2\n"
KEYWAIT
DEBUG "line 3\n"
END


The "line 1" and so on should show up in the gray part of the window on the bottom. (the \n in the strings is to get a line-break for each line printed)
Title: Re: Weird GLBasic problem
Post by: makis on 2009-Feb-16
i've activated the debug mode and nothing happens. When i run the example the text "Loading" comes up in the middle of the screen and disappears instanly.
Title: Re: Weird GLBasic problem
Post by: Kosta on 2009-Feb-16
Have you tried the example of Moru?


Code (glbasic) Select
DEBUG "line 1\n"
PRINT "Hello world", 50, 50
DEBUG "line 2\n"
KEYWAIT
DEBUG "line 3\n"
END


(activate Debug-Mode), execute it, and then -> take a look in your IDE (the Output Area (bottom)).... if all Debug-Lines are printed.
Title: Re: Weird GLBasic problem
Post by: makis on 2009-Feb-16
I get the following error mesage using moru's code:
Start debug session.
C:\DOCUME~1\TestPC\LOCALS~1\Temp\glbasic\gpc_tempg.cpp:4: error: `DGStr' does not name a type
C:\DOCUME~1\TestPC\LOCALS~1\Temp\glbasic\gpc_tempg.cpp:8: error: `NULL' was not declared in this scope
success

Title: Re: Weird GLBasic problem
Post by: mr_x on 2009-Feb-16
How did you create your project and source files? I mean try this: File->Project->New->Create new project, and then type simple programm and compile. Maybe this will help.
Title: Re: Weird GLBasic problem
Post by: Hatonastick on 2009-Feb-16
One possible idea is that something has gotten messed up somehow when you installed GLB (assuming that you do indeed have the latest version installed).  Uninstall it, make sure the directory for it in your program files directory has been deleted ie. c:\Program Files\GLBasic.  Also make sure that after you've uninstalled that the samples directory is gone from your My Documents directory too.  Download from the GLBasic website again and reinstall.  When you installed on your other PC, was it the same copy you'd already downloaded and installed or was it a fresh download and install?

Quick question: If you run any of the example games etc. in the Showroom on the official website, do they work?
eg. http://www.glbasic.com/data/games/UfoOnTheRun.rar (http://www.glbasic.com/data/games/UfoOnTheRun.rar)
If you can't unpack RAR files, there are other programs in the showroom you can try.  Anyway, if so I think we can probably rule out the hardware side of things that we were looking at earlier.

Sorry if any of us are running over old ground.  We just want you to be able to compile too!

I'm now downloading the official GLB SDK from the website on another PC which has never had GLB installed on it.  Going to see if I can replicate the given errors.

Edit: Unsurprisingly the download from the official site onto another PC worked fine and I couldn't replicate the given errors.  Did have a few minor issues, but again unsurprisingly they went away when I applied the latest update.

Mr TAToad might be right.
Title: Re: Weird GLBasic problem
Post by: MrTAToad on 2009-Feb-16
It sounds like there is a serious problem with your machine as the program is exiting even if the MOUSEWAIT/KEYWAIT is present - even more so if the same thing happens when running the executable through Explorer.

Make sure DirectX is installed.

The next thing would be to create a new profile and try running the executable with that.

What version of Windows are you using ?
Title: Re: Weird GLBasic problem
Post by: mr_x on 2009-Feb-16
Actually, if I download some glbasic programm, and try to compile it from it's project file, I've got the same result, something apears on the screen for a while, and disappear. But all the samples, that comes with GLBasic works fine on my machine. I have solved this problem, like I wrote above. I create new project, copy the code from downloaded example, and run it. It works for me.
Title: Re: Weird GLBasic problem
Post by: makis on 2009-Feb-16
I'm running Widows XP with Sercive Pack 2. The compiled downloaded game run fine. I've unistalled everything , deleted the glbasic folders, removed the registry entries but no luck. Even when i copy and paste the code in a new project nothing changes.

I've installed GLBasic on my Acer Aspire One laptop runninh XP with SP2 and the same story goes on.. What is going on here grrr:(
Title: Re: Weird GLBasic problem
Post by: MrTAToad on 2009-Feb-16
So the executable runs fine if not run from GLBasic ?

The only thing left is to make sure you are using the latest version of GLBasic, and run the executable through the command line to look and see if there are any errors.

You need to compile in debug mode, move to the correct place for the executable, and then use something like : HelloWorld > log.txt

You should just get something like :

Code (glbasic) Select
FBO
Viewport
GFX seem OK
FBO
Viewport
GFX seem OK


What graphics cards do these two machines have ?
Title: Re: Weird GLBasic problem
Post by: makis on 2009-Feb-16
I'm running the latest version of GLBasic.

Desktop PC No1
Intel Core 2 Duo 6600
Nvidia 8800GTX 768MB ram

Desktop PC No2
Intel Pentium 4 3.0Ghz
Nvidia 7100GS

Laptop
Intel Atom 1.6Ghz
Intel 945 Express integrated.

I don't think it's a hardware issue. Maybe something is wrong with the C++ redistributable ?
I've also downloaded and installed net framework 2. I'm thinking of installing Service Pack 3.
Title: Re: Weird GLBasic problem
Post by: MrTAToad on 2009-Feb-16
It wont be the redistributable - that is only a problem if your running the 64-bit version of Vista.

The other possibility is to turn off threading support for the nVidia machines.

Certainly worth installing Service Pack 3
Title: Re: Weird GLBasic problem
Post by: makis on 2009-Feb-16
how do i turn off threading support ?? In Nvidia's control panel there is no option for messing up with opengl. Blitzmax, purebasic, darkbasic pro, gamemaker run fine on my PC. Why GLBasic is so stubborn?
Title: Re: Weird GLBasic problem
Post by: MrTAToad on 2009-Feb-16
nVidia Control Panel -> 3D Settings -> Threaded Optimisation.

As for why your set of computers wont run GLBasic properly - I've no idea.  Everything is fine here (mixture of nVidia and ATI machines), not that its much help for you - its certainly something specific to you.

My XP OpenGL (OpenGL32.DLL) version is 5.1.2600.5512
You also need to make sure that DirectInput and DirectSound is working fine.

Title: Re: Weird GLBasic problem
Post by: Kitty Hello on 2009-Feb-17
The threaded optimization bug (it was for Cel Shading only?) should have been fixed, already.

Is the program crashing, then you should get a notification message. If you don't get a message, the program seems to end nicely.
Post the errorlog.txt here.

Also, try this:

Code (glbasic) Select

WHILE TRUE
   DRAWRECT 0,0,320,320,RGB(255,0,0)
   SHOWSCREEN
WEND


If this is not working as well, there's something really, really bad.
Then it would be good to see a demo video of exaclty what you do. Maybe if helps finding the quirk then. It's very strange, since it's on 3 PCs I assume it's a user error, means you do something as it's not meant to be done. Would be good to see what, so I can yield an info message next time.
Title: Re: Weird GLBasic problem
Post by: makis on 2009-Feb-17
I've managed to run some examples on my laptop. The same examples though don't run on my desktop PC.   

Kitty Hello here is the link with the video you asked for.
http://www.mediafire.com/?yer2dcotzdn

Thanks
Title: Re: Weird GLBasic problem
Post by: MrTAToad on 2009-Feb-17
Is that in debug or release mode ? 
Title: Re: Weird GLBasic problem
Post by: makis on 2009-Feb-17
in release mode..
Title: Re: Weird GLBasic problem
Post by: Kitty Hello on 2009-Feb-18
OK, the program loads up, and displays "Loading...". Thus, your OpenGL driver is OK.
But it immediately quits. What path name do you use for the project? Does it contain greek characters? Can you try copying it to C:\Temp and tra again?

Please post the Errorlog.txt. You can get with by typing into a console window:
Code (glbasic) Select

Notepad.exe "%TEMP%\ErrorLog.txt"

Title: Re: Weird GLBasic problem
Post by: makis on 2009-Feb-18
Problem solved!! Gracias Kitty Hello =D. The path name i used to store the projects conatined greek characters! Sorry for waisting your time. This is a trully helpfull forum. One more thing , are there any plans for new tutorials?
I'm thinking of creating from scratch Pharaoh's Tomb again using GLBasic, however i can't find any tutorials for platform games..
Title: Re: Weird GLBasic problem
Post by: FutureCow on 2009-Feb-18
How about adding that to a FAQ?
Title: Re: Weird GLBasic problem
Post by: Hatonastick on 2009-Feb-18
Yay!  Great to hear!  If it is the Pharoah's Tomb I'm thinking of, wouldn't mind playing another version of that. :)
Title: Re: Weird GLBasic problem
Post by: makis on 2009-Feb-18
Is it against the forum rules to post a link for Pharaoh's Tomb? I don't want to get banned so soon =D
Title: Re: Weird GLBasic problem
Post by: MrTAToad on 2009-Feb-18
The only tutorials I know of for platform games are by JNR (http://jnrdev.72dpiarmy.com/en/jnrdev1/ (http://jnrdev.72dpiarmy.com/en/jnrdev1/)).  Its all in C, but should be easy enough to convert.

As for the Greek characters - it might be worth starting the conversion to unicode :)
Title: Re: Weird GLBasic problem
Post by: Kitty Hello on 2009-Feb-18
Can you please upload a zip file with a folder that has this greek character in the file name?
Title: Re: Weird GLBasic problem
Post by: makis on 2009-Feb-18
The whole folder is in greek!
Title: Re: Weird GLBasic problem
Post by: Kitty Hello on 2009-Feb-19
Can you zip it, so the full path name is in the zip?
I need a way of reproducing it.
Title: Re: Weird GLBasic problem
Post by: Hatonastick on 2009-Feb-19
I don't know, it's all Greek(*) to me!

(*) You guys are lucky, I can barely speak English sometimes let alone another language.  Totally envious of anyone who grows up in a non-English speaking household.
Title: Re: Weird GLBasic problem
Post by: makis on 2009-Feb-19
how can i do that mate? You can create a folder with greek characters, something like ΜΑΚΗΣ and compile your code from there. Does it make any sense ?
Title: Re: Weird GLBasic problem
Post by: Kitty Hello on 2009-Feb-19
ΜΑΚΗΣ did the trick. Thank you.
Title: Re: Weird GLBasic problem
Post by: makis on 2009-Feb-20
You welcome. As from yesterday i'm a registered owner of GLBasic! Now all i need is a healthy dose of dedication and concentration =D. My attention span levels are very very low!