Ok, i editted my post here. I got some things working, even though i don't exactly know why certain things occur as they do. I'm just moving along, hoping i'll find them out later on.
Anyway: i'm trying to figure out how to have my quads get opacity. i read tutorials, examples but can't find out why i don't get any results in that direction.
i used
glEnable(GL_BLEND)
glColor4f(1.0,0,0,0.21)
glBlendFunc (GL_SRC_ALPHA, L_ONE_MINUS_SRC_ALPHA)
Is there more i should take care of before any alpha on my quads will work?
(apologies for the bad title - can't seem to fix that anymore)
Anyway: i'm trying to figure out how to have my quads get opacity. i read tutorials, examples but can't find out why i don't get any results in that direction.
i used
glEnable(GL_BLEND)
glColor4f(1.0,0,0,0.21)
glBlendFunc (GL_SRC_ALPHA, L_ONE_MINUS_SRC_ALPHA)
Is there more i should take care of before any alpha on my quads will work?
(apologies for the bad title - can't seem to fix that anymore)
Global ScreenWidth:Int=800 Global ScreenHeight:Int=600 Global ScreenDepth:Int=16 GLGraphics ScreenWidth,ScreenHeight init() Global pos_x# = 0 Global pos_y# = 0 Global pos_z# = 0 Global objectList:TList=CreateList() createCubes(10) While Not KeyHit( KEY_ESCAPE ) glClear GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT glLoadIdentity checkKeys() ' eigen positie xtrans# = -pos_x# ytrans# = -pos_y# ztrans# = -pos_z# glTranslatef xtrans#, ytrans#, ztrans# For current_cube:cube = EachIn objectList px# = current_cube.posX# py# = current_cube.posY# pz# = current_cube.posZ# rx# = current_cube.rotX# ry# = current_cube.rotY# rz# = current_cube.rotZ# glPushMatrix() glTranslatef px#,py#,pz# glRotatef rx#,1,0,0 drawCube(0.5) glPopMatrix() current_cube.rotX# = current_cube.rotX# + 4 Next Flip Wend Function init() glClearColor(0.9, 0.9, 0.9, 0.0) ' glClearDepth 1.0 ' glDepthFunc(GL_LESS) ' glDisable(GL_DEPTH_TEST) glEnable(GL_BLEND) ' glShadeModel(GL_SMOOTH) glViewport(0,0,ScreenWidth,ScreenHeight) glMatrixMode(GL_PROJECTION) glLoadIdentity() gluPerspective(45.0,Float(ScreenWidth)/Float(ScreenHeight),1.0,100.0) glMatrixMode(GL_MODELVIEW) End Function Function checkKeys() speed# = .1 ' MOVEMENT If KeyDown (KEY_UP) pos_z# = pos_z# - speed# End If If KeyDown (KEY_DOWN) pos_z# = pos_z# + speed# End If If KeyDown (KEY_LEFT) pos_x# = pos_x# - speed# End If If KeyDown (KEY_RIGHT) pos_x# = pos_x# + speed# End If If KeyDown (KEY_Q) pos_y# = pos_y# + speed# End If If KeyDown (KEY_A) pos_y# = pos_y# - speed# End If 'DebugLog (pos_x#+" "+pos_y#+" "+pos_z#) End Function Function drawCube(size#) glBegin GL_QUADS halve# = size# / 2.0 glColor4f(1.0,0,0,0.21) glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) 'achterkant glVertex3f -halve#, halve#, -halve# 'Top Left glVertex3f halve#, halve#, -halve# 'Top Right glVertex3f halve#,-halve#, -halve# 'Bottom Right glVertex3f -halve#,-halve#, -halve# 'Bottom Left 'voorkant glVertex3f -halve#, halve#, halve# 'Top Left glVertex3f halve#, halve#, halve# 'Top Right glVertex3f halve#,-halve#, halve# 'Bottom Right glVertex3f -halve#,-halve#, halve# 'Bottom Left 'linkerkant glVertex3f -halve#, halve#, halve# 'Top Left glVertex3f -halve#,-halve#, halve# glVertex3f -halve#,-halve#, -halve# 'Bottom Left glVertex3f -halve#, halve#, -halve# 'Bottom Right 'rechterkant glVertex3f halve#, halve#, halve# 'Top Left glVertex3f halve#,-halve#, halve# glVertex3f halve#,-halve#, -halve# 'Bottom Left glVertex3f halve#, halve#, -halve# 'Bottom Right 'onderkant glVertex3f -halve#,-halve#, halve# 'Top Left glVertex3f -halve#,-halve#, -halve# glVertex3f halve#,-halve#, -halve# 'Bottom Left glVertex3f halve#,-halve#, halve# 'Bottom Right 'bovenkant glVertex3f -halve#,halve#, halve# 'Top Left glVertex3f -halve#,halve#, -halve# glVertex3f halve#,halve#, -halve# 'Bottom Left glVertex3f halve#,halve#, halve# 'Bottom Right glEnd End Function Function createCubes(num%) For n=1 To num% div# = .5 obj:cube = New cube ' obj.posX# = Rnd(-div#,div#) ' obj.posY# = Rnd(0,div#) ' obj.posZ# = Rnd(-div#,0) obj.posX# = n obj.posY# = 0 obj.posZ# = -6 obj.rotX# = 0.4 obj.rotY# = 0.0 obj.rotZ# = 0.0 ListAddLast objectList, obj DebugLog CountList(objectList) Next End Function Type cube Field posX# Field posY# Field posZ# Field rotX# Field rotY# Field rotZ# End Type