Irritating error message

Posted By: Uhrwerk

Irritating error message - 02/03/13 19:49

Hello Mr. Lotter,

please have look at the following code snippet:
Code:
#include <acknex.h>

void main()
{
//	level_load(NULL);
	MATERIAL* m = mtl_create();
	effect_load(m,"whatever.fx");
}


This will result in
Originally Posted By: Malfunction W1507
Video functions not available before first frame

If you however uncomment the level_load instruction the snippet will work as expected though it is still executed before the first frame.
Posted By: Superku

Re: Irritating error message - 02/03/13 20:00

I'm not a 100% sure but level_load does not necessarily take only one frame (the rest of the game/ schedular gets halted, of course), check the on_level event for example.
Posted By: Uhrwerk

Re: Irritating error message - 02/03/13 20:50

AFAIK level_load does not take any frame at all to complete. You can also check the following snippet:
Code:
#include <acknex.h>

void main()
{
//	level_load(NULL);
	MATERIAL* m = mtl_create();
	effect_load(m,"whatever.fx");
	printf("total_frames = %d",(int)total_frames);
}


The total_frames variable is 0, regardless of the level_load ...
Posted By: Superku

Re: Irritating error message - 02/03/13 21:11

Just tested it, some levels in my game take up to 30 frames to load.
Maybe level_load initializes the video device if it hasn't been done already to enable rendering (rather unlikely), but this is only guessing.
Posted By: jcl

Re: Irritating error message - 02/04/13 10:18

Level load does not take any frame, it is executed immediately. That's also the reason why it prevents the error message: It initializes the video device if it isn't already.
Posted By: Rackscha

Re: Irritating error message - 02/04/13 11:43

@JCL: so why not initializing the videodevice before entering first frame?(or does this collide with presetting vars, for screensize etc)
Posted By: jcl

Re: Irritating error message - 02/04/13 11:48

Yes. You need to make up your mind about some settings before opening the video device. For instance, if you need the video device at all or not.
Posted By: Uhrwerk

Re: Irritating error message - 02/04/13 14:28

I'd then suggest changing the error message to "Video device not yet initialized". The current message implies that it is not possible at all to use effect_load before the first frame which is obviously not true.
© 2024 lite-C Forums