Dark Bit Factory & Gravity
PROGRAMMING => Freebasic => Topic started by: Shockwave on June 27, 2009
-
As soon as I try to include GLU with this nice framework it will not compile any more, it finds the following error..
C:\FreeBasic\inc\gl/glu.bi(192) : error 6: Expected '(', found: 'max'
declare function gluBuild1DMipmapLevels alias "gluBuild1DMipmapLevels" (byval target as GLenum, byval internalFormat as GLint, byval width as GLsizei, byval format as GLenum, byval type as GLenum, byval level as GLint, byval base as GLint, byval max as GLint, byval data as any ptr) as GLint
The framework..
'---------------------------------------------------------------------------------
'
' FreeBasic OpenGL Window Framework by rbraz
'
' 12 Apr 2008
'
'---------------------------------------------------------------------------------
#include once "windows.bi"
#include once "gl/gl.bi"
#include once "gl/glu.bi"
#include once "gl/glext.bi"
#include once "crt.bi"
'DEVMODE bug, found the cure here --> http://www.freebasic.net/forum/viewtopic.php?t=5659&highlight=devmode
'Will be corrected by Victor in the next freebasic update
#undef DEVMODE
Type DEVMODE
dmDeviceName As Zstring * CCHDEVICENAME
dmSpecVersion As WORD
dmDriverVersion As WORD
dmSize As WORD
dmDriverExtra As WORD
dmFields As DWORD
dmOrientation As Short
dmPaperSize As Short
dmPaperLength As Short
dmPaperWidth As Short
dmScale As Short
dmCopies As Short
dmDefaultSource As Short
dmPrintQuality As Short
dmColor As Short
dmDuplex As Short
dmYResolution As Short
dmTTOption As Short
dmCollate As Short
dmFormName As Zstring * CCHFORMNAME
dmLogPixels As WORD
dmBitsPerPel As DWORD
dmPelsWidth As DWORD
dmPelsHeight As DWORD
dmDisplayFlags As DWORD
dmDisplayFrequency As DWORD
dmICMMethod As DWORD
dmICMIntent As DWORD
dmMediaType As DWORD
dmDitherType As DWORD
dmReserved1 As DWORD
dmReserved2 As DWORD
dmPanningWidth As DWORD
dmPanningHeight As DWORD
End Type
'Win Main
Declare Function WinMain ( byval hInstance as HINSTANCE, _
byval hPrevInstance as HINSTANCE, _
szCmdLine as string, _
byval iCmdShow as integer ) as integer
'
' Entry point
'
end WinMain( GetModuleHandle( null ), null, Command$, SW_NORMAL )
'app window procedure
Declare Function WndProc( byval hWnd as HWND, _
byval message as UINT, _
byval wParam as WPARAM, _
byval lParam as LPARAM ) as LRESULT
'window creation helper
Declare Function MakeWindow(byval hInstance as HINSTANCE) as integer
Declare Sub ChangeScreenResolution (byval wwidth as integer, byval hheight as integer, byval bitsPerPixel as integer)
'OpenGl Draw sub
Declare Sub glDraw()
'Application name
Const szAppName = "The Leading Force"
'app window handle
Dim Shared hWndWin as HWND
'app hdc
Dim Shared hdcWin as HDC
'window mode
Dim Shared winmode as integer
'Window resolution
const XRES = 800
const YRES = 600
' ----------------------------------
' name: WndProc
' desc: Processes windows messages
'
' ----------------------------------
function WndProc ( byval hWnd as HWND, _
byval message as UINT, _
byval wParam as WPARAM, _
byval lParam as LPARAM ) as LRESULT
'
' Process messages
'
select case( message )
'
' Key pressed
'
case WM_KEYDOWN
if( lobyte( wParam ) = 27 ) then
PostMessage( hWnd, WM_CLOSE, 0, 0 )
end if
'
' Window was closed
'
case WM_DESTROY
PostQuitMessage( 0 )
exit function
end select
'
' Message doesn't concern us, send it to the default handler
' and get result
'
function = DefWindowProc( hWnd, message, wParam, lParam )
end function
' ---------------------------------------
' name: WinMain
' desc: A win2 gui program entry point
'
' ---------------------------------------
function WinMain ( byval hInstance as HINSTANCE, _
byval hPrevInstance as HINSTANCE, _
szCmdLine as string, _
byval iCmdShow as integer ) as integer
dim wMsg as MSG
' get module instance
hInstance = GetModuleHandle(NULL)
'Create our skinned window
if MakeWindow(hInstance) = 0 then
MessageBox(NULL, "Failed to create window", szAppName, MB_ICONERROR )
return -1
end if
ShowWindow( hWndWin, iCmdShow )
UpdateWindow( hWndWin )
'Get window device context
hdcWin = GetDC(hWndWin)
'Initialize OGL window
dim pfd as PIXELFORMATDESCRIPTOR
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR)
pfd.nVersion = 1
pfd.dwFlags = PFD_DRAW_TO_WINDOW or PFD_SUPPORT_OPENGL or PFD_DOUBLEBUFFER
pfd.dwLayerMask = PFD_MAIN_PLANE
pfd.iPixelType = PFD_TYPE_RGBA
pfd.cColorBits = 32
pfd.cDepthBits = 32
SetPixelFormat ( hdcWin, ChoosePixelFormat ( hdcWin, @pfd) , @pfd )
wglMakeCurrent ( hdcWin, wglCreateContext(hdcWin) )
'
' Process windows messages
'
while(wMsg.message <> WM_QUIT)
if (PeekMessage (@wMsg,NULL,0,0,PM_REMOVE) <> 0) then
DispatchMessage(@wMsg)
else
glDraw()
SwapBuffers (hdcWin)
end if
wend
if winmode = 0 then
ChangeDisplaySettings(NULL,0)
ShowCursor (true)
end if
' Ends a process and all its threads.
ExitProcess(0)
end function
'Change The Screen Resolution
sub ChangeScreenResolution (byval wwidth as integer, byval hheight as integer, byval bitsPerPixel as integer)
dim dmScreenSettings as DEVMODE
ZeroMemory(@dmScreenSettings, sizeof (DEVMODE))
dmScreenSettings.dmSize = sizeof(DEVMODE)
dmScreenSettings.dmPelsWidth = wwidth
dmScreenSettings.dmPelsHeight = hheight
dmScreenSettings.dmBitsPerPel = bitsPerPixel
dmScreenSettings.dmFields = DM_BITSPERPEL or DM_PELSWIDTH or DM_PELSHEIGHT
if (ChangeDisplaySettings (cast(LPDEVMODE,@dmScreenSettings), CDS_FULLSCREEN) <> DISP_CHANGE_SUCCESSFUL) then
MessageBox(NULL,"Change Display Error!", szAppName,MB_OK or MB_ICONEXCLAMATION)
end -1
end if
end sub
' ------------------------------------------------------------------------
' Window creation function.
' ------------------------------------------------------------------------
Function MakeWindow(byval hInstance as HINSTANCE) as integer
function = 0
' our window class
dim wndWc as WNDCLASS
dim windowStyle as DWORD
dim windowExtendedStyle as DWORD
dim rc as RECT
' ---------------------------------------------------------
' fill window class members
' ---------------------------------------------------------
wndWc.style = CS_OWNDC
wndWc.lpfnWndProc = @WndProc
wndWc.cbClsExtra = 0
wndWc.cbWndExtra = 0
wndWc.hInstance = GetModuleHandle(NULL)
wndWc.hIcon = NULL
wndWc.hCursor = LoadCursor(0, IDC_ARROW)
wndWc.hIcon = LoadIcon(hInstance, IDI_APPLICATION) ' Load our normal icon
wndWc.hbrBackground = GetStockObject(BLACK_BRUSH)
wndWc.lpszMenuName = NULL
wndWc.lpszClassName = strptr( szAppName )
' register class
if( RegisterClass( @wndWc ) = FALSE ) then
MessageBox(NULL, "Failed to register Window Class!", szAppName, MB_ICONERROR )
exit function
end if
rc.left = 0
rc.top = 0
rc.right = XRES
rc.bottom = YRES
'Setup video mode window - Windowed / Fullscreen
if( MessageBox(NULL,"Full Screen ?", "Skid Row",MB_YESNO or MB_ICONQUESTION) = IDYES ) then
winmode = 0
else
winmode = 1
end if
if (winmode = 0) then
windowStyle = WS_POPUP or WS_VISIBLE
windowExtendedStyle = WS_EX_TOPMOST
ChangeScreenResolution (XRES, YRES, 32)
else
windowStyle = WS_SYSMENU or WS_POPUP or WS_VISIBLE or WS_MINIMIZEBOX
windowExtendedStyle = WS_EX_APPWINDOW
'Center window
rc.left = (GetSystemMetrics(SM_CXSCREEN) - XRES) / 2
rc.top = (GetSystemMetrics(SM_CYSCREEN) - YRES) / 2
end if
' create the window
hWndWin = CreateWindowEx(windowExtendedStyle, _
wndWc.lpszClassName, _
szAppName, _
windowStyle, _
rc.left, _
rc.top, _
rc.right, _
rc.bottom, _
HWND_DESKTOP, 0, _
hInstance, 0)
ShowCursor(false)
' return result
if (hWndWin) then
return 1
else
return 0
end if
end function
sub glDraw()
glClearColor(0.0, 0.0, 0.0, 1.0)
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT)
GLLOADIDENTITY
GLBEGIN GL_TRIANGLES
GLCOLOR3F 1,0,0
GLVERTEX3F 0,-1,0
GLCOLOR3F 0,1,0
GLVERTEX3F 1, 1,0
GLCOLOR3F 0,0,1
GLVERTEX3F -1, 1,0
GLEND
end sub
I was hoping to be able to use some of the glu functions like gluperspective and possibly some quadrics.
I can use glu fine with the tiny (and pretty incompatible) framework.
-
It seems that you are using an ancient version of freebasic (0.15 perhaps) :D
Works fine on fb 0.20 without any modifications.
If you don't want to update your FB, try to change your "include" sequence like this:
#include once "gl/gl.bi"
#include once "gl/glu.bi"
#include once "gl/glext.bi"
#include once "crt.bi"
#include once "windows.bi"
-
Cheers rbz, it is fb 1.5... Maybe time I upgraded... I had a similar problem with minifmod but finally fixed it.
-
yep definatly upgrade dude!! :D
-
The root of the problem is that max is a keyword. You'd need to change the .bi file not to use max as a parameter name in that function (you can change it to mymax and it should just work).
Jim
-
Cheers Jim :)
-
Just a little correction, max is not an FB keyword. The reason you were getting the error was because FB was trying to expand a macro that's defined in windef.bi (which is automatically included by windows.bi):
#ifndef NOMINMAX
#ifndef max
#define max(a,b) iif((a)>(b), a, b)
#endif
#ifndef min
#define min(a,b) iif((a)<(b), a, b)
#endif
#endif
-
Thanks for explaining why it failed Merick and welcome back, haven't seen you for a while :)
-
I noticed it because these min/max macros seem to be quite common, I've seen them several times before.
Haven't been around much because (except for another attempt to translate the mappy maploader) I haven't done much programming. Most of the time I just end up staring at the screen with no ideas.
-
Happens to the best of us im afraid dude.
If I havent greeted you before, then a warm welcome and nice to meet you dude.
-
The tips worked and now I am able to draw quadrics.
What I find confusing with this framework at the moment is where to define my screen settings.
GLUPERSPECTIVE 105.0, W_XW / W_YH, .1, 100.0
Seems to have no effect wherever I place it and the display is limited to a very small depth, the layout of this more stable framework is so totally different to the hacked one which I was used to using.
Also why do you clear the screen like this;
glClear(GL_COLOR_BUFFER_BIT OR GL_DEPTH_BUFFER_BIT)
Instead of;
glClear(GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT)
?
The biggie is this though...
A typical setup for one of my windows may look something like this;
GLVIEWPORT 0, 0, w_xw, w_yh
GLMATRIXMODE GL_PROJECTION
GLLOADIDENTITY
GLUPERSPECTIVE 105.0, W_XW / W_YH, .1, 100.0
GLMATRIXMODE GL_MODELVIEW
GLLOADIDENTITY
GLSHADEMODEL GL_SMOOTH
GLCLEARCOLOR 0.0, 0.0, 0.0,0
GLCLEARDEPTH 1.0
GLENABLE GL_DEPTH_TEST
GLDEPTHFUNC GL_LEQUAL
GLHINT GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST
GLENABLE (GL_CULL_FACE)
GLCULLFACE(GL_BACK)
GLENABLE GL_BLEND
GLBLENDFUNC(GL_ONE_MINUS_CONSTANT_ALPHA,GL_SRC_ALPHA)
GLHINT(GL_FOG_HINT,GL_NICEST)
GLFOGF(GL_FOG_DENSITY,0.045)
GLFOGF(GL_FOG_START, 6.0)
GLFOGF(GL_FOG_END, 100.0)
GLFOGI(GL_FOG_MODE,GL_EXP)
GLENABLE (GL_FOG)
GLLINEWIDTH 1
GLENABLE GL_SMOOTH
GLLOADIDENTITY
glLightfv( GL_LIGHT1, GL_AMBIENT, @LightAmbient(0)) '' Load Light-Parameters Into GL_LIGHT1
glLightfv( GL_LIGHT1, GL_DIFFUSE, @LightDiffuse(0))
glLightfv( GL_LIGHT1, GL_POSITION, @LightPosition(0))
glLightfv( GL_LIGHT2, GL_AMBIENT, @LightAmbient2(0)) '' Load Light-Parameters Into GL_LIGHT1
glLightfv( GL_LIGHT2, GL_POSITION, @LightPosition2(0))
glLightf ( GL_LIGHT2, GL_LINEAR_ATTENUATION,0.00001)
glLightf ( GL_LIGHT2, GL_QUADRATIC_ATTENUATION,0.6)
glEnable(GL_LIGHTING)
glEnable(GL_LIGHT1)
glEnable(GL_LIGHT2)
So where would I put that stuff so that I know it will work?
Thanks.
-
It's in the right place at the moment. Your z values will be between .1 and 100. That's a smallish range, might want to set far plane to 32000 or something.
bitwise-OR and + are the same when you're working with powers of two.
ie.
001b=1
010b=2
100b=4
1+2+4 = 7
001 OR 010 OR 100 = 111b = 7
The parameters for glClear are bitflags with powers of 2, each one indicating a thing to do.
Jim
-
It's in the right place at the moment. Your z values will be between .1 and 100. That's a smallish range, might want to set far plane to 32000 or something.
It's not anywhere at the moment mate.
Wherever I place it it seems not to make a difference.
bitwise-OR and + are the same when you're working with powers of two.
Is it faster to do the OR or the AND ?
Thanks.
-
I'm not sure about the other things, but if it were me then when doing the flags I would stick to using OR. Most of the C code that I've seen for gl uses the | operator. Not all of the gl flags are power of 2, so if you fall into the habit of using + instead of OR it might cause some problems with some of the other functions.
-
It's in the right place at the moment
It's not anywhere at the moment mate.
I mean, where you put it in your code snippet was the right place.
bitwise-OR and + are the same when you're working with powers of two.
Is it faster to do the OR or the AND ?
Exactly the same on every kind of cpu I've ever used. But in this case if the FB compiler is any good it will have worked out the fact the expression is constant and turned it into a number.
Jim
-
It's in the right place at the moment
It's not anywhere at the moment mate.
I mean, where you put it in your code snippet was the right place.
:(
Sorry, where would the Code Snippet fit into the framework that was posted above (1st post), I know the code snippet works, I've used it lots of times, my question is, where does it fit into RBZ's framework???? I don't get it.
-
Sorry, I forgot to to add a glInit function, it should looks like this:
'---------------------------------------------------------------------------------
'
' FreeBasic Window Framework by rbraz
'
' 12 Apr 2008
'
'---------------------------------------------------------------------------------
#include once "windows.bi"
#include once "gl/gl.bi"
#include once "gl/glext.bi"
#include once "crt.bi"
'DEVMODE bug, found the cure here --> http://www.freebasic.net/forum/viewtopic.php?t=5659&highlight=devmode
'Will be corrected by Victor in the next freebasic update
#undef DEVMODE
Type DEVMODE
dmDeviceName As Zstring * CCHDEVICENAME
dmSpecVersion As WORD
dmDriverVersion As WORD
dmSize As WORD
dmDriverExtra As WORD
dmFields As DWORD
dmOrientation As Short
dmPaperSize As Short
dmPaperLength As Short
dmPaperWidth As Short
dmScale As Short
dmCopies As Short
dmDefaultSource As Short
dmPrintQuality As Short
dmColor As Short
dmDuplex As Short
dmYResolution As Short
dmTTOption As Short
dmCollate As Short
dmFormName As Zstring * CCHFORMNAME
dmLogPixels As WORD
dmBitsPerPel As DWORD
dmPelsWidth As DWORD
dmPelsHeight As DWORD
dmDisplayFlags As DWORD
dmDisplayFrequency As DWORD
dmICMMethod As DWORD
dmICMIntent As DWORD
dmMediaType As DWORD
dmDitherType As DWORD
dmReserved1 As DWORD
dmReserved2 As DWORD
dmPanningWidth As DWORD
dmPanningHeight As DWORD
End Type
'Win Main
Declare Function WinMain ( byval hInstance as HINSTANCE, _
byval hPrevInstance as HINSTANCE, _
szCmdLine as string, _
byval iCmdShow as integer ) as integer
'
' Entry point
'
end WinMain( GetModuleHandle( null ), null, Command$, SW_NORMAL )
'app window procedure
Declare Function WndProc( byval hWnd as HWND, _
byval message as UINT, _
byval wParam as WPARAM, _
byval lParam as LPARAM ) as LRESULT
'window creation helper
Declare Function MakeWindow(byval iWidth as integer, _
byval iHeight as integer, _
byval hInstance as HINSTANCE) as integer
Declare Sub ChangeScreenResolution (byval wwidth as integer, byval hheight as integer, byval bitsPerPixel as integer)
'OpenGL Draw sub
Declare Sub glDraw()
'OpenGL Init
Declare Sub glInit()
'Application name
Const szAppName = "FreeBasic - OpenGL Framework"
'app window handle
Dim Shared hWndWin as HWND
'app hdc
Dim Shared hdcWin as HDC
'Window resolution
const XRES = 800
const YRES = 600
' ----------------------------------
' name: WndProc
' desc: Processes windows messages
'
' ----------------------------------
function WndProc ( byval hWnd as HWND, _
byval message as UINT, _
byval wParam as WPARAM, _
byval lParam as LPARAM ) as LRESULT
'
' Process messages
'
select case( message )
'
' Key pressed
'
case WM_KEYDOWN
if( lobyte( wParam ) = 27 ) then
PostMessage( hWnd, WM_CLOSE, 0, 0 )
end if
'
' Window was closed
'
case WM_DESTROY
PostQuitMessage( 0 )
exit function
end select
'
' Message doesn't concern us, send it to the default handler
' and get result
'
function = DefWindowProc( hWnd, message, wParam, lParam )
end function
' ---------------------------------------
' name: WinMain
' desc: A win2 gui program entry point
'
' ---------------------------------------
function WinMain ( byval hInstance as HINSTANCE, _
byval hPrevInstance as HINSTANCE, _
szCmdLine as string, _
byval iCmdShow as integer ) as integer
dim wMsg as MSG
' get module instance
hInstance = GetModuleHandle(NULL)
'Create our skinned window
if MakeWindow(XRES,YRES,hInstance) = 0 then
MessageBox(NULL, "Failed to create window", szAppName, MB_ICONERROR )
return -1
end if
ShowWindow( hWndWin, iCmdShow )
UpdateWindow( hWndWin )
'Get window device context
hdcWin = GetDC(hWndWin)
'Initialize OGL window
dim pfd as PIXELFORMATDESCRIPTOR
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR)
pfd.nVersion = 1
pfd.dwFlags = PFD_DRAW_TO_WINDOW or PFD_SUPPORT_OPENGL or PFD_DOUBLEBUFFER
pfd.dwLayerMask = PFD_MAIN_PLANE
pfd.iPixelType = PFD_TYPE_RGBA
pfd.cColorBits = 32
pfd.cDepthBits = 32
SetPixelFormat ( hdcWin, ChoosePixelFormat ( hdcWin, @pfd) , @pfd )
wglMakeCurrent ( hdcWin, wglCreateContext(hdcWin) )
'Call opengl init
glInit()
'
' Process windows messages
'
while(wMsg.message <> WM_QUIT)
if (PeekMessage (@wMsg,NULL,0,0,PM_REMOVE) <> 0) then
DispatchMessage(@wMsg)
else
glDraw()
SwapBuffers (hdcWin)
end if
wend
' Ends a process and all its threads.
ExitProcess(0)
end function
'Change The Screen Resolution
sub ChangeScreenResolution (byval wwidth as integer, byval hheight as integer, byval bitsPerPixel as integer)
dim dmScreenSettings as DEVMODE
ZeroMemory(@dmScreenSettings, sizeof (DEVMODE))
dmScreenSettings.dmSize = sizeof(DEVMODE)
dmScreenSettings.dmPelsWidth = wwidth
dmScreenSettings.dmPelsHeight = hheight
dmScreenSettings.dmBitsPerPel = bitsPerPixel
dmScreenSettings.dmFields = DM_BITSPERPEL or DM_PELSWIDTH or DM_PELSHEIGHT
if (ChangeDisplaySettings (cast(LPDEVMODE,@dmScreenSettings), CDS_FULLSCREEN) <> DISP_CHANGE_SUCCESSFUL) then
MessageBox(NULL,"Change Display Error!", szAppName,MB_OK or MB_ICONEXCLAMATION)
end -1
end if
end sub
' ------------------------------------------------------------------------
' Window creation function.
' ------------------------------------------------------------------------
Function MakeWindow(byval iWidth as integer, _
byval iHeight as integer, _
byval hInstance as HINSTANCE) as integer
function = 0
' our window class
dim wndWc as WNDCLASS
dim windowStyle as DWORD
dim windowExtendedStyle as DWORD
dim rc as RECT
' ---------------------------------------------------------
' fill window class members
' ---------------------------------------------------------
wndWc.style = CS_OWNDC
wndWc.lpfnWndProc = @WndProc
wndWc.cbClsExtra = 0
wndWc.cbWndExtra = 0
wndWc.hInstance = GetModuleHandle(NULL)
wndWc.hIcon = NULL
wndWc.hCursor = LoadCursor(0, IDC_ARROW)
wndWc.hIcon = LoadIcon(hInstance, IDI_APPLICATION) ' Load our normal icon
wndWc.hbrBackground = GetStockObject(BLACK_BRUSH)
wndWc.lpszMenuName = NULL
wndWc.lpszClassName = strptr( szAppName )
' register class
if( RegisterClass( @wndWc ) = FALSE ) then
MessageBox(NULL, "Failed to register Window Class!", szAppName, MB_ICONERROR )
exit function
end if
rc.left = 0
rc.top = 0
rc.right = XRES
rc.bottom = YRES
'Setup video mode window - Windowed / Fullscreen
dim winmode as integer
if( MessageBox(NULL,"Full Screen ?", "Screen Mode",MB_YESNO or MB_ICONQUESTION) = IDYES ) then
winmode = 0
else
winmode = 1
end if
if (winmode = 0) then
windowStyle = WS_POPUP or WS_VISIBLE
windowExtendedStyle = WS_EX_TOPMOST
ChangeScreenResolution (XRES, YRES, 32)
else
windowStyle = WS_SYSMENU or WS_POPUP or WS_VISIBLE or WS_MINIMIZEBOX
windowExtendedStyle = WS_EX_APPWINDOW
'Center window
rc.left = (GetSystemMetrics(SM_CXSCREEN) - XRES) / 2
rc.top = (GetSystemMetrics(SM_CYSCREEN) - YRES) / 2
end if
' create the window
hWndWin = CreateWindowEx(windowExtendedStyle, _
wndWc.lpszClassName, _
szAppName, _
windowStyle, _
rc.left, _
rc.top, _
rc.right, _
rc.bottom, _
HWND_DESKTOP, 0, _
GetModuleHandle(NULL), 0)
ShowCursor(false)
' return result
if (hWndWin) then
return 1
else
return 0
end if
end function
sub glInit()
glClearColor(0.2f, 0.3f, 0.5f, 1.0f)
end sub
sub glDraw()
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT)
end sub
-
Maybe I will finally make something now that won't crash on everyones machines!
Thanks Rbz :)
-
Seems to work fine now, thanks mate.
-
As a reference point for people who are in the same position I was before, here is a working basic routine .
#include once "gl/gl.bi"
#include once "gl/glu.bi"
#include once "gl/glext.bi"
#include once "crt.bi"
#include once "windows.bi"
'DEVMODE bug, found the cure here --> http://www.freebasic.net/forum/viewtopic.php?t=5659&highlight=devmode
'Will be corrected by Victor in the next freebasic update
#undef DEVMODE
Type DEVMODE
dmDeviceName As Zstring * CCHDEVICENAME
dmSpecVersion As WORD
dmDriverVersion As WORD
dmSize As WORD
dmDriverExtra As WORD
dmFields As DWORD
dmOrientation As Short
dmPaperSize As Short
dmPaperLength As Short
dmPaperWidth As Short
dmScale As Short
dmCopies As Short
dmDefaultSource As Short
dmPrintQuality As Short
dmColor As Short
dmDuplex As Short
dmYResolution As Short
dmTTOption As Short
dmCollate As Short
dmFormName As Zstring * CCHFORMNAME
dmLogPixels As WORD
dmBitsPerPel As DWORD
dmPelsWidth As DWORD
dmPelsHeight As DWORD
dmDisplayFlags As DWORD
dmDisplayFrequency As DWORD
dmICMMethod As DWORD
dmICMIntent As DWORD
dmMediaType As DWORD
dmDitherType As DWORD
dmReserved1 As DWORD
dmReserved2 As DWORD
dmPanningWidth As DWORD
dmPanningHeight As DWORD
End Type
'Win Main
Declare Function WinMain ( byval hInstance as HINSTANCE, _
byval hPrevInstance as HINSTANCE, _
szCmdLine as string, _
byval iCmdShow as integer ) as integer
'
' Entry point
'
end WinMain( GetModuleHandle( null ), null, Command$, SW_NORMAL )
'app window procedure
Declare Function WndProc( byval hWnd as HWND, _
byval message as UINT, _
byval wParam as WPARAM, _
byval lParam as LPARAM ) as LRESULT
'window creation helper
Declare Function MakeWindow(byval iWidth as integer, _
byval iHeight as integer, _
byval hInstance as HINSTANCE) as integer
Declare Sub ChangeScreenResolution (byval wwidth as integer, byval hheight as integer, byval bitsPerPixel as integer)
'OpenGL Draw sub
Declare Sub glDraw()
'OpenGL Init
Declare Sub glInit()
'Application name
Const szAppName = "FreeBasic - OpenGL Framework"
'app window handle
Dim Shared hWndWin as HWND
'app hdc
Dim Shared hdcWin as HDC
'Window resolution
const XRES = 800
const YRES = 600
dim SHARED LightAmbient(0 to 3) as single => {0.9, 0.9, 0.9,0.15} '' Ambient Light is 20% white
dim SHARED LightDiffuse(0 to 3) as single => {0.4, 0.4, 0.4,0.6} '' Diffuse Light is white
dim SHARED LightPosition(0 to 2) as single =>{0.0, 2.0, 10. } '' Position is somewhat in front of screen
DIM SHARED Material(0 to 3) AS SINGLE => {0.5, 0.5, 0.8,0.8} :' WHITE
DIM SHARED MaterialRED(0 to 3) AS SINGLE => {1.0, 0.0, 0.0,0.8} :' WHITE
DIM SHARED MaterialBLU(0 to 3) AS SINGLE => {0.0, 0.0, 1.0,0.8} :' WHITE
DIM SHARED AS INTEGER QOBJ
DIM SHARED AS INTEGER LP
DECLARE SUB DRAWVERTBAR(BYVAL PSX AS DOUBLE, BYVAL PSY AS DOUBLE, BYVAL PSZ AS DOUBLE)
' ----------------------------------
' name: WndProc
' desc: Processes windows messages
'
' ----------------------------------
function WndProc ( byval hWnd as HWND, _
byval message as UINT, _
byval wParam as WPARAM, _
byval lParam as LPARAM ) as LRESULT
'
' Process messages
'
select case( message )
'
' Key pressed
'
case WM_KEYDOWN
if( lobyte( wParam ) = 27 ) then
PostMessage( hWnd, WM_CLOSE, 0, 0 )
end if
'
' Window was closed
'
case WM_DESTROY
PostQuitMessage( 0 )
exit function
end select
'
' Message doesn't concern us, send it to the default handler
' and get result
'
function = DefWindowProc( hWnd, message, wParam, lParam )
end function
' ---------------------------------------
' name: WinMain
' desc: A win2 gui program entry point
'
' ---------------------------------------
function WinMain ( byval hInstance as HINSTANCE, _
byval hPrevInstance as HINSTANCE, _
szCmdLine as string, _
byval iCmdShow as integer ) as integer
dim wMsg as MSG
' get module instance
hInstance = GetModuleHandle(NULL)
'Create our skinned window
if MakeWindow(XRES,YRES,hInstance) = 0 then
MessageBox(NULL, "Failed to create window", szAppName, MB_ICONERROR )
return -1
end if
ShowWindow( hWndWin, iCmdShow )
UpdateWindow( hWndWin )
'Get window device context
hdcWin = GetDC(hWndWin)
'Initialize OGL window
dim pfd as PIXELFORMATDESCRIPTOR
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR)
pfd.nVersion = 1
pfd.dwFlags = PFD_DRAW_TO_WINDOW or PFD_SUPPORT_OPENGL or PFD_DOUBLEBUFFER
pfd.dwLayerMask = PFD_MAIN_PLANE
pfd.iPixelType = PFD_TYPE_RGBA
pfd.cColorBits = 32
pfd.cDepthBits = 32
SetPixelFormat ( hdcWin, ChoosePixelFormat ( hdcWin, @pfd) , @pfd )
wglMakeCurrent ( hdcWin, wglCreateContext(hdcWin) )
'Call opengl init
glInit()
'
' Process windows messages
'
while(wMsg.message <> WM_QUIT)
if (PeekMessage (@wMsg,NULL,0,0,PM_REMOVE) <> 0) then
DispatchMessage(@wMsg)
else
glDraw()
SwapBuffers (hdcWin)
end if
wend
' Ends a process and all its threads.
ExitProcess(0)
end function
'Change The Screen Resolution
sub ChangeScreenResolution (byval wwidth as integer, byval hheight as integer, byval bitsPerPixel as integer)
dim dmScreenSettings as DEVMODE
ZeroMemory(@dmScreenSettings, sizeof (DEVMODE))
dmScreenSettings.dmSize = sizeof(DEVMODE)
dmScreenSettings.dmPelsWidth = wwidth
dmScreenSettings.dmPelsHeight = hheight
dmScreenSettings.dmBitsPerPel = bitsPerPixel
dmScreenSettings.dmFields = DM_BITSPERPEL or DM_PELSWIDTH or DM_PELSHEIGHT
if (ChangeDisplaySettings (cast(LPDEVMODE,@dmScreenSettings), CDS_FULLSCREEN) <> DISP_CHANGE_SUCCESSFUL) then
MessageBox(NULL,"Change Display Error!", szAppName,MB_OK or MB_ICONEXCLAMATION)
end -1
end if
end sub
' ------------------------------------------------------------------------
' Window creation function.
' ------------------------------------------------------------------------
Function MakeWindow(byval iWidth as integer, _
byval iHeight as integer, _
byval hInstance as HINSTANCE) as integer
function = 0
' our window class
dim wndWc as WNDCLASS
dim windowStyle as DWORD
dim windowExtendedStyle as DWORD
dim rc as RECT
' ---------------------------------------------------------
' fill window class members
' ---------------------------------------------------------
wndWc.style = CS_OWNDC
wndWc.lpfnWndProc = @WndProc
wndWc.cbClsExtra = 0
wndWc.cbWndExtra = 0
wndWc.hInstance = GetModuleHandle(NULL)
wndWc.hIcon = NULL
wndWc.hCursor = LoadCursor(0, IDC_ARROW)
wndWc.hIcon = LoadIcon(hInstance, IDI_APPLICATION) ' Load our normal icon
wndWc.hbrBackground = GetStockObject(BLACK_BRUSH)
wndWc.lpszMenuName = NULL
wndWc.lpszClassName = strptr( szAppName )
' register class
if( RegisterClass( @wndWc ) = FALSE ) then
MessageBox(NULL, "Failed to register Window Class!", szAppName, MB_ICONERROR )
exit function
end if
rc.left = 0
rc.top = 0
rc.right = XRES
rc.bottom = YRES
'Setup video mode window - Windowed / Fullscreen
dim winmode as integer
if( MessageBox(NULL,"Full Screen ?", "Screen Mode",MB_YESNO or MB_ICONQUESTION) = IDYES ) then
winmode = 0
else
winmode = 1
end if
if (winmode = 0) then
windowStyle = WS_POPUP or WS_VISIBLE
windowExtendedStyle = WS_EX_TOPMOST
ChangeScreenResolution (XRES, YRES, 32)
else
windowStyle = WS_SYSMENU or WS_POPUP or WS_VISIBLE or WS_MINIMIZEBOX
windowExtendedStyle = WS_EX_APPWINDOW
'Center window
rc.left = (GetSystemMetrics(SM_CXSCREEN) - XRES) / 2
rc.top = (GetSystemMetrics(SM_CYSCREEN) - YRES) / 2
end if
' create the window
hWndWin = CreateWindowEx(windowExtendedStyle, _
wndWc.lpszClassName, _
szAppName, _
windowStyle, _
rc.left, _
rc.top, _
rc.right, _
rc.bottom, _
HWND_DESKTOP, 0, _
GetModuleHandle(NULL), 0)
ShowCursor(false)
' return result
if (hWndWin) then
return 1
else
return 0
end if
end function
sub glInit()
QOBJ=GLUNEWQUADRIC
GLUQUADRICNORMALS (QOBJ,GLU_SMOOTH)
GLVIEWPORT 0, 50, XRES, YRES-80 '' Reset The Current Viewport
GLMATRIXMODE GL_PROJECTION '' Select The Projection Matrix
GLLOADIDENTITY
GLUPERSPECTIVE 45.0, XRES / YRES, .1, 100.0 '' Calculate The Aspect Ratio Of The Window
GLMATRIXMODE GL_MODELVIEW '' Select The Modelview Matrix
GLLOADIDENTITY '' Reset The Modelview Matrix
GLSHADEMODEL GL_SMOOTH '' Enable Smooth Shading
GLCLEARCOLOR 0.0, 0.00, 0.00,0.0
GLCLEARDEPTH 1.0 '' Depth Buffer Setup
GLENABLE GL_DEPTH_TEST '' Enables Depth Testing
GLDEPTHFUNC GL_LEQUAL '' The Type Of Depth Testing To Do
GLHINT GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST '' Really Nice Perspective Calculations
GLENABLE (GL_CULL_FACE)
GLCULLFACE(GL_BACK)
GLENABLE GL_BLEND
GLBLENDFUNC(GL_ONE_MINUS_CONSTANT_ALPHA,GL_SRC_ALPHA)
GLLINEWIDTH 1
GLENABLE GL_SMOOTH
glLightfv( GL_LIGHT1, GL_AMBIENT, @LightAmbient(0)) '' Load Light-Parameters Into GL_LIGHT1
glLightfv( GL_LIGHT1, GL_DIFFUSE, @LightDiffuse(0))
glLightfv( GL_LIGHT1, GL_POSITION, @LightPosition(0))
glEnable(GL_LIGHTING)
glEnable(GL_LIGHT1)
GLFOGF(GL_FOG_DENSITY,0.5)
GLFOGF(GL_FOG_START, 1.0)
GLFOGF(GL_FOG_END, 40.0)
GLENABLE (GL_FOG)
GLLINEWIDTH 1
GLLOADIDENTITY
end sub
sub glDraw()
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT)
GLLOADIDENTITY
GLDISABLE GL_BLEND
FOR LP=-50 TO -3 STEP 1
DRAWVERTBAR((LP*.05)*SIN(((TIMER*20)+LP)*.1)+(LP*.01)*COS(((TIMER*50)+LP)*.2),-.15,LP/5)
NEXT
GLDISABLE GL_DEPTHTEST
GLBEGIN GL_LINES
GLMATERIALFV (GL_FRONT,GL_AMBIENT_AND_DIFFUSE,@MaterialRED(0))
GLVERTEX3F -.3,-.2065,-.5
GLMATERIALFV (GL_FRONT,GL_AMBIENT_AND_DIFFUSE,@MaterialBLU(0))
GLVERTEX3F .3,-.2065,-.5
GLMATERIALFV (GL_FRONT,GL_AMBIENT_AND_DIFFUSE,@MaterialBLU(0))
GLVERTEX3F -.3,.165,-.5
GLMATERIALFV (GL_FRONT,GL_AMBIENT_AND_DIFFUSE,@MaterialRED(0))
GLVERTEX3F .3,.165,-.5
GLEND
GLENABLE GL_DEPTHTEST
GLENABLE GL_BLEND
end sub
SUB DRAWVERTBAR(BYVAL PSX AS DOUBLE, BYVAL PSY AS DOUBLE, BYVAL PSZ AS DOUBLE)
GLPUSHMATRIX
GLLOADIDENTITY
glTranslatef PSX, PSY, PSZ
glRotatef( 90, 1.0, 0.0, 0.0)
glRotatef( 0, 0.0, 1.0, 0.0)
glRotatef( TIMER*100, 0.0, 0.0, 1.0)
GLMATERIALFV (GL_FRONT,GL_AMBIENT_AND_DIFFUSE,@Material(0))
GLUCYLINDER(QOBJ,.1,.1,10,20,1)
glRotatef( 0, 1.0, 0.0, 0.0)
glRotatef( 180, 0.0, 1.0, 0.0)
glRotatef( 0, 0.0, 0.0, 1.0)
GLUDISK(QOBJ,0,.1,20,1)
GLPOPMATRIX
END SUB
-
Here's a new one, added mouse function and hopefully got window mode + mouse event fixed.
'---------------------------------------------------------------------------------
'
' FreeBasic Window Framework by rbraz
'
' 19 Jul 2009
'
'---------------------------------------------------------------------------------
#include once "gl/gl.bi"
#include once "gl/glu.bi"
#include once "gl/glext.bi"
#include once "crt.bi"
#include once "windows.bi"
'DEVMODE bug, found the cure here --> http://www.freebasic.net/forum/viewtopic.php?t=5659&highlight=devmode
'Will be corrected by Victor in the next freebasic update
#undef DEVMODE
Type DEVMODE
dmDeviceName As Zstring * CCHDEVICENAME
dmSpecVersion As WORD
dmDriverVersion As WORD
dmSize As WORD
dmDriverExtra As WORD
dmFields As DWORD
dmOrientation As Short
dmPaperSize As Short
dmPaperLength As Short
dmPaperWidth As Short
dmScale As Short
dmCopies As Short
dmDefaultSource As Short
dmPrintQuality As Short
dmColor As Short
dmDuplex As Short
dmYResolution As Short
dmTTOption As Short
dmCollate As Short
dmFormName As Zstring * CCHFORMNAME
dmLogPixels As WORD
dmBitsPerPel As DWORD
dmPelsWidth As DWORD
dmPelsHeight As DWORD
dmDisplayFlags As DWORD
dmDisplayFrequency As DWORD
dmICMMethod As DWORD
dmICMIntent As DWORD
dmMediaType As DWORD
dmDitherType As DWORD
dmReserved1 As DWORD
dmReserved2 As DWORD
dmPanningWidth As DWORD
dmPanningHeight As DWORD
End Type
'Win Main
Declare Function WinMain ( byval hInstance as HINSTANCE, _
byval hPrevInstance as HINSTANCE, _
szCmdLine as string, _
byval iCmdShow as integer ) as integer
'
' Entry point
'
end WinMain( GetModuleHandle( null ), null, Command$, SW_NORMAL )
'app window procedure
Declare Function WndProc( byval hWnd as HWND, _
byval message as UINT, _
byval wParam as WPARAM, _
byval lParam as LPARAM ) as LRESULT
'window creation helper
Declare Function MakeWindow(byval iWidth as integer, _
byval iHeight as integer, _
byval hInstance as HINSTANCE) as integer
Declare Sub ChangeScreenResolution (byval wwidth as integer, byval hheight as integer, byval bitsPerPixel as integer)
'OpenGL Draw sub
Declare Sub glDraw()
'OpenGL Init
Declare Sub glInit()
'Application name
Const szAppName = "FreeBasic - OpenGL Framework"
'app window handle
Dim Shared hWndWin as HWND
'app hdc
Dim Shared hdcWin as HDC
' our window class
Dim Shared wndWc as WNDCLASSEX
'Mouse control
Dim Shared mouseX as integer
Dim Shared mouseY as integer
Dim Shared leftbutton as integer
Dim Shared rightbutton as integer
'Window resolution
const XRES = 800
const YRES = 600
' ----------------------------------
' name: WndProc
' desc: Processes windows messages
'
' ----------------------------------
function WndProc ( byval hWnd as HWND, _
byval message as UINT, _
byval wParam as WPARAM, _
byval lParam as LPARAM ) as LRESULT
'
' Process messages
'
select case(message)
case WM_POWERBROADCAST
function = BROADCAST_QUERY_DENY
case WM_SYSCOMMAND
select case(message and &hFFF0)
case SC_SCREENSAVE
function = 0
case SC_MONITORPOWER
function = 0 'disable screen/power savers
case else
function = DefWindowProc( hWnd, message, wParam, lParam )
end select
'
' Key pressed
'
case WM_KEYDOWN
if( lobyte( wParam ) = 27 ) then
PostMessage( hWnd, WM_CLOSE, 0, 0 )
end if
'Left mouse button pressed
case WM_LBUTTONDOWN
leftbutton = 1
'Left mouse button up
case WM_LBUTTONUP
leftbutton = 0
'Right mouse button pressed
case WM_RBUTTONDOWN
rightbutton = 1
'Right mouse button up
case WM_RBUTTONUP
rightbutton = 0
'Check for mouse movement
case WM_MOUSEMOVE
'Detect mouse position
mouseX = LOWORD(lParam)
mouseY = HIWORD(lParam)
'
' Window was closed
'
case WM_DESTROY
PostQuitMessage( 0 )
exit function
end select
'
' Message doesn't concern us, send it to the default handler
' and get result
'
function = DefWindowProc( hWnd, message, wParam, lParam )
end function
' ---------------------------------------
' name: WinMain
' desc: A win2 gui program entry point
'
' ---------------------------------------
function WinMain ( byval hInstance as HINSTANCE, _
byval hPrevInstance as HINSTANCE, _
szCmdLine as string, _
byval iCmdShow as integer ) as integer
dim wMsg as MSG
' get module instance
hInstance = GetModuleHandle(NULL)
'Create our skinned window
if MakeWindow(XRES,YRES,hInstance) = 0 then
MessageBox(NULL, "Failed to create window", szAppName, MB_ICONERROR )
return -1
end if
ShowWindow( hWndWin, iCmdShow )
UpdateWindow( hWndWin )
'Get window device context
hdcWin = GetDC(hWndWin)
'Initialize OGL window
dim pfd as PIXELFORMATDESCRIPTOR
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR)
pfd.nVersion = 1
pfd.dwFlags = PFD_DRAW_TO_WINDOW or PFD_SUPPORT_OPENGL or PFD_DOUBLEBUFFER
pfd.dwLayerMask = PFD_MAIN_PLANE
pfd.iPixelType = PFD_TYPE_RGBA
pfd.cColorBits = 32
pfd.cDepthBits = 32
SetPixelFormat ( hdcWin, ChoosePixelFormat ( hdcWin, @pfd) , @pfd )
wglMakeCurrent ( hdcWin, wglCreateContext(hdcWin) )
'Call opengl init
glInit()
'
' Process windows messages
'
while(wMsg.message <> WM_QUIT)
if (PeekMessage (@wMsg,NULL,0,0,PM_REMOVE) <> 0) then
DispatchMessage(@wMsg)
else
glDraw()
SwapBuffers (hdcWin)
end if
wend
'Unregister window class
UnregisterClass(wndWc.lpszClassName, hInstance)
' Ends a process and all its threads.
ExitProcess(0)
end function
'Change The Screen Resolution
sub ChangeScreenResolution (byval wwidth as integer, byval hheight as integer, byval bitsPerPixel as integer)
dim dmScreenSettings as DEVMODE
ZeroMemory(@dmScreenSettings, sizeof (DEVMODE))
dmScreenSettings.dmSize = sizeof(DEVMODE)
dmScreenSettings.dmPelsWidth = wwidth
dmScreenSettings.dmPelsHeight = hheight
dmScreenSettings.dmBitsPerPel = bitsPerPixel
dmScreenSettings.dmFields = DM_BITSPERPEL or DM_PELSWIDTH or DM_PELSHEIGHT
if (ChangeDisplaySettings (cast(LPDEVMODE,@dmScreenSettings), CDS_FULLSCREEN) <> DISP_CHANGE_SUCCESSFUL) then
MessageBox(NULL,"Change Display Error!", szAppName,MB_OK or MB_ICONEXCLAMATION)
end -1
end if
end sub
' ------------------------------------------------------------------------
' Window creation function.
' ------------------------------------------------------------------------
Function MakeWindow(byval iWidth as integer, _
byval iHeight as integer, _
byval hInstance as HINSTANCE) as integer
function = 0
dim windowStyle as DWORD
dim windowExtendedStyle as DWORD
dim rc as RECT
' ---------------------------------------------------------
' fill window class members
' ---------------------------------------------------------
ZeroMemory (@wndWc, sizeof(WNDCLASSEX))
wndWc.cbSize = sizeof (WNDCLASSEX)
wndWc.style = CS_HREDRAW or CS_VREDRAW or CS_OWNDC
wndWc.lpfnWndProc = Cast(WNDPROC, @WndProc)
wndWc.hInstance = hInstance
wndWc.hbrBackground = GetStockObject(BLACK_BRUSH)
wndWc.hCursor = LoadCursor(NULL, IDC_ARROW)
wndWc.lpszClassName = strptr( szAppName )
wndWc.hIcon = LoadIcon(hInstance, IDI_APPLICATION) ' Load our normal icon
' register class
if( RegisterClassEx( @wndWc ) = FALSE ) then
MessageBox(NULL, "Failed to register Window Class!", szAppName, MB_ICONERROR )
exit function
end if
rc.left = 0
rc.top = 0
rc.right = XRES
rc.bottom = YRES
'Setup video mode window - Windowed / Fullscreen
dim winmode as integer
if( MessageBox(NULL,"Full Screen ?", "Screen Mode",MB_YESNO or MB_ICONQUESTION) = IDYES ) then
winmode = 0
else
winmode = 1
end if
if (winmode = 0) then
windowStyle = WS_POPUP or WS_VISIBLE
windowExtendedStyle = WS_EX_TOPMOST
ChangeScreenResolution (XRES, YRES, 32)
else
windowStyle = WS_SYSMENU or WS_POPUP or WS_VISIBLE or WS_MINIMIZEBOX
windowExtendedStyle = WS_EX_APPWINDOW
'Center window
rc.left = (GetSystemMetrics(SM_CXSCREEN) - XRES) / 2
rc.top = (GetSystemMetrics(SM_CYSCREEN) - YRES) / 2
end if
' create the window
hWndWin = CreateWindowEx(windowExtendedStyle, _
wndWc.lpszClassName, _
szAppName, _
windowStyle, _
rc.left, _
rc.top, _
rc.right, _
rc.bottom, _
HWND_DESKTOP, 0, _
GetModuleHandle(NULL), 0)
ShowCursor(false)
' return result
if (hWndWin) then
return 1
else
return 0
end if
end function
sub glInit()
glClearColor(0.2f, 0.3f, 0.5f, 1.0f)
end sub
sub glDraw()
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT)
'Debug
locate 1,1:print "Mouse X pos: ";mouseX
locate 2,1:print "Mouse Y pos: ";mouseY
locate 3,1:print "Mouse Left Button: ";leftbutton
locate 4,1:print "Mouse Rigth Button: ";rightbutton
end sub
-
This seems to be working fine now Rbz :)
Thanks mate.
-
How small does the exe come out from your code example with the effect shockwave ?
I am betting its abit smaller than bmax but bmax handles all the windows setup for me and is alittle bloated for some of it, tho it is possible to code the windows stuff yourself probably making the code even smaller.
-
Just a blank screen is 5kb crunched.
Adding the effect wont increase the size much at all, the exe already has crt.bi, windows.by, gl, glu and glext
So in all honesty its much smaller than Bmax.
Don't let that put you off using Bmax though, it's perfectly fine.
I intend to use this framework for 40kb intros though... My demo for Sundown will be a 40kb demo.
-
I am happy messing about in bmax but it's interesting to see how small your exe's are, I havent dug to deep into it but I suspect bmax's could be made smaller by rolling my own graphics driver but then i would likely be just as well to go to C++ which I am tempted to try and make some stuff in purely to see if I can.
Freebasic is a very nice setup for free, I think I still have version 0.15 on my harddrive with fbide but I havent looked at it in a while, i like using the oop side of bamx alot now rather than the Procedural way I use to code. Doesnt mean I arent tempted by the tiny exe's ;D
[edit] Well smallest exe I got crunched is 36kb but I do get a basic font and a drawing routine for that as well. still bit big tho lol
-
Had a play about in VC++ 2008 express and can get using just upx to compress, a 7kb exe that asks for fullscreen or not and then opens a blank gl context and clears/flips it, with a simple fps display in the title bar of the window tho it doesnt seem perfect fullscreen yet, dont think thats to bad tbh but it does show just how good freebasic is at build small exe's.
-
You can get a job with VC++ though so I'd stick with that if I were you :)
-
If you remove the default libraries you can get window+opengl+res switch down to a few hundred bytes, crinkled.
Jim