bbWindowed3D

Archives Forums/Blitz3D SDK Programming/bbWindowed3D

Moraldi(Posted 2007) [#1]
Please take a look at the following piece of code (Dev-C++):

void Init3D(HWND hwnd)
{
    if (!hwnd)
      return false;
    if (!bbWindowed3D())
      return false;
    bbSetBlitz3DHWND((int)hwnd);
    bbBeginBlitz3D();
    bbGraphics3D(GetSystemMetrics(SM_CXFULLSCREEN), GetSystemMetrics(SM_CYFULLSCREEN), 0, GFX_WINDOWEDSCALED);
}



My program crashes if I make a function call to bbWindowed3D
If I remove it everything works fine.

NOTE: The Init3D call takes place after the Window creation


Jazz(Posted 2007) [#2]
[Edit]: Never mind, I get what you are saying now. Forget I spoke. :)


skidracer(Posted 2007) [#3]
NOTE: The Init3D call takes place after the Window creation


By that I assume/hope you mean after you have processed the WM_CREATE message.

Also mode GFX_WINDOWED I think is the only legal parameter for working with owner hwnd, use the viewport command to set the output to the correct scale.


Moraldi(Posted 2007) [#4]
I don't process this message.
I use mode GFX_WINDOWEDSCALED but a few lines later in my code. Where is the problem?
I just want (according to the Blitz3D documentation) to see if the hardware can support 3D graphics in a window. Why I should then use only the GFX_WINDOWED mode?


MCP(Posted 2007) [#5]
It looks like an error in the SDK initialisation logic skid??? a call to bbWindowed3D() will fail because the SDK has not been initialised yet with bbBeginBlitz3D() which in the example above must be preceded by a call to the function bbSetBlitz3DHWND() if you wish to create your own window, hence the need to check if this is supported via the bbWindowed3D() call.
Could the problem be solved by declaring bbSetBlitz3DHWND() to return type BOOL (TRUE-success/supported, FALSE-windowed mode not supported)?

Cheers,

Roy


Barnabius(Posted 2007) [#6]
Roy is right but instead of waiting for BRL to change the initialization logic, which may never happen, why just not use the easiest solution:
void Init3D(HWND hwnd)
{
    if (!hwnd)
      return false;
    bbSetBlitz3DHWND((int)hwnd);
    bbBeginBlitz3D();
    if (!bbWindowed3D())
      bbEndBlitz3D();
      return false;
    bbGraphics3D(GetSystemMetrics(SM_CXFULLSCREEN), GetSystemMetrics(SM_CYFULLSCREEN), 0, GFX_WINDOWEDSCALED);
}

Barney


Moraldi(Posted 2007) [#7]
Roy & Barnabius:
I tested your suggestions. Works without problem now.
Thanks to all of you (and skidracer also) for your time.
I think BRL must handle this in a future version