I've adapted the source code that Rbraz posted to create a very small opengl initialisation, the program below (freebasic), draws a 3D starfield.
The program will compile fine, but there are problems when going fullscreen.
As long as your desktop is set at 1024 * 768 it will run with no problems, however, if your desktop is < 1024*768, the origin is wrong and the display is chopped off.
If your desktop resolution is>1024*768 then the window opens correctly but the viewport is the wrong size (too small) and at the bottom left of the screen.
Any ideas?

What stooopid thing have I done now?
option explicit
option static
'-------------------------------------
' Includes
'-------------------------------------
#include "GL/gl.bi"
#include "GL/glu.bi"
#include "windows.bi"
DIM SHARED AS BYTE W_FULLSCREEN =1 : ' 1 = FULLSCREEN
DIM SHARED AS INTEGER W_XO =40 : ' X pos of window
DIM SHARED AS INTEGER W_YO =40 : ' Y pos of window
DIM SHARED AS INTEGER W_XW =1024 : ' Width.
DIM SHARED AS INTEGER W_YH =768 : ' Height.
DIM SHARED pfd as PIXELFORMATDESCRIPTOR
DIM SHARED hdc as hDC
DECLARE SUB InitOGL()
DIM SHARED AS INTEGER STARS=500
DIM SHARED AS DOUBLE VVX(STARS)
DIM SHARED AS DOUBLE VVY(STARS)
DIM SHARED AS DOUBLE VVZ(STARS)
DECLARE SUB STARINIT()
DECLARE SUB STARFIELD()
STARINIT()
DIM SHARED XR AS SINGLE : ' X ROTATION
DIM SHARED YR AS SINGLE : ' Y ROTATION
DIM SHARED ZR AS SINGLE : ' Z ROTATION
DIM D AS INTEGER
DIM SHARED AS DOUBLE GX,GY,GZ,TW,ZRR,XRR,YRR,RRR,delta,mm,fr
mm=timer
InitOGL()
'===============================================================================
' MAIN LOOP
'===============================================================================
WHILE((GetAsyncKeyState(VK_ESCAPE)<>-32767))
glClear(GL_DEPTH_BUFFER_BIT + GL_COLOR_BUFFER_BIT )
starfield()
GLFLUSH()
TW=TIMER
fr=fr+1
xr = xr +delta
yr = yr +delta
zr = zr +delta
if timer-mm>=.05 then
delta=0.3/fr
mm=timer
fr=0
end if
SwapBuffers(hDC)
sleep 1
WEND
END
SUB STARFIELD
DIM A AS INTEGER
GLPUSHMATRIX
glTranslatef(0, 0, -9)
glRotatef(XR, 1.0, 0.0, 0.0)
glRotatef(YR, 0.0, 1.0, 0.0)
glRotatef(ZR, 0.0, 0.0, 1.0)
glpointsize 1.5
FOR A=0 TO STARS
GLCOLOR3F 0.4,0.6,1.0
GLBEGIN GL_POINTS
GLVERTEX3F vvx(a),vvy(a),vvz(a)
GLEND
vvz(a)=vvz(a)+(delta*2)
if vvz(a)>=20 then vvz(a)=vvz(a)-40
NEXT
GLPOPMATRIX
GLPUSHMATRIX
glTranslatef(0, 0, -12)
glbegin gl_lines
GLCOLOR3F 0.6,0.6,1.0
GLVERTEX3F -17.4,-9.8,0
GLCOLOR3F 0.9,0.8,1.0
GLVERTEX3F 17.4,-9.8,0
GLVERTEX3F -17.4,9.8,0
GLCOLOR3F 0.6,0.6,1.0
GLVERTEX3F 17.4,9.8,0
glend
GLPOPMATRIX
END SUB
SUB STARINIT()
DIM A AS INTEGER
FOR A=0 TO STARS
VVX(A)=(RND(1)*40)-20
VVY(A)=(RND(1)*40)-20
VVZ(A)=(RND(1)*40)-20
NEXT
END SUB
'===============================================================================
' Initialise OpenGL
'===============================================================================
sub InitOGL()
pfd.cColorBits = 32
pfd.cDepthBits = 32
pfd.dwFlags = PFD_SUPPORT_OPENGL + PFD_DOUBLEBUFFER
IF W_FULLSCREEN=1 THEN hDC = GetDC(CreateWindow( "Edit", "BLAH!", WS_POPUP+WS_VISIBLE+WS_MAXIMIZE, 0 , 0 , 0 , 0, 0, 0, 0, 0))
IF W_FULLSCREEN<>1 THEN hDC = GetDC(CreateWindow("Edit", "BLAH!", WS_POPUP+WS_VISIBLE+WS_BORDER,W_XO, W_YO, W_XW , W_YH, 0, 0, 0, 0))
SetPixelFormat ( hDC, ChoosePixelFormat ( hDC, @pfd) , @pfd )
wglMakeCurrent ( hDC, wglCreateContext(hDC) )
ShowCursor(FALSE)
GLVIEWPORT 0, 0, W_XW, W_YH '' Reset The Current Viewport
GLMATRIXMODE GL_PROJECTION '' Select The Projection Matrix
GLLOADIDENTITY
GLUPERSPECTIVE 90.0, W_XW / W_YH, 0.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.0, 0.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
GLHINT(GL_FOG_HINT,GL_NICEST)
GLFOGF(GL_FOG_DENSITY,0.05)
GLFOGF(GL_FOG_START, 13.0)
GLFOGF(GL_FOG_END, 15.0)
GLFOGI(GL_FOG_MODE,GL_EXP2)
GLENABLE (GL_FOG)
end sub