BBC BASIC for Windows
« d3d trubble? »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:19pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: d3d trubble?  (Read 611 times)
eekster
New Member
Image


member is offline

Avatar




PM


Posts: 4
xx d3d trubble?
« Thread started on: Nov 6th, 2008, 11:08pm »

I've recently been unable to get
lighting.bbc
to work in the graphics examples

I installed d3d version 9 before it happened, never had any problems before that
User IP Logged

eekster
New Member
Image


member is offline

Avatar




PM


Posts: 4
xx Re: d3d trubble?
« Reply #1 on: Nov 6th, 2008, 11:19pm »

REM. Program to demonstrate use of Direct3D lighting from BBC BASIC for Windows

MODE 8
DIM pVB%(0), nv%(0), vf%(0), vl%(0), l%(0), m%(0), t%(0), y(0), p(0), r(0), X(0), Y(0), Z(0), eye(2), at(2), l%(0) 103, m%(0) 67, n(2)

INSTALL @lib$+"D3DLIB"

ON CLOSE PROCcleanup : OSCLI "DELETE MATERIAL.B3D" : QUIT
ON ERROR PROCcleanup : SYS "MessageBox", @hwnd%, REPORT$, 0, 48 : QUIT

REM. Initialise Direct3D and return a pointer to the IDirect3DDevice8 object:
pDevice% = FN_initd3d(@hwnd%, 2, 1)
IF pDevice% = 0 ERROR 100, "Cannot create Direct3D device"
SYS!(!pDevice%+200), pDevice%, 29, 1 : REM Enable specular

REM. Create 3D object with surface normals:
F% = OPENOUT"MATERIAL.B3D"
BPUT #F%,18 : BPUT#F%,0 : BPUT #F%,0 : BPUT#F%,0
BPUT #F%,&12 : BPUT #F%,0 : BPUT#F%,24 : BPUT#F%,0
FOR V% = 0 TO 5
READ x1, y1, z1, x2, y2, z2, x3, y3, z3
a = x2 - x3
b = y2 - y3
c = z2 - z3
d = x1 - x3
e = y1 - y3
f = z1 - z3
n(0) = b*f-c*e
n(1) = c*d-a*f
n(2) = a*e-b*d
n() /= MOD(n())
PROC4(x1) : PROC4(y1) : PROC4(z1) : PROC4(n(0)) : PROC4(n(1)) : PROC4(n(2))
PROC4(x2) : PROC4(y2) : PROC4(z2) : PROC4(n(0)) : PROC4(n(1)) : PROC4(n(2))
PROC4(x3) : PROC4(y3) : PROC4(z3) : PROC4(n(0)) : PROC4(n(1)) : PROC4(n(2))
NEXT
CLOSE #F%

REM. Load 3D object:
pVB%(0) = FN_load3d(pDevice%, "MATERIAL.B3D", nv%(0), vf%(0), vl%(0))

REM. Point-source light:
l%(0)!0 = 1 : REM. point source
l%(0)!4 = FN_f4(1) : REM. diffuse colour RGB
l%(0)!8 = FN_f4(1)
l%(0)!12 = FN_f4(1)
l%(0)!20 = FN_f4(1) : REM. specular colour RGB
l%(0)!24 = FN_f4(1)
l%(0)!28 = FN_f4(1)
l%(0)!52 = FN_f4(0) : REM. position XYZ
l%(0)!56 = FN_f4(0)
l%(0)!60 = FN_f4(-4)
l%(0)!76 = FN_f4(10): REM. range
l%(0)!84 = FN_f4(1) : REM. attenuation (constant)

REM. Gold-coloured material:
m%(0)!0 = FN_f4(1) : REM. diffuse colour RGB
m%(0)!4 = FN_f4(0.7)
m%(0)!8 = FN_f4(0)
m%(0)!32 = FN_f4(1) : REM. specular colour RGB
m%(0)!36 = FN_f4(1)
m%(0)!40 = FN_f4(1)
m%(0)!64 = FN_f4(32): REM. specular 'power'

REM. Render the tumbling object:
eye() = 0, 0, -9
at() = 0, 0, 0
REPEAT
y() = TIME/200
r() = TIME/80
PROC_render(pDevice%, &7F7F7F, 1, l%(), 1, m%(), t%(), pVB%(), nv%(), vf%(), vl%(), y(), p(), r(), X(), Y(), Z(), eye(), at(), PI/6, 1.25, 1, 1000)
UNTIL INKEY(1)=0
END

DEF PROCcleanup
pVB%(0) += 0 : IF pVB%(0) PROC_release(pVB%(0))
pDevice% += 0 : IF pDevice% PROC_release(pDevice%)
ENDPROC

DEF PROC4(a) : LOCAL A% : A%=FN_f4(a) : BPUT #F%,A% : BPUT #F%,A%>>8 : BPUT#F%,A%>>16 : BPUT#F%,A%>>24 : ENDPROC

REM. Pyramid (6 triangles):
DATA -1, -1, 1, -1, -1, -1, 0, .414, 0
DATA 1, -1, 1, -1, -1, 1, 0, .414, 0
DATA 1, -1, -1, 1, -1, 1, 0, .414, 0
DATA -1, -1, -1, 1, -1, -1, 0, .414, 0
DATA 1, -1, -1, -1, -1, -1, -1, -1, 1
DATA -1, -1, 1, 1, -1, 1, 1, -1, -1
User IP Logged

Michael Hutton
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 248
xx Re: d3d trubble?
« Reply #2 on: Nov 7th, 2008, 12:54am »

What exactly happens? What error report do you get, if any?

It shouldn't matter that you have installed DX9 as the DX8 dlls should still be in the system32 folder, unless you specifically deleted them. Lighting.bbc should still work.

There are some differences between DX8 and DX9 API calls some of which require different parameters and the Interfaces are slightly different as well, but this should not be the issue!

Is the D3DLIB library installed in the right place? I know it's an obvious question but you know....!

If you can pinpoint the line where you get the problem it's much easier to solve! Could you post the error message or what happens when you run it?

I know that I have DX9 installed and lighting.bbc works fine here.

Michael



User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: d3d trubble?
« Reply #3 on: Nov 7th, 2008, 09:41am »

Quote:
I've recently been unable to get lighting.bbc to work

You might try running 'dxdiag' (at a command prompt) to see if that shows up any issues. It also allows you to disable or enable 'Direct3D Acceleration' in case there's a problem with your graphics card.

Richard.
User IP Logged

eekster
New Member
Image


member is offline

Avatar




PM


Posts: 4
xx Re: d3d trubble?
« Reply #4 on: Nov 7th, 2008, 5:34pm »

It worked fine today....

I must have just needed a restart
doh

sorry 'bout that
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls