August 04, 2020, 12:09:47 PM

Author Topic: OpenB3DMax  (Read 178 times)

Offline _PJ_

  • Jr. Member
  • **
  • Posts: 92
OpenB3DMax
« on: July 21, 2020, 11:53:02 AM »
Code: [Select]
Form what I can see, the 3D Graphics command voids return value, so there is no TGraphics (or TGLGraphics?) object exposed.
In order to switch graphics objects such as:
[vode]
Global GPU_CURRENT:TGraphics
'....
      GPU_CURRENT=Graphics(W,H,D) 
'....
If (GPU_CURRENT<>Null)
CloseGraphics(GPU_CURRENT)
GCCollect
End If
        GPU_CURRENT = Graphics(NewW, NewH, NewD)

I have trawled through Docs, but cannot find a way to access to the current TGraphics3D object nor the actual Object type (TGLGraphics? TGraphics3D? etc...) or if there are suitable appropriate alternative "Close" funcitons etc. for the OpenGL B3D Max modules...

Can anyone help with this?

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 468
Re: OpenB3DMax
« Reply #1 on: July 21, 2020, 11:58:20 AM »
There's no TGraphics3D object there's gfx_obj:TGraphics, stored in TGlobal3D.gfx_obj.

Offline _PJ_

  • Jr. Member
  • **
  • Posts: 92
Re: OpenB3DMax
« Reply #2 on: July 21, 2020, 12:23:16 PM »
Hi Mark, thanks for the quick reply.

I was able to find TGlobal3D.gfx_obj where it was declared in the exposed Graphics3D function ("B3DGlGraphics.Mod")


   If usecanvas=False Then TGlobal3D.gfx_obj=Graphics( width,height,depth,rate,flags ) ' gfx object

Offline _PJ_

  • Jr. Member
  • **
  • Posts: 92
Re: OpenB3DMax
« Reply #3 on: July 21, 2020, 01:22:42 PM »
Now my follow up question is:

When MaxGUI is used, how to render 3D to a canvas?

---
I have set the useCanvas parameter to TRUE

I created a UI Canvas object

and then make a RenderWorld() call
---

IF, between calling Graphics3D and the RenderWorld() I use the following:
Code: [Select]
'testc:TCamera = CreateCamera()
teste:TEntity = CreateSphere()
testl:TLight = CreateLight()
AmbientLight(128,128,128)
Everything compiles and runs without issue. HOWEVER As soon as I uncomment the CreateCamera() line - the whole build dies completely crashing BlitzMax with a notification "ERROR_ ACCESS VIOLATION"

_

What requirements do I need to be in place before creating camera, and, just so I am clear on this, in IMPORTing the necessary modules to render 3D content in  a MaxGUI canvas, Should I have any additional frameworks/imports?

Currently I am only calling
Import MaxGUI.Drivers
Import BRL.Standardio
( For the MaxUI stuff )

Import OpenB3DMax.B3DGLGraphics
( For the 3D stuff )


Offline _PJ_

  • Jr. Member
  • **
  • Posts: 92
Re: OpenB3DMax
« Reply #4 on: July 26, 2020, 07:30:23 PM »
In the event of no response, I wonder if perhaps there is a way to copy the backbuffer render and send draw this to the canvas as a PixMap instead?

What are other peoples' solutions to how to render 3D camera view to a MaxGUI Canvas?

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 468
Re: OpenB3DMax
« Reply #5 on: August 01, 2020, 12:53:46 AM »
Sorry, I haven't had much free time. I think you can find the solution to this in the examples at openb3dmax.docs. See minib3d/maxgui.bmx.

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal