A idea on howto dx9 in blitz
Blitz3D Forums/Blitz3D Programming/A idea on howto dx9 in blitz
| ||
Graphics3D 640,480,16,2 Cube=CreateCube() camera=CreateCamera() MoveEntity camera,0,0,-20 RenderWorld Flip Repeat Until KeyDown(1) Function RenderWorld() Print "hehehe! this is done instead of the rendering!" Print "now, if you write a CallDll command to interface with dx9 rendering here..... ;)" End Function Now, itd be a lot of work, but isnt it possible to re-wrap the current blitz commands to DX9 like this? Renderworld could be wrapped to call the dx9 version using a dll call etc etc etc I dont have knowledge to actually do this so i may be totally wrong, but would anyone out there be able to do it? youd be the blitz saveour! |
| ||
Yes, you're totally wrong. Blitz is tied to DirectX, so you can't just rewrite your chosen commands, you have to write a complete engine and it's far more complex than simply "wrapping" dx commands anyway, since Blitz doesn't use DX commands, DX does not load b3d's, and Blitz's lack of pointers, callbacks and certain data types means there's a lot of intermediate work to be done. Just be patient and wait for Drago's DX9 engine. |
| ||
oooh, ^.^ see, i thought all the extra stuff would be done via a DLL, but yup. i was totally wrong and thanks for enlightening me.. Dragos dx9 engine.... *drooool* woohoo ^.^ |
| ||
If you feel like giving it a go yourself, check the recent wrappertutorial I made under the tutorials section. It renders a teapot to the blitzwindow using dx9. |
| ||
well, its something to play with, isnt it ^.^ i still think it might be possible to wrap the blitz commands to something written in c++ as an upgrade. duno if thatd be slow.. IM just thinking out loud realy :D |
| ||
ive been playing with wrapping directx 9 and its a biaaatch really is hard :P |
| ||
well, i cant wait for one to be finished :) |
| ||
well I wanted to try and start a community project to do this but I dont think it would have enough intrest and Im no god in c++ so I wouldnt be able to do much. |
| ||
wouldnt have enough INTEREST? youre kidding, right? it would convert blitz to dx9. it would SAVE blitz from its aging era.... Right now, im looking at my current project and its feeling old.. it realy is... this would be a fun idea to do! |
| ||
i started a dx9 engine for blitz... got it to the point where you could make meshes manually... and then the all the bmax stuff came so i stopped it tho im getting interested in starting to work on it again casually if there is interest. so far you can write the code like this SetEnvironment 1 DirectGraphics3D 800,600,32,False hMesh = DirectCreateMesh() hSurface = DirectCreateSurface(hMesh) DirectAddVertex hSurface,-1.0,-1.0,0.0,0.0,1.0 DirectAddVertex hSurface,1.0,-1.0,0.0,1.0,1.0 DirectAddVertex hSurface,1.0,1.0,0.0,1.0,0.0 DirectAddVertex hSurface,-1.0,-1.0,0.0,0.0,1.0 DirectAddVertex hSurface,1.0,1.0,0.0,1.0,0.0 DirectAddVertex hSurface,-1.0,1.0,0.0,0.0,0.0 DirectVertexColor hSurface,1,255,0,0 DirectVertexColor hSurface,2,0,255,0 DirectVertexColor hSurface,3,0,255,255 DirectVertexColor hSurface,4,255,0,0 DirectVertexColor hSurface,5,0,255,255 DirectVertexColor hSurface,6,255,255,0 DirectMeshStatic hMesh,False hTexture = DirectLoadTexture("Chorme-2.bmp") DirectTextureSurface hSurface, hTexture DirectClsColor 0,0,255 While Not KeyDown(1) DirectCls DirectBegin3D DirectRenderWorld DirectEnd3D DirectFlip Wend DebugLog RenderTime DirectCleanUp WaitKey if anyone wants the C++ just e-mail me at schoenhs_at_yahoo_dot_com and i'll send it to you since i most likely wont finish |
| ||
by not enogh intrest I meant in the project, its alot of work and I know alot of people can't or wont dedicate their time to something of this size. |
| ||
that looks very, very nice... and @ckob i know, but i realy want dx9 ^.^ |
| ||
My teapot is now rendered by Hemispherelighting using a vertex&pixelshader. What I have a problem with now is the damn matrices. I thought I would let blitz handle the movement of the meshes and therefor only pass their matrices to the dx renderer using GetMatelement. But no matter how I try I can't get it to work properly. For instance. If I create a camera(or pivot) in blitz and move it to position 0,0,-5 the camera is looking towards the center. Now if I pass the GetMatElement values to the dxrenderer it seems it looks the other way. Because if I position the camera(pivot) at 0,0,5 , then I can see the center(I have the teapot positioned at the world center). I saw in another thread that blitz use 3x4 matrices so I figured that I only had to fill in the fourth column myself. Like this: 0.0 0.0 0.0 1.0 And if I keep the camera in a fixed position(hardcoded in the renderer) and try to move the teapot instead it get's stretched diagonally(Not the place in the Harry Potter books ;p ). Any matrixwizards out there who can shed some light on this? |
| ||
Yes, you're totally wrong. No, he's not. You can override native functions in Blitz, and if you Include "DirectX9.bb", you can do a wrapper just like this. |
| ||
Ignore my matrixproblem in the post above. I solved it. |
| ||
Good work sweenie @Michael: So i am right? if it wraps everything down to even adding more commands... and rewriting the loading routines i suppose (bummer)... |
| ||
You can do it like this, but you have to write an *entire* renderer. It's a lot of work. |
| ||
yes, i know youd have to write the renderer, (as in, the wrapping of the blitz renderer) As cool as this would be, it would be a little (only) easier than rewriting blitz. lol Itd be nice if this was done, but lets see what comes of the dx9 extras coming soon :) |
| ||
yeah its less work writing a wrapper for dx9 :) the stuff ive managed to wrap was thanks to sweenies example. There is an open source GL wrapper floating around as well. |
| ||
personally, i dont know if ive said this before, but i think we need a dx9 for b3d before blitzmax comes out- to prevent b3d from dying. I cant afford to get blitzmax as soon as id want (yes im very skint. i rarely have more than £30 to my name). DAMN i want bmax.. and DAMN i also wand dx9 in b3d.... |
| ||
well its to my understanding blitzmax wont even have directx but opengl so anything directx specific u want wont even be there |
| ||
yes, of course, should have thought of that..... but say, you would write a dx renderer, wouldnt you? :D of course, the GL aspect is rock cool. Lets avoid the bmax subject here :) |