gunship demo - Dr_Davenstein - 12-10-2005
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
gunship demo - syn9 - 12-10-2005
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
gunship demo - Dr_Davenstein - 12-10-2005
You don't always need to clear the depth buffer, but I do anyway so i don't forget.
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
gunship demo - syn9 - 12-10-2005
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
so whats the program you used? - hardeep - 12-14-2005
hey syn9 nice shiP! i was askin what is the program you used for the ship? plz tell me or another 3d program !!
Re: so whats the program you used? - Z!re - 12-14-2005
Quote:hey syn9 nice shiP! i was askin what is the program you used for the ship? plz tell me or another 3d program !!
Your translation program is no good..
Re: so whats the program you used? - hardeep - 12-14-2005
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 !!
Your translation program is no good.. wth i was askin for the source of the ship the damn 3d program he used !1! :x
gunship demo - syn9 - 12-14-2005
hehehehe, i use blender, thanks
Re: so whats the program you used? - na_th_an - 12-14-2005
Quote:[...] !1! :x
I think this guy wants '1' program. But just 1, he used two exclamation marks around that 1.
!1!.
:wink:
Re: so whats the program you used? - KiZ - 12-15-2005
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
|