I'm trying to create some DX graphics routines running in VB6. I have no experience with DX programming so I am struggling.
Although I can already do what I want with pixel level formulae, my routines are like 100 slower than I need them because VB is notoriously slow at drawing graphics. So I'm looking towards DX.
What I'd like to get up and running is a graphics engine similar to Quake or Hexen, which uses rectangles with texture maps to define the terrain and walls, and bitmaps (with alpha) for sprites also.
I like and understand coordinates, I don't understand higher level scene elements. So I don't want to be dealing with polygon strips or X-files etc.
So I think I'm looking for a function which takes a 4 sided polygon and a texture image and draws them into the scene. I want to build up an image by adding polygons one at a time like this.
The main use of the function will be to create a terrain by having eg, 32x32 polygons. I want the polygons furthest away to fade to a haze colour against a 360'degree wrapped backdrop, so alpha control will be needed (8-bit or even 4-bit alpha would be ok.)
From my point of view, I'd like something as simple as below where all the horrible looking API goop is in a BAS file that I'll never touch :
Code: Select all
InitDX(1024,768) for UploadImage(Image) next do ClearScene () SetCamera (x,y,z, view_direction_angle, elevation_angle, camber_angle, zoom_fov) AddAmbientLight(r,g,b) AddDirectionalLight(x,y,z,r,g,b) '(x,y,z) is the direction vector from (0,0,0) AddPointLight(x,y,z,r,g,b) for AddPolygon(x1,y1,z1,x2,y1,z2,x3,y3,z3,x4,y4,z4,image_index,alpha) next RenderScene () loop UnInitDX()
(1) The lighting functions are optional extras for d3d.
(2) Render can use screen flip or whatever is fastest.
(3) I don't mind whether this uses D3D (perspective maps) or plane DD (bilinear maps), whichever is fastest.
(4) In the AddPolygon routine, the full image should be stretched between those four coordinates, NOT cropped to fit.
(5) I understand all of the mathematics behind computer graphics, as I say I can already do all this amd more with pixel level formulae. Its just the dx programming that is alien to me. So if you do recommend plane DD, I already know how to turn 3d into 2d, and work with the camera's gimbal angles.
Can anyone help?