|
Post by smc44 on Feb 24, 2008 14:53:17 GMT -5
i also make many 3d models and am descent at it i use 3dsmax
|
|
|
Post by wallbreak on Feb 25, 2008 14:36:37 GMT -5
Well thanks to being able to have subs and functions in basic4gl, someone can just come up with a sub to load up a 3d object.
Or better yet, an OpenGL manager.
|
|
|
Post by Tom Mulgrew on Feb 26, 2008 1:15:32 GMT -5
also could u help me produce a game tom mulgrew im new im only 14 but i really want to make a video game if u have time can u help me learn basic4GL language i also have a story for a game and am ready to make one i need somone like u to help me actually make a game if u have time thanx Hi, I'm afraid I'm already pretty busy. You might be able to find someone else in the forum to team up with though.. (I'll happily answer questions though). -Tom
|
|
|
Post by smc44 on Feb 26, 2008 19:32:19 GMT -5
that is ok if ur busy lol didnt hurt to ask but i have a question the question is this can u help me place a model in my game where the box that is yellow is here is what i have for my game so far
' Data dim camX#, camY#, camZ#, camAng# ' Camera position and direction dim x, z ,y ' Working variables camX# = 135 camZ# = 50 camy# = 15
while true
' Clear screen glClear (GL_DEPTH_BUFFER_BIT or GL_COLOR_BUFFER_BIT) glLoadIdentity ()
' Position camera glRotatef (-camAng#, 0, 1, 0) glTranslatef (-camX#, -camY#, -camZ#) glTranslatef(0,-10,6)
glBegin(Gl_quads) glcolor3f(1,0,0) glVertex3f(-100,-10,-100) glVertex3f( 100,-10,-100) glVertex3f( 100, 10,-100) glVertex3f(-100, 10,-100) glcolor3f(0,1,0) glVertex3f(-100,-10,-100) glVertex3f(-100,-10, 100) glVertex3f(-100, 10, 100) glVertex3f(-100, 10,-100) glcolor3f(0,0,1) glVertex3f( 100,-10, 100) glVertex3f( 100,-10,-100) glVertex3f( 100, 10,-100) glVertex3f( 100, 10, 100) glcolor3f(1,1,0) glVertex3f(-100,-10,-100) glVertex3f( 100,-10,-100) glVertex3f( 100,-10, 100) glVertex3f(-100,-10, 100) glcolor3f(0,1,1) glVertex3f(-100,-10, 100) glVertex3f( 100,-10, 100) glVertex3f( 100, 10, 100) glVertex3f(-100, 10, 100) glColor3f(1,1,1) glVertex3f(-100, 10, 100) glVertex3f(-100, 10,-100) glVertex3f( 100, 10,-100) glVertex3f( 100, 10, 100)
glend() glLoadIdentity() glTranslatef(4.7,-2,-6) glBegin(Gl_quads) glcolor3f(1,1,0) glVertex3f(-1,-1,-2) glVertex3f( 2,-1,-2) glVertex3f( 2, 1,-2) glVertex3f(-1, 1,-2) glcolor3f(1,1,0) glVertex3f(-1,-1,-2) glVertex3f(-1,-1, 1) glVertex3f(-1, 1, 1) glVertex3f(-1, 1,-2) glcolor3f(1,1,0) glVertex3f( 2,-1, 1) glVertex3f( 2,-1,-2) glVertex3f( 2, 1,-2) glVertex3f( 2, 1, 1) glcolor3f(1,1,0) glVertex3f(-1,-1,-2) glVertex3f( 2,-1,-2) glVertex3f( 2,-1, 1) glVertex3f(-1,-1, 1) glcolor3f(1,1,0) glVertex3f(-1,-1, 1) glVertex3f( 2,-1, 1) glVertex3f( 2, 1, 1) glVertex3f(-1, 1, 1) glColor3f(0,1,0) glVertex3f(-1, 1, 1) glVertex3f(-1, 1,-2) glVertex3f( 2, 1,-2) glVertex3f( 2, 1, 1) glend() SwapBuffers()
' Move camera while SyncTimer (10) if ScanKeyDown (VK_LEFT) then camAng# = camAng# + 1: endif if ScanKeyDown (VK_RIGHT) then camAng# = camAng# - 1: endif if ScanKeyDown (VK_UP) then camX# = camX# - sind (camAng#) * .5 camZ# = camZ# - cosd (camAng#) * .5 endif if ScanKeyDown (VK_DOWN) then camX# = camX# + sind (camAng#) * .5 camZ# = camZ# + cosd (camAng#) * .5
endif struc BGM_Vertex dim v# (2) ' Vertex position dim t# (1) ' Texture coordinates endstruc
struc BGM_PolyVertex dim vertexIndex, normIndex endstruc
struc BGM_Poly dim firstVertex, vertexCount endstruc
struc BGM_Model dim vertexCount, BGM_Vertex &vertex() dim normCount, &norm#()() dim polyVertexCount, BGM_PolyVertex &polyVertex() dim polyCount, BGM_Poly &poly() dim scale# dim displayList endstruc
' Working dim BGM_Model &model, BGM_Poly &poly, BGM_PolyVertex &polyVertex, BGM_Vertex &vertex dim dir$, fileName$, file, i, i2
goto Start
LoadBGM: file = OpenFileRead (dir$ + fileName$) if FileError () <> "" then print FileError (): end: endif
alloc model model.scale# = 1
' Vertices model.vertexCount = ReadInt (file) alloc model.vertex, model.vertexCount for i = 0 to model.vertexCount - 1 for i2=0 to 2: model.vertex (i).v#(i2)=ReadFloat (file): next for i2=0 to 1: model.vertex (i).t#(i2)=ReadFloat (file): next next
' Normals model.normCount = ReadInt (file) alloc model.norm#, model.normCount, 2 for i = 0 to model.normCount - 1 for i2=0 to 2: model.norm# (i)(i2)=ReadFloat (file): next next
' Poly vertices model.polyVertexCount = ReadInt (file) alloc model.polyVertex, model.polyVertexCount for i = 0 to model.polyVertexCount - 1 model.polyVertex (i).vertexIndex = ReadInt (file) model.polyVertex (i).normIndex = ReadInt (file) next
' Polygons model.polyCount = ReadInt (file) alloc model.poly, model.polyCount for i = 0 to model.polyCount - 1 model.poly (i).firstVertex = ReadInt (file) model.poly (i).vertexCount = ReadInt (file) next CloseFile (file) return
DrawBGM:
' Draw model glPushMatrix () glScalef (model.scale#, model.scale#, model.scale#) if model.displayList <> 0 then ' If a display list exists, use it glCallList (model.displayList) else
' Otherwise, create a display list, and render the model into it model.displayList = glGenLists (1) glNewList (model.displayList, GL_COMPILE_AND_EXECUTE)
for i = 0 to model.polyCount - 1 &poly = &model.poly (i) glBegin (GL_TRIANGLE_FAN) for i2 = 0 to poly.vertexCount - 1 &polyVertex = &model.polyVertex (poly.firstVertex + i2) &vertex = &model.vertex (polyVertex.vertexIndex) glNormal3fv (model.norm# (polyVertex.normIndex)) glVertex3fv (vertex.v#) next glEnd () next glEndList () endif
glPopMatrix () return
Start: '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Allocate models dim BGM_Model &shipModel ' Load models dir$ = "\Users\Stumpy\Desktop\Project Peters(Content)\" ' Load ship model filename$ = "gun.BGM": gosub LoadBGM &shipModel = &model ' Enable OpenGL lighting so we can see the shape glEnable(GL_LIGHTING) glEnable(GL_LIGHT0) glEnable (GL_COLOR_MATERIAL) ' Animation loop dim ang# while true glClear(GL_DEPTH_BUFFER_BIT or GL_COLOR_BUFFER_BIT) glLoadIdentity() glTranslatef(0, 0, -4)
' Draw the model glColor3f(.5, .5, 1) &model = &shipModel: gosub DrawBGM SwapBuffers() while SyncTimer(10)
wend wend wend wend
|
|
|
Post by smc44 on Feb 26, 2008 19:36:14 GMT -5
if u try this code u will see one box in a flash then the screen will have a purlple thing and it is stuck u cant move ur camera so take one of ur models and pace it where i want it which is in place of that yellow box then can you give me the code back so i can put my model in it and it will be cool if u can do that thanks
|
|
|
Post by matthew on Feb 26, 2008 22:46:57 GMT -5
I've tried running your program but it needs the 'gun.BGM' file.
Can you upload it?
|
|
|
Post by smc44 on Feb 27, 2008 18:16:50 GMT -5
idk how to upload it on here
|
|
|
Post by smc44 on Feb 27, 2008 19:43:59 GMT -5
hey can somone tell me how to use the mouse to move ur view if u played halo 1 on the computer i mean to have the mouse used like that
|
|
|
Post by matthew on Feb 27, 2008 21:09:50 GMT -5
idk how to upload it on here Just upload it to a site like RapidShare & post the link they give you on the Basic4GL forum.
|
|
|
Post by matthew on Feb 28, 2008 1:44:08 GMT -5
The file that you uploaded was called gun.obj but in your code the file is called gun.bgm. So I changed the filename in the code to gun.obj but when I ran the program it generated an error saying that the vertexCount variable is too big. Your program didn't seem to be able to load the .obj file so I used the obj viewer that einlander wrote & I modified it a little. I was then able to get the gun displayed on the screen.
|
|
|
Post by smc44 on Feb 28, 2008 16:25:09 GMT -5
ty so much i just need to get that gun in a 3d perspective in my game and the code i gave u is the one where i wwant u to put thisa gun where the yellow box is once i get it there i can make some effects for it and stuff
|
|
zack8686
Posts a bit
gl-Home in wikispace
Posts: 207
|
Post by zack8686 on Jan 9, 2009 7:02:18 GMT -5
hi, can anyone please tell me that how to set for the 3d boundary for not going thru the 3d walls but just stand still in front of the wall ? and is it better to build 3d environment in tiles form , or manually inserting some lengthy commands?
|
|
zack8686
Posts a bit
gl-Home in wikispace
Posts: 207
|
Post by zack8686 on Jan 9, 2009 7:12:51 GMT -5
Can anyone please upload your game made using Basic4gl in .gb files as a reference ?? Maybe , it can help Basic4gl users (besides me) know more about the way in setting up a game. Many of the demo games are in .exe form ..... T.T
|
|