Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

238 Neutral

About Stevieboy

  • Rank
  1. Stevieboy

    Best HLSL book for beginners?

    hi, yeah I would have to agree with smally, Introduction to 3D Game Programming with DirectX 9.0c: A Shader Approach, is the book to get really? - Not only does it have shaders but it also has alot of other directx stuff as well. I started looking for shader books a couple of years ago, and surprisingly there is hardly anything out there for beginners, (as far as I could find). I also brought shaderx 3 (before tthe Frank Luna book), and I've hardly used it at all as DarkZoulz said, it really isn't for learning shaders.
  2. Stevieboy

    X file or mesh with 3D app

    Hi, as I pm'ed you, I got it working with a new .h file and it seems all ok. If you are adding textures you will need to "reserve" more tu & tv (texture coordinates), in your vertex structure, the one you have at the moment seems to be used by your "height" texture - the one you set with different colours. I'm guessing you are actually wanting to use that data / texture to decide which of the proper textures should be drawn? I think you will have to implement some sort of texture blending or something to do that, or do it in a shader based on the height / texture. This didn't initialise properlay with out parethesis; int startX = -l_width / 2; change to; int startX = -(l_width / 2); Oh yeah, use code tags when posting long bits of code they help make the code easier to read etc.
  3. Stevieboy

    X file or mesh with 3D app

    Hi, yeah its a bit tough really whan youre just starting out :). Are you sure 64 * 64 is too big? As a single terrain that should be ok? The other thing you could do is make heightmaps by hand in a paint program, it's not too hard really, make sure you use any inbuilt smoothing filters or blur filters. I've heard that photo shop has a cloud filter which works ok for terrains? I don't know if you are trying to get terrain working with multitexturing, but its probably a good idea to start with just the heightmap and concentrate on getting your heights etc first, (if thats what you want to do), this can be done with a simple heightmap. A raw map map (with out a header) can be used which you just load as an array of unsigned chars. If you are having problems with raw files you could just use a bitmap (used as a greyscale as Crypter mentioned), and access the pixels by using LockRect etc, and make the height map that way. Don't use jpg though because they aren't "lossless" and aren't meant to be used for this ort of thing really. You may find Frank Luna's DirectX book useful, he includes a few sections about terrains etc + alot of other useful stuff. (If you do get it, make sure you get the second edition of the book though, "A shader approach".). There are also samples you can download from his website (, even if you haven't got the book. Uh sorry, didn't really answer your last question there. Persaonally for the time being, I would stick with heightmaps and work from there, the data is more straightforward. The hieght can be got from interpolating over the triangle data. When you make your vertex buffer you can also keep a copy in normal memory or something to use for that. [Edited by - Stevieboy on January 15, 2008 5:23:30 AM]
  4. Stevieboy

    Get the right joystick DirectInput

    Hi, have you called EnumObjects on your gamepad / joystick? Its a callback method to set up the ranges. Look at the sdk joypad sample, that has this function and you can tell quite a lot from it. I don't know why your one starts with -1000 - +1000 range, all my axis are -32000 to + 32000 (actually the size of a "long" ). I think it says in the docs though that the ranges could be quite arbitary? My EnumObjects function is below. BOOL CALLBACK EnumGamepadObjectsCallback( LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvRef) { HRESULT hr = DI_OK; //mydxinput.dinputout <<"EnumGamepadObjectsCallback called" <<endl; DIPROPRANGE diprg; diprg.diph.dwSize = sizeof(DIPROPRANGE); diprg.diph.dwHeaderSize = sizeof(DIPROPHEADER); diprg.diph.dwHow = DIPH_BYID; diprg.diph.dwObj = lpddoi->dwType; diprg.lMin = -400; diprg.lMax = +400; hr = mydxinput.g_pGamepad->SetProperty(DIPROP_RANGE, &diprg.diph); if (FAILED(hr)) return DIENUM_STOP; //continue to callback for other objects. return DIENUM_CONTINUE; } I think to find out what axis or buttons you have you should call GetCapabilities, after you Enumerate the devices, rather than just putting a break point in the GetDeviceState method (as I said earlier). I wqas just looking for the values of the axis at the time, but this one tells you actually how many there are etc. There's lots of other things you could do as well, such as setting a NULL region for the joystick centre etc. I haven't done all that yet though. I better say (for anyone else reading this), DirectInput is (I think), considered deprecated now, so its not really reccomended to use it. So it's up to you if you use it or not. I'm still using it because I already had a class for it and really I'm only using it for my gamepad. I'm not sure if win32 RawInput has gamepad support I'm sure I saw that somewhere?
  5. Stevieboy

    Get the right joystick DirectInput

    Hi, mine works on the rglSlider[0], member of DIJOYSTATE2. When you call the GetDeviceState method for your joystick, put a brake point in, and look at the initialised parameters, these are the buttons / axis that your device has, (and you can use). I've got a separate button on my gamepad that maps the axis to different controls, but they still end up as the same DIJOYSTATE2 parameters. edit; @ EvilSteve, I think he means that in DIJOYSTATE2 an axis is defined as an x, y & z, but you can only ever map two of them at a time sort of thing, - I guess it makes sense as a gamepad / joystick axis is only 2d. :) - yeah, I've been using DirectInput lately for a flight / spacesim game. :) [Edited by - Stevieboy on December 14, 2007 3:52:53 PM]
  6. Stevieboy

    mystery directx texture file

    Hi there dude can you say anything more about this file? Can you post a picture or code or something? From what you have posted there isn't much to go on? Is it an LPDIRECT3DTEXTURE, or bitmap file etc? Are you using some picture library or something like a png library. The DimX & DimY are probably the texture's izes, but I can't think of a DirectX function where you actually need the size of the file in bytes. Also probably not a good idea to have it as a direct download esp' as we don't realy know anything about it.
  7. Stevieboy

    simplified car dynamics

    hi Suliman, I tried some car physics stuff a few years back, but it was quite difficult and really only managed to get turning etc done, so you've already done better than I did. It is really hard to understand to start with though. Have you had a look at the marco motors resources someone posted in a different thread? I haven't had a look at the link as I still have those resources (if they are the same ones), from when I tried it, and its pretty much all there for 2d car stuff. From what I remember (and I have just had another look at marco's implementation), you are meant to treat the side and forward forces differently. I think side forces increase as you turn etc. They also "act" around the centre of mass - like a centrifrugal force. When that goes above a certain point thats when you start sliding. I would forget gears for now to be honest, as they just add complications, (and aren't going to affect getting it working), you could add them back in once everything else is working. What language are you using? What graphics api?
  8. Stevieboy

    possible for me to make game by myself?

    Hi, I remember learning directx, I used to use them tutorials as well, everything I did for about 2 years was based on them. I get on ok with dx now, but I still don't know about texture stages and blending etc. One thing that probably slowed me down alot is that I was learning dx and c++ at the same time. When I got a bit better at c++ the directx side became easier as well, because then I could understand more of what the code was doing. Take some time to learn more c++. go back to console programs if you have to. Learn some stl, - vector is the probably the most useful one to start with, also std::string for any text etc. (string can return a char* array for using with the dx functions, like your model names etc). Try and make a class to encapsulate the mesh loading, (and a mesh of course), -so that one instance of the class holds one mesh. //Very simple idea for a mesh class. //Load the mesh, - make sure your class has everything it needs for loading, //- just like the tutorial sample. Material buffer etc. void Load(std::string meshname)//The texture name is usually got from the file when loading. { // use meshname.c_str(), to get the meshes name for the mesh loading //function. (also basically copy what the tutorial does). }; //call for each mesh / instance - followed by Draw(), in the render loop. void WorldTransform(D3DXVECTOR3 vec3) { //Make sure the programs main SetMatrices() function doesn't have a world //transform, "D3DTS_WORLD" type, (except maybe D3DXMatrixIdentity, as we are //doing that part here. D3DXMATRIXA16 matWorld; //make into a class member. D3DXMatrixTranslation( &matWorld, vec3.x, vec3.y, vec3.z); //You'll need to either pass g_pd3dDevice into the function as well, //or get/save a pointer to it maybe in the load function. You'd need //an LPDIRECT3DDEVICE9 member, to *point* to it. - p_local_d3ddev = //g_pd3dDevice; g_pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld ); } //Do the same as the tutorial does again. void Draw(); void CleanUp(); //release the mesh & any resources etc. //In the render loop you only have to call the main SetMatrices function //once, then call the WorldTransform() function followed straight away //by the Draw finction for each mesh object / instance. You could also get Frank Luna's directx book as well, that might be a help (although it gets into a lot quite quickly & also I think you need at least fairly good c++ for it). I only did this quickly to maybe give you some idea or something, obviously you'd need to do the class properly etc. Hope that helps.
  9. Stevieboy

    combine images

    Hi, I don't really think you have told us enough of what you are trying to do? Are you using quads / D3DXSPRITE, or are you drawing directly to the backbuffer. Do your tiles represent a level which is meant to be scrolled, or are they all meant to be on the screen at once? Are there a certain number of images, so that you could batch your tiles based on whatever image it has. (You could still have random images, but they would be got from say an array, of "source" images, and then randomly generated / assigned to a tile). Sorry if this isn't much help but theere are lots of way to do this. If you want just "one screen" of tiles then really it would be easier to just divide the screen area into your tiles, so you have either 16 * 12 tiles with 64 * 64 pixels, or 32 * 24 with 32 * 32 tiles etc? (Assuming a 1024 * 768 screen). The easy answer to combining your images is to get the back buffer then "StretchBlit" form your tiles to the backbuffer. Also as Programmer101 said, a 4096 * 4096 texture surface is very big, and isn't going to be very good for supporting different cards / performance etc, (there was a recent disscussion about this on here somewhere).
  10. Stevieboy

    Create texture from raw

    Hi, I checked the size of the "wrong" image you posted, and it was 256 * 256. This makes me think when you load the picture it is being loaded into a texture memory area of the next pow 2 up, (this happens quite a lot and I think is is actually the normal way d3d does it). You could try extending your source picture to either 255 * 255 or 256 * 256 (can't remember which is right). Before you load it, call D3DXGetImageInfoFromFile, to get the image information. You could also try using LPDIRECT3DSURFACE9->GetSurfaceDesc(), on the surface once you've loaded it. (That might be easier as you are working with the surface). ..Ok, so you could try "memcopying" 256 * 256 *4 of data over and see if that works. (as long as you've made the source image bigger). If you are using a quad to show the picture, you can set the tu & tv values to compensate for the extra texture size. tu = 220.0f / 256.0f, tv = 208.0f / 256.0f. (They need to be floats). I'd be interested in seeing if memcpy works as well, as I usually go through each pixel with the _LrBits pointer, memcopying the whole chunk might be quicker, although I am using a 1024 * 1024 * 4, so maybe its just a problem with the size. Incidently I wouldn't be sure that memcopy would work on any subrects of the surface (with out trying it).
  11. Hi there, I don't know what the problem is, maybe its a paint / update problem or something? I got a toolbar to work with CreateWindow though. MSDN says CreateToolbarEx is obsolete and CreateWindow should be used, but I would have still thought it should work. //Excuse any untidyness.- //common controls have already been included etc. ///////////////////////////////////////////////////////////////////// /////////// //Toolbar window. ///experiment with different window styles. DWORD toolbar1 = (WS_CHILD | WS_GROUP | WS_BORDER | BTNS_AUTOSIZE ); DWORD toolbar2 = (WS_CHILD | WS_GROUP | WS_BORDER | BTNS_AUTOSIZE | BTNS_BUTTON | TBSTYLE_FLAT); //TBSTYLE_FLAT == transparent. //MSDN examples use CreateWindowEx hWndtoolbar = CreateWindow(TOOLBARCLASSNAME, szTitle, toolbar1, 0, 0, 0, 0, globalhWnd, NULL, hInstance, NULL); //The window size is automattically set by sending a TB_AUTOSIZE //message, which is done at the bottom. LPSTR toollabel_1 = "button 1"; DWORD_PTR dpstr_1 = (DWORD_PTR)toollabel_1; LPSTR toollabel_2 = "button 2"; DWORD_PTR dpstr_2 = (DWORD_PTR)toollabel_2; LPSTR toollabel_3 = "button 3"; DWORD_PTR dpstr_3 = (DWORD_PTR)toollabel_3; LPSTR toollabel_4 = "button 4"; DWORD_PTR dpstr_4 = (DWORD_PTR)toollabel_4; //I_IMAGENONE == no bitmap, this doesn't seem to work at the moment because it should //mean no bitmap is being used, and only text is used, - but it looks like space is //being left for a bit map, also the text isn't centred? toolitems[0].dwData = 0L; toolitems[0].fsState = TBSTATE_ENABLED; toolitems[0].fsStyle = BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT; toolitems[0].iBitmap = I_IMAGENONE; toolitems[0].idCommand = WM_APP_TOOLBAR_1; toolitems[0].iString = dpstr_1; toolitems[1].dwData = 0L; toolitems[1].fsState = TBSTATE_ENABLED; toolitems[1].fsStyle = BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT; toolitems[1].iBitmap = I_IMAGENONE; toolitems[1].idCommand = WM_APP_TOOLBAR_2; toolitems[1].iString = dpstr_2; toolitems[2].dwData = 0L; toolitems[2].fsState = TBSTATE_ENABLED; toolitems[2].fsStyle = BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT; toolitems[2].iBitmap = I_IMAGENONE; toolitems[2].idCommand = WM_APP_TOOLBAR_3; toolitems[2].iString = dpstr_3; toolitems[3].dwData = 0L; toolitems[3].fsState = TBSTATE_ENABLED; toolitems[3].fsStyle = BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT; toolitems[3].iBitmap = I_IMAGENONE; toolitems[3].idCommand = WM_APP_TOOLBAR_4; toolitems[3].iString = dpstr_4; LRESULT lResult = 0; UINT uNumButtons = 4; lResult = SendMessage(// returns LRESULT in lResult (HWND) hWndtoolbar, // handle to destination control (UINT) TB_BUTTONSTRUCTSIZE, // message ID (WPARAM) (UINT) sizeof(TBBUTTON), (LPARAM) 0); lResult = SendMessage(// returns LRESULT in lResult (HWND) hWndtoolbar,// handle to destination control (UINT) TB_ADDBUTTONS,// message ID (WPARAM) (UINT) uNumButtons, (LPARAM) (LPTBBUTTON) toolitems); SendMessage(hWndtoolbar, TB_AUTOSIZE, 0, 0); ShowWindow(hWndtoolbar, SW_SHOW); UpdateWindow(hWndtoolbar); [Edited by - Stevieboy on April 7, 2007 12:16:06 AM]
  12. Stevieboy

    Texturing an object

    Hi, the boxes etc which come form the shape drawing functions do't have any tu & tv (texture) coordinates, you could either just have different colour boxes or make a box in a moddeling program.
  13. Stevieboy

    File Manipulation for dynamic data

    hi, I had a similer idea, what I thought of doing was something like just defining an overall worldsize, I don't think theres a need to keep all the "empty" data. All you need is a list of the parts you have defined. As long as you know the size of a chunk etc in the world, you can work out what index it has, then go to your file stuff and see if that index exists or has been defined. If not return a "vanilla chunk" or something. As for your other question there are a couple things to consider, - yes I think you can overwrite empty "0"'s data, but I'm pretty sure you can't insert new data, - so if you didn't leave space for it you can't "insert" it later, you would have to read in the entire file and then "move" all the data up to insert a new chunk. That sounds like its a good idea to include the empty data then, thats up to you and probably wouldn't be much of a problem. Alternatively you could have a file table at the end of your data area, (the file header would have the location of the file table), in here you would have a list of all the chunks you've already defined, and there positions in the file, so all you would need to do is look through the list for the chunk which has that world position / offset. You could still do this even if you did include all the empty chunks. I think you could just load all the file table data into a vector or somethimg. If you did it this way then to add new chunks, all you would have to do is move the filetable up and not all the terrain data, then you just add any new chunks at the end of the data area, and then rewrite the filetable again. I was going to do something like this, so that you could work on any part of a terrain when you wanted and wouldn't need to make the whole terrain / heightmap at once, this was going to be as part of a terrain editor though, and started to get quite complicated. Look up pak, or resource files, also there are a couple tutorials somewhere here on gamedev / resources section about them.
  14. Stevieboy

    Axis Align Billboard

    Hi, I read your original post again, and actually I don't think there are axis alligned quads, (not in this context / usage anyway), maybe your friend was thinking about axis alligned bounding boxes - AABB's, those are good for rough collision detection tests. They can also be used when working with trrains, to cull lots of the trrainn and just leave what is in the camera frustrm.
  15. Stevieboy

    Axis Align Billboard

    Hi, Thrawn80, I've just been doing camera frustrum planes, (from Franks Luna's book), also I'm not very good at 3d maths stuff either. It occurs to me though that the far and near frustrum planes are alligned with the camera, (I know this won't be much use of course if you don't have them already, or haven't got that far), I'm sure these frustrum planes could be used to rotate the quads though, then there would only be the matter of positioning. If you want to try and figure it out you could start with the view and projection matrices; D3DXMATRIXA16 VP = matView * matProj; Somehow in this you should be able to get the direction the camera is facing, - at any rate, having a good look at the camera matrices (and learning about that), might be a good place to start, because the camera direction / orientation might be what you really need. Actually lining up with the near or far viewing planes might notbe exactly what you need, you may still need them to rotate a bit more to actually face the camera? - Well I tried to be helpful, but I'm not really too sure on this. [Edited by - Stevieboy on February 18, 2007 2:56:17 PM]
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!