Sign in to follow this  

error

This topic is 4487 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

CreateDevice returns hresult error code ... you need to decode it to get the answer. like this :

(hresult is nothing more then long/int)

hResultGlobal = d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, mainWindowHandle,
D3DCREATE_HARDWARE_VERTEXPROCESSING |
D3DCREATE_DISABLE_DRIVER_MANAGEMENT_EX,
&d3dpp,
&d3dDevice);
if(FAILED(hResultGlobal))
{
switch(hResultGlobal)
{
case D3DERR_DEVICELOST: // The device has been lost but cannot be reset at
// this time. Therefore, rendering is not possible.
{
// do something
}
break;
case D3DERR_INVALIDCALL: // The method call is invalid. For example, a // method's parameter may have an invalid value.
{
// do something
}
break;
case D3DERR_NOTAVAILABLE: // This device does not support the queried // technique.
{
// do something
}
break;
case D3DERR_OUTOFVIDEOMEMORY: // Direct3D does not have enough display // memory to perform the operation.
{
// do something
}
break;
}


it'll show you what's wrong ... i hope :)

Share this post


Link to post
Share on other sites
If it's an existing, working game engine and you've never had it running, you should check things like your directx version, drivers etc.

And just a couple of little tips: People prefer it if you edit your posts rather than posting twice. Also, a bit more detail in the question is helpful.

Share this post


Link to post
Share on other sites
ok, maybe i ought to paste the whole code


// Jolt3D_Main.cpp : Defines the entry point for the application.
//
#include "JOLT3D.H"

FONT arial10;
TEXTURE emptytxt;

// Load here all the Jolt3D Resources & Engine too.
void Load_J3D_Resources()
{
jStart_Engine(Engine);

// Load here all the necessary Jolt3D recources like cursors, textures, models etc.
jCreate_Font(&arial10,"Arial",10,false,false,false,false);
}

// Release here all the Jolt3D resources & Engine too.
void Release_J3D_Resources()
{
// Release here all the loaded Jolt3D recources like cursors, textures, models etc.
jRelease_Font(&arial10);

jRelease_Engine();
}

// Write here all the things that needs ONE time initialization and ISNT part of Jolt3D!
// internal loading & releasing!
// (like starting variables values for example)
void One_Time_Initialization()
{
}

int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.

// Window Stuff
Engine.hInstance=hInstance;
Engine.EscapeKey=KB_ESCAPE;
// Desired Resolution
Engine.Res.AppWidth=800;
Engine.Res.AppHeight=600;
Engine.Res.WinWidth=800;
Engine.Res.WinHeight=600;
Engine.Res.Bpp=16;
Engine.Res.Depth=16;
// Refresh Rate: You can set REFRESH_MINIMUM, REFRESH_MAXIMUM or a real number! (if not supported, maximum used)
Engine.Res.RefreshRate=REFRESH_MAXIMUM;
// Hardware
Engine.HAL=true;
Engine.Use_HW_VtxProcess=true;
// Rendering
Engine.Windowed=true;
Engine.VSync=true;
Engine.Antialiasing_Samples=FSAA_NONE;

if (!Load_DLL(""))
return -1;
Load_J3D_Resources();
One_Time_Initialization();
jRun_Engine();
Release_J3D_Resources();
Free_DLL();
return 0;
}

// Main Rendering! (Dont use it, is exist ONLY to Mirror a current Scene for 'Mirroring')
// Allowable Functions (for good results) is: Render_Mirror_Quad() and Set_View_Port()
// (Of course there is no need to write the 2 functions above if you're NOT using mirrors
// or viewport changes)
void Render()
{
jClear(CLEAR_TARGET_ZBUFFER,jColor(255,92,92,92));
jBegin_Scene();

Engine.RenderScene();

jEnd_Scene();
jPresent_Scene();
}

// Scene Rendering! (write HERE your 'game' including objects drawing etc.)
void RenderScene()
{
// Start Code //


jDraw_Text(&arial10,10,10,jFormat("FPS:%.01f",jGet_FPS()),jColor(255,255,255,255),emptytxt);
// End Code //
}

// WINDOW SYSTEM ////////////////////////////////////////////////////////////////////////////////////
// THE 'BODIES' BELOW IS THE GRAPHICS THAT YOUR SYSTEM WILL USE FOR WINDOW CONTROLS
// IF YOU DONT LIKE THE STANDARD ONES THAT DEFINED, CHANGE THEM

// Write your 'body' source for Windows!
void Windows_Body(int Win,bool Selected,FONT Font,char Title[260],int Tx1,int Ty1,int Tx2,int Ty2,int Bx1,int By1,int Bx2,int By2,int TextX,int TextY)
{
Draw_Classic_Window(Win,Selected,Tx1,Ty1,Tx2,Ty2,Bx1,By1,Bx2,By2,TextX,TextY);
Draw_Standard_Windows(Win,Tx1,Ty1,Tx2,Ty2,Bx1,By1,Bx2,By2,TextX,TextY);
}

// Write your 'body' source for Buttons!
void Buttons_Body(int Button,bool Pressed,FONT Font,char Title[260],int Bx1,int By1,int Bx2,int By2,int TextX,int TextY)
{
Draw_Classic_Button(Button,Pressed,Bx1,By1,Bx2,By2,TextX,TextY);
Draw_Standard_Buttons(Button,Pressed,Bx1,By1,Bx2,By2,TextX,TextY);
}

// Write your 'body' source for CheckBoxes!
void CheckBox_Body(int CheckBox,bool Checked,FONT Font,char Text[260],int Cx1,int Cy1,int Cx2,int Cy2,int TextX,int TextY)
{
Draw_Classic_CheckBox(CheckBox,Checked,Cx1,Cy1,Cx2,Cy2,TextX,TextY);
}

// Write your 'body' source for ScrollBars!
void ScrollBar_Body(int ScrollBar,int Type,int Scx1,int Scy1,int Scx2,int Scy2,int Cbx1,int Cby1,int Cbx2,int Cby2)
{
Draw_Classic_ScrollBar(ScrollBar,Scx1,Scy1,Scx2,Scy2,Cbx1,Cby1,Cbx2,Cby2);
}

// Write your 'body' source for EditBoxes!
void EditBox_Body(int EditBox,bool Edited,FONT Font,char Text[260],int Ex1,int Ey1,int Ex2,int Ey2,int Lx,int Ly1,int Ly2,int TextX,int TextY)
{
Draw_Classic_EditBox(EditBox,Ex1,Ey1,Ex2,Ey2,Lx,Ly1,Ly2,TextX,TextY);
}

// Write your 'body' source for DropDowns!
void DropDown_Body(int DropDown,UINT style,int Selected,bool Dropped,FONT Font,int Selx1,int Sely1,int Selx2,int Sely2,int Dbx1,int Dby1,int Dbx2,int Dby2,int Enx1,int Eny1,int Enx2,int Eny2,int TextX,int TextY,char Title[260],char SelectedEntry[260])
{
Draw_Classic_DropDown(DropDown,style,Selx1,Sely1,Selx2,Sely2,Dbx1,Dby1,Dbx2,Dby2,Enx1,Eny1,Enx2,Eny2,TextX,TextY);
}

// Write your 'body' source for HighLighted Selection of DropDowns!
void HighLight_DropDown(int DropDown,int x1,int y1,int x2,int y2,int TextX,int TextY,FONT *Font,char Text[260])
{
Draw_Classic_HighLight_DropDown(DropDown,x1,y1,x2,y2,TextX,TextY,Text);
}

// Write your 'body' source for GroupBoxes!
void GroupBox_Body(int GroupBox,FONT Font,char Title[260],int Gx1,int Gy1,int Gx2,int Gy2,int TextX,int TextY,int TextWidth)
{
Draw_Classic_GroupBox(GroupBox,Gx1,Gy1,Gx2,Gy2,TextX,TextY,TextWidth);
}

// Write your 'body' source for ANY Graphics that will be drawn ABOVE the Window System!
void Draw_Above_Windows()
{
}

// MULTIPLAYER MESSAGE HANDLING ///////////////////////////////////////////////////////////////////////

// a similar structure that contains all players in a session. The only important thing is
// that you MUST limit to 'MAX_PLAYERS', otherwise you get memory bugs...
struct _players
{
bool Exist[MAX_PLAYERS];
char Name[ MAX_PLAYERS ][260];

// send your specific
};
_players players;

// This is the Message Handler for multiplayer games for Jolt3D! All the messages from all peers
// of internet are send here for handling.
// The function is called internally and Asynchronously! DONT draw objects here or any DirectX
// related objects, cause bugs will come..Instead, give flags to do actions in 'RenderScene()' function.
void Message_Handling(BYTE MessageType, char Message[512], DPNID SenderID, DWORD SenderPos)
{
// contains the local player position
DWORD LocalPos;
PLAYERS pp;

// Resolve type of message..
switch(MessageType)
{
case TYPE_MESSAGE:

// The 'Message' contains the string that the player with 'SenderID' has send you.

break;
// A Player (The Host or a peer) has created/joined the session...Create him now!
case TYPE_CREATE_PLAYER:
// If the player that now created is DIFFERENT from us (Local), we must
// inform him with OUR player currently informations...(etc. Position perhaps)
// This is a critical point; the new players MUST know what infos we have!
// (This is a step that ALL -already-created- players must do)
if (SenderID != jGet_Local_Player_ID())
LocalPos=jGet_Player_Pos_From_ID( jGet_Local_Player_ID() );

// create (or copy) here the player in your own structure...

// get the basic Jolt3D! players info...(theyre not enough for a complex game of course...)
pp=jGet_Players_Info();
// ...copy them to your real one structure! This sample just copy ONLY the name; You can copy
// them all if you want, and also set HERE & NOW the desired (starting up) values for this player.
// The 'players' structure is the REAL one player for this game; The 'pp' is the internal -give-n-take-
// structure that use ALL peers through internet...
players.Exist[SenderPos]=true;
strcpy(players.Name[SenderPos],pp.Name[SenderPos]);
break;
// A PLAYER (PEER) HAS REMOVED FROM SESSION...DESTROY HIM NOW!
case TYPE_DESTROY_PLAYER:

// destroy here the player in your own structure...
players.Exist[SenderPos]=false;
break;
}

}





i have directx9.0c installed, all drivers up to date, the program ran fine, then i reformatted my pc, and now it says error with creting d3d device

[edit: changed code tags to source tags -SiCrane]

Share this post


Link to post
Share on other sites

This topic is 4487 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this