Hi Charles,
No Fog here!
include "sw.inc"
include "swgl.inc"
Declare glFogfv Lib "opengl32.dll" (int pname, single *params)
hwnd = Window 640,480,1
hdc = InitGL (hwnd)
'GL_FOG_COORD_SRC
sub Triangle
============
glBegin GL_TRIANGLES
glColor3f 1.0, 0.0, 0.0 : glVertex3f 0.0, 1.0, 0.0
glColor3f 0.0, 1.0, 0.0 : glVertex3f -1.0, -1.0, 0.0
glColor3f 0.0, 0.0, 1.0 : glVertex3f 1.0, -1.0, 0.0
glEnd
end sub
sub scene
static single s1,s2,s3,s4,ang1,angi1=1,ra,ri
'
glLoadIdentity
glClear GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
glEnable GL_DEPTH_TEST
'
float fcolor[4]={.5, .5, .7, .99}
glfogf GL_LINEAR, 0
glfogf GL_FOG_DENSITY,0.1
glfogfv GL_FOG_COLOR, fcolor
glfogf GL_FOG_INDEX, 0
glfogf GL_FOG_START, -1.0
glfogf GL_FOG_END, -100.0
glEnable GL_FOG
'
glPushMatrix
gltranslatef 6.0, 0.0, -1.0
glrotatef ang1,0,1,0
Triangle
glPopMatrix
'
glPushMatrix
gltranslatef 2.0, 0.0, -1.0
glrotatef ang1,0,1,0
Triangle
glPopMatrix
'
glPushMatrix
gltranslatef 0.0, 0.0, -1.0
glrotatef ang1,0,1,0
Triangle
glPopMatrix
'
ang1 += angi1
if ang1>360 then ang1-=360
end sub
glClearColor 0.5, 0.5, 0.7, 0
while Key(27)=0
scene
DoEvents
SwapBuffers hdc
SetFps (60)
wend
QuitGL
CloseWindow
X