• Content count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About Cwhizard

  • Rank
  1. That was it!. I simply added device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); and now it works, thanks I thought it was supposed to be off by default, at least that's how OpenGL did it. but thinking about it, it should be on by default as that is the state most applications will prefer.
  2. sleep c++

    for windows - #include <windows.h> VOID WINAPI Sleep(DWORD Milliseconds); for linux  # include <unistd.h> unsigned int sleep(unsigned int Seconds); Notice though that they use different arguments.  In windows its in milliseconds, and in linux its in full seconds   In general, on windows, if you just need to keep the thread from blocking other processes, use Sleep(0);  which will immediately return control to the calling thread if no other threads or processes are waiting.  Any value higher than 0 will guarantee that control does not return to the calling thread PRIOR to that time elapsing, but there is no guarantee of it happening exactly at that time.  So e.g. Sleep (1000); would not return before 1000 milliseconds had elapsed, but it could very well not return for 5 seconds, or 5 days.  If you want to actually wait a specified time, e.g. being laptop battery friendly, you should instead use timer functions such as  UINT_PTR WINAPI SetTimer(...);   These can have better resolution, and callback timers in specific are virtually guaranteed to execute at the specified interval except on the most heavily overloaded system.  
  3. If you have multiple GPU's on a laptop then you need to go the long road and enumerate the cards available and check each one for DEVCAPS.  I'm guessing something changed with your default GPU and the integrated one doesn't support something you are using.  Also, code always helps, .
  4. The following code is supposed to draw a cube in wireframe mode, but it is only drawing the first 2 primites (6 vertices instead of 36).  If its just a typo Ill be mad, but honestly I'm drawing a blank here DWORD WINAPI MainThread(DWORD); DWORD WINAPI MainThread(DWORD dwParam){       // Wait for the window to appear     while(!bQuit && hwnd == NULL) Sleep(1);     if(bQuit) return 0;     // Initialize Direct3D   // Create a Direct3D Object (starts Direct3D and lets you access its functions) IDirect3D9* d3d9 = Direct3DCreate9(D3D_SDK_VERSION); if(d3d9 == NULL) bQuit = true;   // Get device capabilities (what your card can do) D3DCAPS9 caps; d3d9->GetDeviceCaps( 0 , D3DDEVTYPE_HAL , &caps);   // Set Vertex Processing type (Hardware or Software) // Hardware is faster, but not 'all' cards support it int vp = 0; switch(caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT){ case 0: vp = D3DCREATE_SOFTWARE_VERTEXPROCESSING; break; default: vp = D3DCREATE_HARDWARE_VERTEXPROCESSING; break; }   //Beep(1000,50);   // Fill out the Present Parameters structure (What we want the display to look like)   d3dpp.BackBufferWidth            = 800; d3dpp.BackBufferHeight           = 600; d3dpp.BackBufferFormat           = D3DFMT_A8R8G8B8; d3dpp.BackBufferCount            = 1; d3dpp.MultiSampleType            = D3DMULTISAMPLE_NONE; d3dpp.MultiSampleQuality         = 0; d3dpp.SwapEffect                 = D3DSWAPEFFECT_DISCARD; d3dpp.hDeviceWindow              = hwnd; d3dpp.Windowed                   = TRUE; d3dpp.EnableAutoDepthStencil     = TRUE; d3dpp.AutoDepthStencilFormat     = D3DFMT_D24S8; d3dpp.Flags                      = 0; d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT; d3dpp.PresentationInterval       = D3DPRESENT_INTERVAL_IMMEDIATE;     // Create the device (start the Direct3D window)   IDirect3DDevice9* device;   HRESULT hResult = d3d9->CreateDevice( D3DADAPTER_DEFAULT, // primary adapter D3DDEVTYPE_HAL,     // device type - We want Hardware, not Software (emulation) hwnd,               // window associated with device vp,                 // vertex processing    &d3dpp,             // present parameters    &device);            // return created device if(FAILED(hResult)){ bQuit = true; MessageBox(NULL , "CreateDevice() FAILED" , 0 , 0);}   // Create a vertex buffer that holds 8 vertices IDirect3DVertexBuffer9* VertexBuffer; hResult = device->CreateVertexBuffer( 8 * sizeof(Vertex), 0 , VERTEXFORMAT, D3DPOOL_MANAGED, &VertexBuffer, 0); if(FAILED(hResult)){ bQuit = true; MessageBox(NULL , "CreateVertexBuffer() FAILED" , 0 , 0);}   // create an index buffer that holds 36 indices IDirect3DIndexBuffer9* IndexBuffer; hResult = device->CreateIndexBuffer( 36 * sizeof(WORD), D3DUSAGE_WRITEONLY, D3DFMT_INDEX16, D3DPOOL_MANAGED, &IndexBuffer, 0); if(FAILED(hResult)){ bQuit = true; MessageBox(NULL , "CreateIndexBuffer() FAILED" , 0 , 0);}   // the following 2 sections, accessing the buffers should be merged into a single section // which loads the model data from files after calculating the necessary buffer sizes // access the vertex buffer Vertex* vertices; VertexBuffer->Lock(0 , 0 , (void**)&vertices , 0); vertices[0] = Vertex(-1.0f, -1.0f, -1.0f); vertices[1] = Vertex(-1.0f,  1.0f, -1.0f); vertices[2] = Vertex( 1.0f,  1.0f, -1.0f); vertices[3] = Vertex( 1.0f, -1.0f, -1.0f); vertices[4] = Vertex(-1.0f, -1.0f,  1.0f); vertices[5] = Vertex(-1.0f,  1.0f,  1.0f); vertices[6] = Vertex( 1.0f,  1.0f,  1.0f); vertices[7] = Vertex( 1.0f, -1.0f,  1.0f); VertexBuffer->Unlock();   // access the index buffer WORD* indices; IndexBuffer->Lock(0 , 0 , (void**)&indices , 0); indices[0]  = 0; indices[1]  = 1; indices[2]  = 2; indices[3]  = 0; indices[4]  = 2; indices[5]  = 3; indices[6]  = 4; indices[7]  = 6; indices[8]  = 5; indices[9]  = 4; indices[10] = 7; indices[11] = 6; indices[12] = 4; indices[13] = 5; indices[14] = 1; indices[15] = 4; indices[16] = 1; indices[17] = 0; indices[18] = 3; indices[19] = 2; indices[20] = 6; indices[21] = 3; indices[22] = 6; indices[23] = 7; indices[24] = 1; indices[25] = 5; indices[26] = 6; indices[27] = 1; indices[28] = 6; indices[29] = 2; indices[30] = 4; indices[31] = 0; indices[32] = 3; indices[33] = 4; indices[34] = 3; indices[35] = 7; IndexBuffer->Unlock();       // set stream source (attach vertex buffer to rendering pipeline)     //device->SetStreamSource(0 , VertexBuffer , 0 , sizeof(Vertex));       // set the vertex format     //device->SetFVF(D3DFVF_XYZ);// | D3DFVF_DIFFUSE);// | D3DFVF_TEX1);       // set the index buffer     //device->SetIndices(IndexBuffer);       // Position and aim the camera     // TODO:  This should probably be moved into the main rendering loop, as it may change in game //D3DXVECTOR3 position(1.0f, 1.0f, -3.0f); //D3DXVECTOR3 target(0.0f, 0.0f, 0.0f); //D3DXVECTOR3 up(0.0f, 1.0f, 0.0f);     //D3DXMATRIX V; //D3DXMatrixLookAtLH(&V, &position, &target, &up);       //device->SetTransform(D3DTS_VIEW, &V);   // Set the projection matrix D3DXMATRIX proj; D3DXMatrixPerspectiveFovLH( &proj, D3DX_PI * 0.5f, // 90 - degree (float)d3dpp.BackBufferWidth / (float)d3dpp.BackBufferHeight, 1.0f, 1000.0f); device->SetTransform(D3DTS_PROJECTION, &proj);   // set render state - wireframe mode device->SetRenderState(D3DRS_FILLMODE , D3DFILL_WIREFRAME);     // Now enter the rendering loop, this renders the game objects float x,y,dx,dy; dx=+0.1f;dy=0.0f;x=0.0f;y=0.0f;   //D3DXVECTOR3 position((float)x, (float)y, -3.0f); D3DXVECTOR3 target(0.0f, 0.0f, 0.0f); D3DXVECTOR3 up(0.0f, 1.0f, 0.0f); D3DXMATRIX V;   while(!bQuit){ x+=dx;y+=dy; if(x>1.0f) dy=0.0f-dx;dx=0.0f;x=1.0f; if(x<-1.0f) dy=0.0f-dx;dx=0.0f;x=-1.0f; if(y>1.0f) dx=dy;dy=0.0f;y=1.0f; if(y<-1.0f) dx=dy;dy=0.0f;y=-1.0f; D3DXVECTOR3 position(x, y, -3.0f);     // Position and aim the camera // TODO:  This should probably be moved into the main rendering loop, as it may change in game   D3DXMatrixLookAtLH(&V, &position, &target, &up); device->SetTransform(D3DTS_VIEW, &V);     //bQuit = true; device->Clear(0 , 0 , D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER , 0xffffffff , 1.0f , 0); device->BeginScene(); // draw code goes here      // set stream source (attach vertex buffer to rendering pipeline) device->SetStreamSource(0 , VertexBuffer , 0 , sizeof(Vertex));   // set the vertex format device->SetFVF(Vertex::FVF); // | D3DFVF_DIFFUSE);// | D3DFVF_TEX1);   // set the index buffer device->SetIndices(IndexBuffer);   // draw the primitive, which in this case is a triangle device->DrawIndexedPrimitive(D3DPT_TRIANGLELIST , 0 , 0 , 36 , 0 , 12);                 // done drawing device->EndScene(); // present the scene, usually copies the backbuffer to the screen device->Present(0 , 0 , 0 , 0);   // be multitask friendly Sleep(1); }   VertexBuffer->Release(); IndexBuffer->Release();     device->Release(); d3d9->Release(); return 0; }
  5. Summoning, Healing, Combat Stats

    Have you considered putting it on Steam Greenlight and Early Access?  it looks better than a lot of games there.
  6. Best comment ever

    I'm honestly at a loss as to what other posts you found derisive or combative.  If you could PM me with details Ill review and edit them.
  7. Spaghetti code

    Labview, that is a love/hate relationship.  Unfortunately, its not really feasible to "write" useful "code" in labview without it becoming spaghetti.  My suggestion is use labview to handle the GUI stuff, and pipe all the data from the various dials etc into a DLL, then use C++ or your favorite language to do the actual computation and export it to labview for display.
  8. Unreal Engine && graphics cards

    There are desktop systems that are easy enough to tear down and set up in a hotel room.  I've done this a few times when travelling, but i agree, a laptop is a must for client demos. There are desktop systems that are easy enough to tear down and set up in a hotel room.  I've done this a few times when travelling, but a laptop is a must for client demos.
  9. IDE Suggestions, ditching Code::Blocks

    Yeah I've used 4.0 6.0 2005 2008 Professional and 2012? and 2015 Express.  I've also used Turbo C++ (circa 93( , LCC code::blocks, and a few others i forget , I just don't have the bandwidth to download VS on my new system or I would.  It's metered internet, hoping that will change in the next few weeks.  I actually figured out the problem, read only bit somehow got set on the folder,  There are only 2 C::B git plugins, and neither one is written for windows or has a downloadable setup.
  10. My system experienced a fan lockup last night and shut down.  I wasn't too concerned until I got to work on my game and oh look, apparently code::blocks doesn't back up files and also does not perform atomic saves.  main.c is just blank  Really glad I wasn't working on one of my commercial projects. Anyhow, I need a new IDE.  Any suggestions?  Not really looking forward to downloading Visual Studio Express, and my newest commercial version is 6.0
  11. Best comment ever

    The old code stoned, review sober paradigm.    Some of my best, least understandable code was written that way.
  12. Linux has dameons, Windows has System Services.  IMO its easier to write a system service than a daemon, mostly because I already have a system service skeleton written that handles network connection, authentication, and redirect.     Linux servers are more common though, and cheaper.  For a small developer this may not be an issue, but if you have to buy a couple dozen copies of Windows for your server farm, it can get pricey.  
  13. Code signing certificates

    Largely it has done nothing for security as far as the end user is concerned.  It has done zero from a developer's standpoint that I have seen.  I am gradually trying to move my code to linux, but that has its own problems, like piss poor webcam support for anything other than literally viewing the webcam.  I need full PTZ and real time decoding to RGB buffers.  but that is such a small niche market they disregard it.
  14. Neural Network AI Discussion Group on USENET. you can access it through google groups.  It's probably nothing but spam by now though, I think the group started dying since eternal september.
  15. Is starting with gamedev too much?

    C/C++ is the best language to learn as a first language.  It shares concepts and keywords with most other high level languages such as C#, Java, Javascript, etc.  Learning it first makes learning those other languages easier, but not necessarily the other way around.  C# is simpler for beginners to avoid mistakes, because it wipes your butt for you a lot, but it also encourages, or at least fails to discourage, bad programming habits, like the infamous failure to deallocate memory and other resources.  It also doesn't really bring anything to the table that I have seen.  Admittedly I've only been using it sporadically for a couple years now, and mostly just for writing scripts in Space Engineers.  Everything I write professionally is in C++ or assembly.     What framework you use is entirely up to personal taste.  Frameworks change more often than the weather, and what is popular today might be deprecated a few years from now.  Understand that I'm coming from 35 years of programming. My first game was written in GW-BASIC (Nuclear Bomber) and everything was line art and sprites.  When I started serious (non-game) programming, DOOM (the original) and Castle Wolfenstein (the Original) were the epitome of high end game development, raster operations where done by the CPU, most of which didn't even have floating point units, graphics cards were little more than VRAM and a DAC.  Over the years I've seen hundreds of frameworks come and go, and even a few languages, but C++ has stuck around.  So I'm not basing my suggestion on some entrenched elitism.  C++ is here to stay.  It has everything a language truly needs and 50+ years of history.  You will never regret learning C++ as your first language.