cheers jim i got it going this afternoon this is just a nehe example modifyed to work with hand made matrixes when i get some time ill put object rotations and scaling in the matrixes and add a camera also ill have to clean the code up a bit
''
'' This Code Was Created By Jeff Molofee 2000
'' A HUGE Thanks To Fredric Echols For Cleaning Up
'' And Optimizing The Base Code, Making It More Flexible!
'' If You've Found This Code Useful, Please Let Me Know.
'' Visit My Site At nehe.gamedev.net
option explicit
#include once "GL/gl.bi"
#include once "GL/glu.bi"
dim shared as single rtri , rquad
screen 18, 16, , 2
glViewport 0, 0, 640, 480
glMatrixMode GL_PROJECTION
glLoadIdentity
gluPerspective 45.0, 640.0/480.0, 0.1, 100.0
glMatrixMode GL_MODELVIEW
glLoadIdentity
glShadeModel GL_SMOOTH
glClearColor 0.0, 0.0, 0.0, 0.5
glClearDepth 1.0
glEnable GL_DEPTH_TEST
glDepthFunc GL_LEQUAL
glHint GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST
dim shared as double pirmatrix(0 to 3,0 to 3)
dim shared as double boxmatrix(0 to 3,0 to 3)
declare sub draw_piramid( byval matrix as double ptr )
declare sub draw_box( byval matrix as double ptr )
declare sub loadentityidentity( matrix as double ptr )
declare sub positionentity( matrix as double ptr , byval xpos as double , byval ypos as double , byval zpos as double )
loadentityidentity( @pirmatrix(0,0) )
loadentityidentity( @boxmatrix(0,0) )
positionentity( @pirmatrix(0,0) , -4.0 , 0 , -16.0 )
positionentity( @boxmatrix(0,0) , 1.0 , 0 , -5.0 )
do
glClear GL_COLOR_BUFFER_BIT OR GL_DEPTH_BUFFER_BIT
glLoadIdentity
draw_piramid( @pirmatrix(0,0) )
draw_box( @boxmatrix(0,0) )
flip
loop while inkey$ = ""
sub loadentityidentity( matrix as double ptr )
matrix[0] = 1
matrix[5] = 1
matrix[10] = 1
matrix[15] = 1
end sub
sub positionentity( matrix as double ptr , byval xpos as double , byval ypos as double , byval zpos as double )
matrix[12] = xpos
matrix[13] = ypos
matrix[14] = zpos
end sub
sub draw_piramid( byval matrix as double ptr )
rtri = rtri + 0.2
glpushmatrix
glmultmatrixd( matrix )
glRotatef rtri, 0.0, 1.0, 0.0
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, 1.0
glColor3f 0.0, 0.0, 1.0
glVertex3f 1.0, -1.0, 1.0
glColor3f 1.0, 0.0, 0.0
glVertex3f 0.0, 1.0, 0.0
glColor3f 0.0, 0.0, 1.0
glVertex3f 1.0, -1.0, 1.0
glColor3f 0.0, 1.0, 0.0
glVertex3f 1.0, -1.0, -1.0
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, -1.0
glColor3f 0.0, 0.0, 1.0
glVertex3f -1.0, -1.0, -1.0
glColor3f 1.0, 0.0, 0.0
glVertex3f 0.0, 1.0, 0.0
glColor3f 0.0, 0.0, 1.0
glVertex3f -1.0, -1.0, -1.0
glColor3f 0.0, 1.0, 0.0
glVertex3f -1.0, -1.0, 1.0
glEnd
glpopmatrix
end sub
sub draw_box( byval matrix as double ptr )
rquad = rquad -0.15
glpushmatrix
glmultmatrixd( matrix )
glRotatef rquad,1.0, 1.0, 1.0
glBegin GL_QUADS
glColor3f 0.0, 1.0, 0.0
glVertex3f 1.0, 1.0, -1.0
glVertex3f -1.0, 1.0, -1.0
glVertex3f -1.0, 1.0, 1.0
glVertex3f 1.0, 1.0, 1.0
glColor3f 1.0, 0.5, 0.0
glVertex3f 1.0, -1.0, 1.0
glVertex3f -1.0, -1.0, 1.0
glVertex3f -1.0, -1.0, -1.0
glVertex3f 1.0, -1.0, -1.0
glColor3f 1.0, 0.0, 0.0
glVertex3f 1.0, 1.0, 1.0
glVertex3f -1.0, 1.0, 1.0
glVertex3f -1.0, -1.0, 1.0
glVertex3f 1.0, -1.0, 1.0
glColor3f 1.0, 1.0, 0.0
glVertex3f 1.0, -1.0, -1.0
glVertex3f -1.0, -1.0, -1.0
glVertex3f -1.0, 1.0, -1.0
glVertex3f 1.0, 1.0, -1.0
glColor3f 0.0, 0.0, 1.0
glVertex3f -1.0, 1.0, 1.0
glVertex3f -1.0, 1.0, -1.0
glVertex3f -1.0, -1.0, -1.0
glVertex3f -1.0, -1.0, 1.0
glColor3f 1.0, 0.0, 1.0
glVertex3f 1.0, 1.0, -1.0
glVertex3f 1.0, 1.0, 1.0
glVertex3f 1.0, -1.0, 1.0
glVertex3f 1.0, -1.0, -1.0
glEnd
glpopmatrix
end sub