03-23-2005, 03:25 AM
Well. I make a little code that reads a txt named file.dat , file is a txt file like this:
-1.00000000 -1.00000000 1.00000000
-1.00000000 1.00000000 1.00000000
1.00000000 1.00000000 1.00000000
1.00000000 -1.00000000 1.00000000
-1.00000000 -1.00000000 -1.00000000
-1.00000000 1.00000000 -1.00000000
1.00000000 1.00000000 -1.00000000
1.00000000 -1.00000000 -1.00000000
The code reads the numbers and paint in the screen the points. This code works ok:
This code works ok, but when I do this bucle:
the only change I made is the do loop bucle.
All goes wrong...any help...thanks.
-1.00000000 -1.00000000 1.00000000
-1.00000000 1.00000000 1.00000000
1.00000000 1.00000000 1.00000000
1.00000000 -1.00000000 1.00000000
-1.00000000 -1.00000000 -1.00000000
-1.00000000 1.00000000 -1.00000000
1.00000000 1.00000000 -1.00000000
1.00000000 -1.00000000 -1.00000000
The code reads the numbers and paint in the screen the points. This code works ok:
Code:
option explicit
'$include: 'GL/gl.bi'
'$include: 'GL/glu.bi'
dim rtri as single, rquad as single
dim x as single, y as single, z as single, n as single
screen 18, 32, , 2
glViewport 0, 0, 640, 480 ' tamaño de la pantalla, hacer tambien elegible
glMatrixMode GL_PROJECTION
glLoadIdentity
gluPerspective 45.0, 640.0/480.0, 0.1, 100.0
glMatrixMode GL_MODELVIEW
glLoadIdentity
glShadeModel GL_flat
glClearColor 0.0, 0.0, 0.0, 1.0
glClearDepth 1.0
glEnable GL_DEPTH_TEST
glDepthFunc GL_LEQUAL
glHint GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST
glClear GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
glLoadIdentity
glTranslatef 0, 0.0, -6.0
glpointsize(3)
For n= 1 to 8 'numero de vertices (el 8)
OPEN "file.dat" FOR INPUT AS #1
INPUT #1, x ,y ,z
glBegin GL_points
glColor3f 1.0, 1, 1
glVertex3f x, y, z
glEnd
next
CLOSE #1
flip
do
loop while inkey$ = ""
This code works ok, but when I do this bucle:
Code:
option explicit
'$include: 'GL/gl.bi'
'$include: 'GL/glu.bi'
dim rtri as single, rquad as single
dim x as single, y as single, z as single, n as single
screen 18, 32, , 2
glViewport 0, 0, 640, 480 ' tamaño de la pantalla, hacer tambien elegible
glMatrixMode GL_PROJECTION
glLoadIdentity
gluPerspective 45.0, 640.0/480.0, 0.1, 100.0
glMatrixMode GL_MODELVIEW
glLoadIdentity
glShadeModel GL_flat
glClearColor 0.0, 0.0, 0.0, 1.0
glClearDepth 1.0
glEnable GL_DEPTH_TEST
glDepthFunc GL_LEQUAL
glHint GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST
do
glClear GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
glLoadIdentity
glTranslatef 0, 0.0, -6.0
glpointsize(3)
For n= 1 to 8 'numero de vertices (el 8)
OPEN "file.dat" FOR INPUT AS #1
INPUT #1, x ,y ,z
glBegin GL_points
glColor3f 1.0, 1, 1
glVertex3f x, y, z
glEnd
next
CLOSE #1
flip
loop while inkey$ = ""
the only change I made is the do loop bucle.
All goes wrong...any help...thanks.