Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
gunship demo
#21
Weird... :???:

Can you see this?

Code:
Option Explicit
'$Static
#INCLUDE "\gl\gl.bi"
#INCLUDE "\gl\glu.bi"
#INCLUDE "\gl\glfw.bi"
#INCLUDE "\gl\glext.bi"


Type DisplayType
    W as UINTEGER
    H as UINTEGER
    R_BITS as UINTEGER
    G_BITS as UINTEGER
    B_BITS as UINTEGER
    A_BITS as UINTEGER
    D_BITS as UINTEGER
    S_BITS as UINTEGER
    MODE as UINTEGER
    GlVer as zString ptr
    As Single FOVy, Aspect, zNear, zFar
End Type


Declare Sub Init_GL_Window( Display As DisplayType )

Dim Display as DisplayType, Ang As Integer
Init_GL_Window Display



Do
    
    GlClear GL_COLOR_BUFFER_BIT OR GL_DEPTH_BUFFER_BIT

    
    GlMatrixMode GL_MODELVIEW
    GlLoadIdentity
    GlPushMatrix
    
    
       GlTranslateF 0, 0, -5
       GlRotateF Ang, 0, 1, 0
       Ang+=1
          
            glBegin GL_TRIANGLES
            GlColor3F 1,0,0
            glTexCoord2F -1,1
            glVertex3F -1, 1, 0
            
            GlColor3F 0,1,0
            glTexCoord2F -1,-1
            glVertex3F -1, -1, 0
            
            GlColor3F 0,0,1
            glTexCoord2F 1,-1
            glVertex3F 1, -1, 0
            GlEnd
    GlPopMatrix
    

GlfwSwapBuffers
Loop Until glfwGetKey( GLFW_KEY_ESC )



GlfwTerminate()





Sub Init_GL_Window( Display As DisplayType )
    Display.W     = 640
    Display.H     = 480
    Display.R_BITS= 8
    Display.G_BITS= 8
    Display.B_BITS= 8
    Display.A_BITS= 8
    Display.D_BITS= 24
    Display.S_BITS= 8
    Display.MODE  = GLFW_FULLSCREEN
    
    If glfwInit() Then
        'Successful!
    ELSE    
        Print "Failed to initialize GLFW!"
        Sleep 1000
        End
    End If
    
    
    If  glfwOpenWindow( _
        Display.W     , _
        Display.H     , _
        Display.R_BITS, _
        Display.G_BITS, _
        Display.B_BITS, _
        Display.A_BITS, _
        Display.D_BITS, _
        Display.S_BITS, _
        Display.MODE  ) _
    Then
        GlfwSwapInterval 1
        Display.GlVer = glGetString(GL_VERSION)
    ELSE
        GlfwTerminate()
        End
    End If
    
    glViewport 0, 0, Display.W, Display.H
    glMatrixMode GL_PROJECTION        
    glLoadIdentity    
    Display.FOVy = 45.0
    Display.Aspect = Display.W / Display.H
    Display.znear = 1
    Display.zfar = 110
    gluPerspective Display.FOVy, Display.Aspect, Display.zNear, Display.zFar
    
    glShadeModel GL_SMOOTH
    glClearColor 0.0, 0.0, 0.0, 0.0
    glClearDepth 1.0
    glEnable GL_DEPTH_TEST
    glDepthFunc GL_LEQUAL  
    glEnable GL_COLOR_MATERIAL
    glHint GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST
    glPolygonMode GL_FRONT, GL_FILL
    glEnable GL_CULL_FACE
End Sub
Reply
#22
that worked... hrm... i wonder why i'm having a problem with mine...

Code:
'$include: 'gl/gl.bi'
'$include: 'gl/glu.bi'
'$include: 'gl/glfw.bi'

if glfwInit <> GL_TRUE then
    print "could not init"
    end 1
end if


if glfwOpenWindow(640, 480, 8, 8, 8, 8, 24, 8, GLFW_WINDOW) <> GL_TRUE then
    print "could not open window"
    glfwTerminate
    end 1
end if


do
    glClear GL_CLEAR_BUFFER_BIT
    
    glBegin GL_LINES
        glVertex2f 0,0
        glVertex2f 1,1
    glEnd
    
    glFlush
    
    glfwSwapBuffers
        
    if glfwGetKey(GLFW_KEY_ESC) or glfwGetWindowParam(GLFW_OPENED) = 0 then exit do
    
loop


glfwTerminate

this code works fine when windowed, but not when fullscreen. also, my city demo works fine when windowed but doesnt display anything if you set it to full screen
Reply
#23
You don't always need to clear the depth buffer, but I do anyway so i don't forget. Tongue

Code:
'$include: 'gl/gl.bi'
'$include: 'gl/glu.bi'
'$include: 'gl/glfw.bi'

if glfwInit <> GL_TRUE then
    print "could not init"
    end 1
end if


if glfwOpenWindow(640, 480, 8, 8, 8, 8, 24, 8, GLFW_Fullscreen) <> GL_TRUE then
    print "could not open window"
    glfwTerminate
    end 1
end if

glViewport 0, 0, 640, 480


do
    glClear GL_COLOR_BUFFER_BIT OR GL_DEPTH_BUFFER_BIT
    
    
    glBegin GL_LINES
        glVertex2f 0,0
        glVertex2f 1,1
    glEnd
    
    glFlush
    
    glfwSwapBuffers
        
    if glfwGetKey(GLFW_KEY_ESC) or glfwGetWindowParam(GLFW_OPENED) = 0 then exit do
    
loop


glfwTerminate
Reply
#24
aha!

Code:
glViewport 0, 0, 640, 480

i havent been using this... and thats why it never works when i goto fullscreen. thanks!

btw, what do you use for mouse/keyboard input when using glfw? the normal fb commands?

edit: nm, i answered my own question, glfw has input routines, heh, and no, i havent tried shadowing my ship yet, i'm really new to opengl and havent ventured off into that territory yet, heh

edit2: dr_d, i used something like the flash code you wrote above and it worked quite well, making the flash hide for as long as it is displayed, and at each interval just resetting the flash variable to its inverse. thanks!

Code:
ticks = SDL_GetTicks
if waitflash <= ticks then
    firing = 1 - firing
    waitflash = ticks + 24
end if
if firing then glEnable GL_LIGHT2
Reply
#25
hey syn9 nice shiP! i was askin what is the program you used for the ship? plz tell me or another 3d program Sad !!
aRdEeP
Reply
#26
Quote:hey syn9 nice shiP! i was askin what is the program you used for the ship? plz tell me or another 3d program Sad !!
Your translation program is no good..
Reply
#27
Quote:
hardeep Wrote:hey syn9 nice shiP! i was askin what is the program you used for the ship? plz tell me or another 3d program Sad !!
Your translation program is no good..
wth i was askin for the source of the ship the damn 3d program he used !1! :x
aRdEeP
Reply
#28
hehehehe, i use blender, thanks
Reply
#29
Quote:[...] !1! :x

I think this guy wants '1' program. But just 1, he used two exclamation marks around that 1.

!1!.

:wink:
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#30
Quote:
hardeep Wrote:[...] !1! :x

I think this guy wants '1' program. But just 1, he used two exclamation marks around that 1.

!1!.

:wink:

Maybe it's spanish and he cant find the inverted ! button... :P :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)