here's a rude openGL example for lines. the idea is however to generate stars coming from the deep. but I don't know why the starLines coming all from one point. perhaps anybody can help. thanks in advance.
'
'-- experimental openGL example for generating stars, 16.5.2013
'-- by frankolinox, version 1.0
'
includepath "$\inc\"
$ FileName "t.exe"
'include "RTL32.inc"
'include "RTL64.inc"
title="Lines & Stars.."
include "OpenglSceneFrame.inc"
type theStars
x as double
y as double
z as double
end type
%maxStars=500
dim stars(%MaxStars) as theStars
sys seed=0x12345678
function Randy(sys z1,z2) as sys
pushad
z1=z1/64
sys rnd
mov eax,z2
sub eax,z1
inc eax
imul edx,seed,0x8088405
inc edx
mov seed,edx
mul edx
add edx,z1
mov rnd,edx
popad
return rnd
end function
sub generateStars( sys index ) as long
stars(index).x = randy(-25, 25)
stars(index).y = randy(-25, 25)
stars(index).z = randy(-30, -60)
end sub
'-----------------------
sub Staros
'=======================
sys vv
for vv = 1 to %maxStars
generateStars(vv)
next
glLineWidth 3.0
glBegin GL_Lines
for vv = 1 to %maxStars
'glColor4ub randy(0, 255),randy(0, 255),randy(0, 255),randy(0,100)
glColor3f randy(0, 255),randy(0, 255),randy(0, 255)
glVertex3f stars(vv).x,stars(vv).y,stars(vv).z
glColor3f 0,0,0
glVertex3f stars(vv).x,stars(vv).y,stars(vv).z-5
stars(vv).z += 20
if stars(vv).z > 5 then generateStars(vv)
next
glEnd
end sub
sub initialize(sys hWnd)
'=======================
SetTimer hWnd,1,10,NULL
end sub
'
sub scene(sys hWnd)
'==================
'
static single s1,s2,s3,s4,ang1,angi1=1,ra,ri,i
'
glLoadIdentity
glClear GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
glClearColor 0.5, 0, 0, 0
'
'
glrotatef ang1, 0,0,1
gltranslatef 0,0,-1
'glscalef 0.001,0.001,0.001
glscalef 0.01,0.01,0.01
'
glLineWidth 1.5
'
ri=0
glBegin GL_LINE_LOOP
'for i=0 to 360 step 20
for i=0 to 360 step 10
'ra=rad(i)
'glVertex2f cos(ra)*(170+ri),sin(ra)*(170+ri)
'ri=30-ri
next
'------------------------------ //
staros() ' stars generatings
glEnd
'
'------------------------------ //
ang1+=angi1
if ang1>360 then ang1-=360
'
end sub
sub Release(sys hwnd)
'====================
killTimer hwnd, 1
end sub
best regards, frank
X