It is currently Mon Sep 23, 2019 9:25 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 24 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: [ENGINE] 2D Engine Nautilus (Win)
PostPosted: Wed Jul 31, 2019 4:57 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Sep 11, 2016 2:17 pm
Posts: 520
gurj wrote:
In your first post, no 'nautilusCreate' was found.
and, i test your first Example: Image...


The first post only showed (now removed) the interface functions.
Please download the library & include from one of the links provided in the first post.


Top
 Profile  
Reply with quote  
 Post subject: Re: [ENGINE] 2D Engine Nautilus (Win)
PostPosted: Thu Aug 01, 2019 4:05 am 
Offline
Enthusiast
Enthusiast

Joined: Mon May 10, 2010 4:02 pm
Posts: 149
Mijikai wrote:
Version 1.00 :)

Finally :D

No link to the final version?


Top
 Profile  
Reply with quote  
 Post subject: Re: [ENGINE] 2D Engine Nautilus (Win)
PostPosted: Thu Aug 01, 2019 8:32 am 
Offline
Addict
Addict

Joined: Sun Jun 25, 2006 7:28 pm
Posts: 1368
@Mijikai, your engine works okay, i tested Version 0.35 beta with winXP/32 PB570
i want to calculate positions of thousands of points ONCE and then after the calculations rendering it , how to do that ?
here i plot thousands of points randomly , but it keeps calculating continuously between *engine\RenderBegin and *engine\RenderEnd(). and i want to calculate the positions outside this Loop and then rendering the result. the meaning i don't know how you implements it in glLists or vbo or something else.
Code:
EnableExplicit

XIncludeFile "nautilus.pbi"
Global x,y,i,r,g,b,col
Structure VECTOR_STRUCT
  x.f
  y.f
EndStructure

Procedure.i Demo(Width.i,Height.i,Title.s,ViewWidth.i,ViewHeight.i,FPS.i)
  Protected win.i
  Protected win_handle.i
  Protected win_flag.i
  Protected win_msg.i
  Protected *engine.NAUTILUS_ENGINE
  Protected engine_delta.f
  Protected engine_fps.i
  Protected engine_error.i
  Protected *collision.NAUTILUS_COLLISION
 
  win_flag|#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_MinimizeGadget
  win_flag|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget
  win = OpenWindow(#PB_Any,#Null,#Null,Width,Height,Title,win_flag)
   
  If win
    win_handle = WindowID(win)
    *engine = nautilusCreate(win_handle,ViewWidth,ViewHeight,FPS)
    If *engine
      *engine\RenderAspect()
      Repeat
        Repeat
          win_msg = WindowEvent()
          If win_msg = #PB_Event_CloseWindow
            Break 2
          EndIf
        Until win_msg = #Null

        *engine\RenderBegin(@engine_delta,@engine_fps,@engine_error)
        For i=1 To 5000
          x=Random(500): y=Random(500)
          r=Random(255):g=Random(255):b=Random(255)
          col = RGBA(r,g,b,255)
        *engine\DrawPointSize(5)
        *engine\DrawPoint(x,y, col)
        Next
     
        *engine\RenderEnd()
        If engine_error
          Break
        EndIf
      ForEver
      *engine\Release()
    EndIf
    CloseWindow(win)
  EndIf
EndProcedure

Demo(800,600,"Points",600,400,30)

End


Top
 Profile  
Reply with quote  
 Post subject: Re: [ENGINE] 2D Engine Nautilus (Win)
PostPosted: Thu Aug 01, 2019 2:09 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Sep 11, 2016 2:17 pm
Posts: 520
applePi wrote:
@Mijikai, your engine works okay, i tested Version 0.35 beta with winXP/32 PB570
i want to calculate positions of thousands of points ONCE and then after the calculations rendering it , how to do that ?
here i plot thousands of points randomly , but it keeps calculating continuously between *engine\RenderBegin and *engine\RenderEnd(). and i want to calculate the positions outside this Loop and then rendering the result. the meaning i don't know how you implements it in glLists or vbo or something else.


Even if every positions was calculated beforehand - there is no engine function to render it at once.

Luckily all OpenGL commands are still usable :)

So here is an example that uses a gl list:
Code:
EnableExplicit

XIncludeFile "nautilus.pbi"

Structure VECTOR_STRUCT
  x.f
  y.f
EndStructure

Procedure.i Points();create a list
  Protected index.i
  Protected lst.i
  Protected color,i
  Protected pos.VECTOR_STRUCT
  lst = glGenLists_(1)
  glNewList_(lst,#GL_COMPILE)
  glBegin_(#GL_POINTS)
  For index = 0 To 4999
    color = RGBA(Random(255),Random(255),Random(255),255)
    pos\x = Random(500)
    pos\y = Random(500)
    glColor3ubv_(@color)
    glVertex2fv_(@pos)
  Next
  glEnd_()
  glEndList_()
  ProcedureReturn lst
EndProcedure

Procedure.i Demo(Width.i,Height.i,Title.s,ViewWidth.i,ViewHeight.i,FPS.i)
  Protected win.i
  Protected win_handle.i
  Protected win_flag.i
  Protected win_msg.i
  Protected *engine.NAUTILUS_ENGINE
  Protected engine_delta.f
  Protected engine_fps.i
  Protected engine_error.i
  Protected *collision.NAUTILUS_COLLISION
  Protected dlst.i
  win_flag|#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_MinimizeGadget
  win_flag|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget
  win = OpenWindow(#PB_Any,#Null,#Null,Width,Height,Title,win_flag)
  If win
    win_handle = WindowID(win)
    *engine = nautilusCreate(win_handle,ViewWidth,ViewHeight,FPS)
    If *engine
      *engine\RenderAspect()
      *engine\DrawPointSize(5)
      dlst = Points();<- create a point lst
      Repeat
        Repeat
          win_msg = WindowEvent()
          If win_msg = #PB_Event_CloseWindow
            Break 2
          EndIf
        Until win_msg = #Null

        *engine\RenderBegin(@engine_delta,@engine_fps,@engine_error)
       
        glDisable_(#GL_TEXTURE_2D)
        glCallList_(dlst);<- render everything
        glEnable_(#GL_TEXTURE_2D);<- needed the engine expects this to be enabled by default!
       
        *engine\RenderEnd()
        If engine_error
          Break
        EndIf
      ForEver
      *engine\Release()
    EndIf
    CloseWindow(win)
  EndIf
EndProcedure

Demo(800,600,"Points",600,400,30)

End


Last edited by Mijikai on Thu Aug 01, 2019 2:33 pm, edited 3 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: [ENGINE] 2D Engine Nautilus (Win)
PostPosted: Thu Aug 01, 2019 2:18 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Sep 11, 2016 2:17 pm
Posts: 520
kvitaliy wrote:
Mijikai wrote:
Version 1.00 :)

Finally :D

No link to the final version?


Dont worry :)
Im still working on example codes ill post the link when everything is ready.

I was rightfully criticized when i briefly posted the link without any
examples or documentation so im fixing that now.


Top
 Profile  
Reply with quote  
 Post subject: Re: [ENGINE] 2D Engine Nautilus (Win)
PostPosted: Thu Aug 01, 2019 5:21 pm 
Offline
Addict
Addict

Joined: Sun Jun 25, 2006 7:28 pm
Posts: 1368
nice example Mijikai, thank you.
this is useful for displaying the time consuming images such as fractals like Mandelbrot set and so on.
in the example here: viewtopic.php?f=14&t=73077&start=0#p538774
line 64 a typo mistake *collision\LineLineEx, should be *collision\LineEx
Thanks for letting OpenGL commands still usable, we can this way use your engine to display the hard parts of opengl which we don't know how to achieve such as mouse, text display, fonts, and many other things.


Top
 Profile  
Reply with quote  
 Post subject: Re: [ENGINE] 2D Engine Nautilus (Win)
PostPosted: Thu Aug 01, 2019 6:11 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Sep 11, 2016 2:17 pm
Posts: 520
Thanks for the reply :)

Just had some time to play around a bit and it looks like all engine functions can also be used in a list:
Code:
Procedure.i Points(*engine.NAUTILUS_ENGINE);create a list
  Protected index.i
  Protected lst.i
  Protected color,i
  Protected pos.VECTOR_STRUCT
  lst = glGenLists_(1)
  glNewList_(lst,#GL_COMPILE)
  glBegin_(#GL_POINTS)
  For index = 0 To 4999
    *engine\DrawPoint(Random(500),Random(500),RGBA(Random(255),Random(255),Random(255),255))
  Next
  glEnd_()
  glEndList_()
  ProcedureReturn lst
EndProcedure


So i decided to provide functions for it in the next release :D


Top
 Profile  
Reply with quote  
 Post subject: Re: [ENGINE] 2D Engine Nautilus (Win)
PostPosted: Fri Aug 02, 2019 11:02 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Sep 11, 2016 2:17 pm
Posts: 520
Did some work i also decided to add some functions for creating a window :)

Preview:

The code also renders a gl list but uses the new engine functions 8)
Code:
EnableExplicit

XIncludeFile "nautilus.pbi"

Procedure.i Demo(Title.s,Width.i,Height.i,ViewWidth.i,ViewHeight.i,FPS.i)
  Protected *engine.NAUTILUS_ENGINE
  Protected engine_fps.i
  Protected point_list.i
  Protected index.i
  *engine = nautilusWindow(Title,Width,Height,#Null,ViewWidth,ViewHeight,FPS)
  If *engine
    *engine\DrawPointSize(5)
    point_list = *engine\DrawListBegin()
    If point_list
      For index = 0 To 4999
        *engine\DrawPoint(Random(320),Random(200),RGBA(Random(255),Random(255),Random(255),255))
      Next
      *engine\DrawListEnd()
    EndIf
    Repeat
      *engine\RenderBegin(#Null,@engine_fps)
      *engine\DrawList(point_list)
      *engine\RenderEnd()
      nautilusWindowTitle(*engine," FPS: " + Str(engine_fps),#True)
    Until nautilusWindowExit()
    *engine\DrawListDelete(point_list)
    nautilusWindowClose(*engine)
  EndIf
EndProcedure

Demo(#Null$,800,600,320,200,60)


A list can also be rendered onto a layer :wink:


Top
 Profile  
Reply with quote  
 Post subject: Re: [ENGINE] 2D Engine Nautilus (Win)
PostPosted: Thu Aug 15, 2019 9:31 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Sep 11, 2016 2:17 pm
Posts: 520
Release Version 1.03
- New Function: The Window Mode can now be changed
- Bug Fixes


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 24 posts ]  Go to page Previous  1, 2

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye