tiny oglengine

Spiele, Demos, Grafikzeug und anderes unterhaltendes.
xperience2003
Beiträge: 972
Registriert: 04.10.2004 18:42
Computerausstattung: Amiga, LinuxMint, Windows7
Wohnort: gotha
Kontaktdaten:

Beitrag von xperience2003 »

Code: Alles auswählen

OGL_CreateSreen(800,600)

OGL_CreateCamera()
OGL_SetClearcolor(0.2,0.2,0.4,1.0)

OGL_CreateFog(15,20,0.1)
OGL_SetFogColor(0.2,0.2,0.4,1.0)

Layer0 =OGL_TextureGen(128,155,12,$aa6600,1,1)
Layer2 =OGL_TextureGen(128,155,12,$0066ff,2,1)
Layer3 =OGL_TextureGen(128,35,12,$a0a0aa,2,1)
Layer1 =OGL_TextureGen(128,155,2,$aa66aa,2,1)
Layer5 =OGL_TextureGen(128,55,2,$a066ff,4,1)

OGL_PositionCamera(0.0,0.0,-10.0)

 OGL_Ambientlight(0.7,0.7,0.7)
 OGL_MaterialColor(0.9,0.9,0.9)
 
 OGL_SetDiffuseColor0(0.8,0.8,0.8) ;
 OGL_SetAmbientColor0(0.8,0.8,0.8)
 OGL_SetSpecularColor0(1.0,1.0,1.0)
 OGL_SetLightPosition0(3.0,2.0,2.0)

OGL_SpecularColor(1.0,1.0,1.0)  ;leutfarbe weis
OGL_Shininess(127)        ;shininess auf volle leistung ^^
OGL_LightEnable()          ;beleuchtung an

OGL_Build3D_Font(36,"Impact")

quadric.l=gluNewQuadric_()
gluQuadricTexture_(quadric.l,#GL_TRUE);
quadric2.l=gluNewQuadric_()
gluQuadricTexture_(quadric2.l,#GL_TRUE);
quadric3.l=gluNewQuadric_()
gluQuadricTexture_(quadric3.l,#GL_TRUE);
quadric4.l=gluNewQuadric_()
gluQuadricTexture_(quadric4.l,#GL_TRUE); 
 
OGL_Shademodel(#gl_smooth)
OGL_AlphaBlend()

OGL_InitSpheremap()
OGL_RenderHidden(0)

OGL_StartSpheremap()


Repeat
;-musiczeugs

OGL_ClearScreen()

   glLoadIdentity_() ; Reset Plotter    
   glTranslatef_(OGL_cos(rotator(0))*3, OGL_sin(rotator(0)), OGL_sin(rotator(0))*3); Move Plotter
   glRotatef_(rot.f, 0.0, 0.0, 1.0)
   glRotatef_(rot.f, 1.0, 0.0, 1.0)
  
   glBindTexture_(#GL_TEXTURE_2D, Layer2)  
   gluSphere__(quadric,1.0,16,16)
  .....
   ..bla bla

  glEnable_(#GL_TEXTURE_2D)
  glBindTexture_(#GL_TEXTURE_2D, Layer5)
  OGL_PrintGL_Text("P U R E")
  glTranslatef_(-2.0,-3.0,0) 
  OGL_PrintGL_Text("O P E N G L")

OGL_Flip()

Until Event = #WM_KEYDOWN And EventwParam() = #VK_ESCAPE 

....im moment bin ich dabe das "herzstück" zu coden
ein entitysystem mit texen positionen material etc.....wird aber
etwas dauern
amiga rulez...
Rebirth Software
Hellhound66
Beiträge: 476
Registriert: 23.03.2005 23:19

Beitrag von Hellhound66 »

jupp ich sehs...

Bei mir siehts so aus:

Code: Alles auswählen

*RES._RESFILE = BUF_LoadFile("RAK.RES")
CallFunctionFast(*RES\scanfile,*RES)

Init()
*EntityObject._ENTITY_OBJECT = CreateEntityBufferObject(SizeOf(_ENTITY_OBJECT))
CallFunctionFast(*EntityObject\AssignFilename,*EntityObject,"ROCKETLAUNCHER.DEF",0)
*RAK._Entity = CallFunctionFast(*EntityObject\CreateEntity,*EntityObject)

glMatrixMode_(#GL_PROJECTION)
glLoadIdentity_()
gluPerspective__(60, ScreenRatio, 0.001, 2000.0)
gluLookAt__(0.0,5.0,-15,0.0,0.0,1.0,0.0,1.0,0.0)
glMatrixMode_(#GL_MODELVIEW)

Repeat
  x.f = -((WIDTH/2-DesktopMouseX()))/WIDTH
  y.f = ((Height/2-DesktopMouseY()))/Height+1
  glClear_(#GL_COLOR_BUFFER_BIT | #GL_DEPTH_BUFFER_BIT)
  glLoadIdentity_()
  glscalef_(0.1,0.1,0.1)
   O_RotateBone(O_FindBone(*RAK,"Fuß"),x*180,0.0,1.0,0.0)
   O_RotateBone(O_FindBone(*RAK,"Arm 1"),y*10,0.0,0.0,1.0)
   O_RotateBone(O_FindBone(*RAK,"Arm 2"),-y*10,0.0,0.0,1.0)
   O_RotateBone(O_FindBone(*RAK,"POD"),(0.5-y)*15,0.0,0.0,1.0)
  CallFunctionFast(*RAK\SHOW,*RAK)
  
  W_Event.l = WindowEvent()
  SwapBuffers_(hDC)
  Delay(1)
Until W_Event=#WM_KEYDOWN
Die Texturen und die Meshes verwalten sich selbst, dass heisst, sie geben den Speicher frei, wenn er nicht mehr benötigt usw... Je nach Priorität und Benutzungsgrad der Texturen / Meshes.
Optimismus ist ein Mangel an Information.
Antworten