January 17, 2020, 11:01:21 PM

Author Topic: Pure Basic Having a problem with 3D  (Read 266 times)

Offline Pfaber11

  • Sr. Member
  • ****
  • Posts: 470
  • Bonjour
    • FABERSGAMES
Pure Basic Having a problem with 3D
« on: October 16, 2019, 12:11:45 PM »
Well this is where I'm at I just can't see where I'm going wrong . It gets stuck at create material saying texture not initialised anybody know what would cause this .
Code: [Select]
InitEngine3D()
InitKeyboard()

InitSprite()
OpenWindow(0, 0,0,1366,768,"")
OpenWindowedScreen(WindowID(0),0,0,1366,768)

Add3DArchive(#PB_Compiler_Home + "C:/Documents/AGKProjects/fantasy flight simulator/media", #PB_3DArchive_FileSystem)
Debug LoadMesh(1,"paulstree.mesh")
Debug LoadTexture(1,"paulstree.png")

Debug CreateMaterial(1,TextureID(1))
Debug CreateEntity(2, MeshID(1), MaterialID(1),  60, 0, 0)

CreateCamera(0, 50,50, 100,10)

begin:
WindowEvent3D()
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Return)
  End
EndIf
RotateCamera(0,10,0,0)
;RotateEntity(2,0,1,0)
RenderWorld()
FlipBuffers()

Goto begin
Celeron N3060 1.6 ghz duel core  4 Gb ram 32 gig storage  HD400 Graphics 160 gig external hard drive....

Offline Naughty Alien

  • Hero Member
  • *****
  • Posts: 676
Re: Pure Basic Having a problem with 3D
« Reply #1 on: October 16, 2019, 01:31:49 PM »
This is simple way to create your 3D scene, so from there build it up..

Code: [Select]

 If InitEngine3D() And InitSprite() And InitKeyboard() ;INITIALIZE YOUR ENGINE
   
  OpenWindow(0,0,0,640,480,"3D Window",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
  OpenWindowedScreen(WindowID(0),0,0,640,480,0,0,0)
 
 ;LOAD YOUR MODELS, TEXTURE, CAMERA ETC HERE
   
   camera=CreateCamera(0, 0, 0, 100, 100)
   
 
    Repeat                                      ;HERE YOUR MAIN GAME LOOP STARTS
      ExamineKeyboard()
     
      Select WindowEvent()
        Case #PB_Event_CloseWindow
          Quit = #True
      EndSelect
     
     
      RenderWorld()
      FlipBuffers()
    Until KeyboardPushed(#PB_Key_Escape) Or Quit ;HERE YOUR MAIN GAME LOOP ENDS
Else
  MessageRequester("Error", "Cant init 3D Engine",0)
EndIf
 
End

Offline GaborD

  • Sr. Member
  • ****
  • Posts: 324
Re: Pure Basic Having a problem with 3D
« Reply #2 on: October 16, 2019, 03:30:12 PM »
Nicely simple, reminds me of the languages I like.

Offline Pfaber11

  • Sr. Member
  • ****
  • Posts: 470
  • Bonjour
    • FABERSGAMES
Re: Pure Basic Having a problem with 3D
« Reply #3 on: October 16, 2019, 05:29:31 PM »
Thanks guys got it sorted just a little oversight on my behalf .Had me stumped for 2 days but at least I won't make that mistake again . It was all to do with Add3Darchive. I bet loads of programmers have done the same . Anyway I'm off the start line now the next thing I'll be looking at is detecting collisions . I've been at this a week now and want to be up to where I was with AGK as soon as possible . The 3d stuff seems very similar , one calls them entity's and the other objects but they are not that much different . After this I guess It's got to be terrain and height maps for me .
     Today was the first time I'd used the debug feature and I must say it was very useful. As for the rest of today I think I've learnt enough for one day . There's still a lot to learn like changing the colour of the background or putting the sky in but I'll try and get that sorted tomorrow . No regrets so far for taking on PB really quite enjoying it although the last couple of days have been tough . Got a nice little modelling program for converting .obj files into Ogre .mesh files and the name of it is DeleD strange name but there you go and it works that's the main thing . Blender does pretty much the same but had to install an older version of blender as the new one does not work very well with plugins . 2.8 doesn't work but 2.6 does . Go figure . Anyway my moneys on DeleD for doing the conversion . It's simpler . Thanks for reading .
Celeron N3060 1.6 ghz duel core  4 Gb ram 32 gig storage  HD400 Graphics 160 gig external hard drive....