Global cube:mesh
'Blitz OpenGL Cell Shading system (FALLEN GL)
'By: William McCollom (fbepyon)
'Email: fbepyon@...
Type mesh
Global totalmesh
Global cubelst:TList
Field id:Int
Field x:Float,y:Float,z:Float
Field scale:Float
Method UpdateCube()
glLoadIdentity()
glTranslatef( cube.x, cube.y, cube.z ) 'Move Right And Into The Screen
'BUILDING THE CUBE
glBegin GL_TRIANGLES
glColor3f 255.0,255.0,255.0
glVertex3f( 0, cube.scale, 0 )
glVertex3f( -cube.scale, -cube.scale, 0 )
glVertex3f( cube.scale, -cube.scale, 0 )
glEnd
End Method
Function CreateCube( x:Float, y:Float, z:Float, scale:Int, Quad:Int=-1 )
If cubelst = Null Then cubelst = CreateList() ' If a list isn't there make a new one
cube:mesh = New mesh
ListAddLast(cubelst,cube:mesh)
cube.x = x
cube.y = y
cube.z = z
cube.scale = scale
cube.id = totalmesh + 1
Return id
End Function
End Type
Function IntiGL( screenw:Int, screenh:Int, screend:Int, buffer:Int = BGL_BACKBUFFER|BGL_DEPTHBUFFER )
bglCreateContext(screenw,screenh,screend,0,buffer) ' Create OpenGl Window
glShadeModel(GL_SMOOTH) 'Enable Smooth Shading. (blends colors nicely across a polygon, and smoothes out lighting.)
glClearColor(0.0,0.0,0.0,0.0) 'Set buffer clear color.
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST) 'Very Nice perspective calculations
glFrontFace(GL_CW)
'DEPTH BUFFER
glClearDepth(1.0) 'Depth Buffer Setup
glEnable(GL_DEPTH_TEST) 'Enable Depth Testing
glDepthFunc(GL_LEQUAL) 'The Type of Depth to Test To....?
'OpenGL Screen Setup
glViewPort(0,0,screenw,screenh) 'Setup Current Viewport
glMatrixMode(GL_PROJECTION) 'Select the Porjection Mode
glLoadIdentity() 'Reset Projection Matrix
gluPerspective(45.0,Float(ScreenWidth)/Float(ScreenHeight),1.0,100.0)
glMatrixMode(GL_MODELVIEW) 'Select The Modelview Matrix
glLoadIdentity() 'Reset Projection Matrix
End Function
Function UpdateGL()
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
cube.UpdateCube()
Print cube.id
End Function
I can't figure out why this code isn't work correctly its not show the triangle I made....
|