Jump to content
  • Advertisement

Unliterate

Member
  • Content Count

    160
  • Joined

  • Last visited

Community Reputation

122 Neutral

About Unliterate

  • Rank
    Member
  1. It's not as big of a deal as I've made it out to be, but it was akward questioning his syntax and getting a reply like :"That's because you want to have the array be diferent sizes" . (I almost took it as an insult.. lol, it's a second year class so why not assume the students understand at least the first month stuff of the first year class?), I should have made myself more clear to him.
  2. Oh, whats g++ because thats the command we use to compile it. (He has us do virtually ALL file manipulation through the stupid linux console), I wonder why he didnt explain any of this from the start, let alone once i brought up my confusion.
  3. No no no , lol ,thank you guys for the replies but your making inferences! I'm not confused as to why it DOESNT work for ME, im confused as to why it DOES work for HIM and why this dude who took c++ in college has no idea what I'm talking about. I've been coding c++ for slightly over a year now and I didnt think it what he was doing was valid, but it does compile at school! I cant figure out why. edit: yea graveyard im positive, this makes no sence. edit2: what exaclty is C99? i guess that must be what we're doing...
  4. : error C2057: expected constant expression : error C2466: cannot allocate an array of constant size 0 : error C2133: 'array' : unknown size
  5. We started coding in my c++ class today, and the instructor has int var; cin>>var; int array[var]; which compiles on the compilers at school but not on MVSC++ which i use. Now I thought when you declared arrays like this, the array was created at run time and I thought the only way to do something to this effect was with int *array=new int[var]; but that doesnt explain why it compiles on the comps at school or why the instructor had no clue what I was talking about. Is this compiler specific? We're using some linux compiler at school.
  6. Unliterate

    Incorrect undeclared identifier message??

    yup that was it, thanks!
  7. I'm try to use a INPUT and KEYBDINPUT structure from the winuser.h file (included by windows.h) but it keeps saying undeclared identifier, even though when I have INPUT Inputs; and type Inputs. , it shows me a list of the members?! I tried moving the lines that declare it out of the ifdef statements (right to the begining of the .h) but that didnt work either.. Any ideas?
  8. Unliterate

    Threaded class functions?

    Ah, thank you both for the quick/accurate help! Now I'm assuming I can still modify these static values within the class function as I would if they were normal class variables (I'm not getting any errors at least). Is this so?
  9. Unliterate

    Threaded class functions?

    Thanks for the responce. I applied the suggestion with moderate succes, I also made all the variables that the threaded function accesses static,and no longer get compile errors but now I get: error LNK2001: unresolved external symbol "private: static int NETWORK::number_of_connections" for each of the staticed variables. I've never used static befor but I followed the msdn example correctly as far as I can tell, the diference being they accessed the static variable outside of the class functions while I am trying to do so inside the class function, is this not doable? The threaded function will need to access two variables from the class, is there a better way to go about doing this?
  10. Are these possible? I have a class with the DWORD CALLBACK function(); defined as a private member of that class, but I keep getting "cannot convert parameter 3 from 'unsigned long (void *)' to 'unsigned long (__stdcall *)(void *)" when I call CreateThread(), wether I have NETWORK::ThreadedReceive and just ThreadedReceive as the third param. void NETWORK::Receive() { if(!receiving&&started_up) { receiving=true; DWORD dwThreadId=1; HANDLE AcceptThread; AcceptThread = CreateThread( NULL, // default security attributes NULL, // use default stack size NETWORK::ThreadedReceive, // thread function NULL, // argument to thread function NULL, // use default creation flags &dwThreadId); // returns the thread identifier } } //*********************************************************** DWORD CALLBACK NETWORK::ThreadedReceive(LPVOID lParam) { char temp_buffer[30]; int result; COORD message={0,4},temp={0,10}; while(true) { result=recv(Socket,temp_buffer,30,0); if(result!=0&&result!=SOCKET_ERROR) receive_buffer=temp_buffer; } return NULL; } class NETWORK { public: //blah Receive(); private: //blah DWORD CALLBACK ThreadedReceive(LPVOID lParam); }; hmmm. Could it be because a public function is referencing a private function? edit: oh i also get the same message when i use DWORD WINAPI function() as msdn does in its example. [Edited by - Unliterate on September 11, 2004 3:30:39 PM]
  11. Unliterate

    Vertices not appearing on screen

    thanks a million, I'm gona start reading the tutorials a little slower ;).
  12. I know this is a cross post but it's just not getting anywhere on the beginers forum and I guess its more suited for here anyway. Well I can get pretransformed vertices on the screen just fine but its the non-pretransformed ones that I can't get to show up, Nothing is failing, and all values seem to be what they should, and sprites render fine. This is very frusterating, and again everything works perfectly when im using pretransformed vertices. vertices: D3DXVECTOR3 vertices[4000]; D3DXVECTOR2 texture_coords[4000]; D3DCOLOR colors[4000]; vertices[0].x=-10; vertices[0].y=10; vertices[0].z=2; colors[0]=D3DCOLOR_ARGB(122,0,255,0); texture_coords[0].x=0; texture_coords[0].y=0; vertices[1].x=10; vertices[1].y=10; vertices[1].z=2; colors[1]=D3DCOLOR_ARGB(122,0,255,0); texture_coords[1].x=1; texture_coords[1].y=0; vertices[2].x=-10; vertices[2].y=-10; vertices[2].z=2; colors[2]=D3DCOLOR_ARGB(122,0,255,0); texture_coords[2].x=0; texture_coords[2].y=1; vertices[3].x=10; vertices[3].y=-10; vertices[3].z=2; colors[3]=D3DCOLOR_ARGB(122,0,255,0); texture_coords[3].x=1; texture_coords[3].y=1; //(im not using textures so that can be ignored) Game->Display.LoadVertexData(vertices,texture_coords,colors,4); in the header: struct CUSTOM_VERTEX{ float x,y,z/*,rhw*//*,tu,tv*/; DWORD color; }; #define CustomFVF (D3DFVF_XYZ|D3DFVF_DIFFUSE) fill vertex buffer: void DISPLAY::LoadVertexData(D3DXVECTOR3 *coordinates,D3DXVECTOR2 *texture_coordinates,D3DCOLOR *colors,int number_of_vertices) { VOID* pVertices; if(FAILED(D3DVertexBuffer->Lock(0,0,(void**) &pVertices,D3DLOCK_DISCARD/*entire buffer is overwritten*/))) { MessageBox(window,"Failed to lock the vertex buffer!","Damn!",MB_ICONEXCLAMATION | MB_OK); return; } for(int index=0;index<number_of_vertices;index++) { screen_vertices[index].x=coordinates[index].x; screen_vertices[index].y=coordinates[index].y; screen_vertices[index].z=coordinates[index].z; // screen_vertices[index].tu=texture_coordinates[index].x; // screen_vertices[index].tv=texture_coordinates[index].y; screen_vertices[index].color=colors[index]; // screen_vertices[index].rhw=0.5f; } memcpy(pVertices,screen_vertices,sizeof(screen_vertices)); if(FAILED(D3DVertexBuffer->Unlock())) MessageBox(window,"Failed to unlock the vertex buffer!","Damn!",MB_ICONEXCLAMATION | MB_OK); } inline void Refresh() { Game->Display.BeginRendering(); int primitive_count[2]; int starts[2]; // Game->Display.SetTexture(1); starts[0]=0; primitive_count[0]=2; starts[1]=1999; primitive_count[1]=30; Game->Display.RenderVertices(starts,primitive_count,1); Game->Display.BeginSpriteRendering(); if(Game->fps_display) { Game->Text.D3DDrawText("FPS",D3DXVECTOR2(0,0),&D3DXVECTOR2(.5,.8)); Game->Text.D3DDrawText(1/Time.TimeMultiple,D3DXVECTOR2(40,0),NULL); } // Game->Display.DrawSpriteToBuffer(1,&D3DXVECTOR2(300,300),NULL,NULL,NULL,NULL); Game->Display.EndSpriteRendering(); Game->Display.EndRendering(); } void DISPLAY::RenderVertices(int *vertice_starts,int *number_of_primitives,int number_of_unique_primitive_sets) { D3DRenderDevice->SetStreamSource(0,D3DVertexBuffer,0,sizeof(CUSTOM_VERTEX)); D3DRenderDevice->SetFVF(CustomFVF); D3DXMATRIX World,View,Perspective; D3DXMatrixIdentity(&World); D3DRenderDevice->SetTransform(D3DTS_WORLD,&World); D3DXMatrixPerspectiveFovLH(&Perspective, D3DX_PI/4,//verticle FOV, (90º) 1024/768,//viewing aspect ratio 1,//minimum distance clip 100//maximum distance clip ); D3DRenderDevice->SetTransform(D3DTS_PROJECTION,&Perspective); D3DXMatrixLookAtLH(&View, &D3DXVECTOR3(0,0,-1),//camera vector &D3DXVECTOR3(0,0,0), //camera target &D3DXVECTOR3(0,1,0));//up D3DRenderDevice->SetTransform(D3DTS_VIEW,&View); for(int index=0;index<number_of_unique_primitive_sets;index++) tester=D3DRenderDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP,vertice_starts[index],number_of_primitives[index]); } any help or ideas are appreciated.
  13. I'm not using RHW so I'm assuming z can be anything. I set the minimum clip to 1 and all the z values of the coordinates to 2 but I still see nothing. Can someone explain exaclty how the clipping will work? if I have the camera at z=-1, and the clipping planes at 1,50. vertices will only appear if their z coordinate is between 0 and 49 (after rotations and whatnot) correct?
  14. this still results in no vertices. I labeled all the things with what i think their purpose is, can anyone see anything wrong here: void DISPLAY::RenderVertices(int *vertice_starts,int *number_of_primitives,int number_of_unique_primitive_sets) { D3DRenderDevice->SetStreamSource(0,D3DVertexBuffer,0,sizeof(CUSTOM_VERTEX)); D3DRenderDevice->SetFVF(CustomFVF); D3DXMATRIX World,View,Perspective; D3DXMatrixIdentity(&World); D3DRenderDevice->SetTransform(D3DTS_WORLD,&World); D3DXMatrixPerspectiveFovLH(&Perspective, D3DX_PI/4,//verticle FOV, (90º) 1024/768,//viewing aspect ratio 0,//minimum distance clip 100//maximum distance clip ); D3DRenderDevice->SetTransform(D3DTS_PROJECTION,&Perspective); D3DXMatrixLookAtLH(&View, &D3DXVECTOR3(0,0,-1),//camera vector (x,y,z)? &D3DXVECTOR3(0,0,0), //camera target &D3DXVECTOR3(0,1,0));//up D3DRenderDevice->SetTransform(D3DTS_VIEW,&View); for(int index=0;index<number_of_unique_primitive_sets;index++) D3DRenderDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP,vertice_starts[index],number_of_primitives[index]); } I'm rendering 4 vertices at (-10,10,1),(10,10,1),(-10,-10,1), and (10,-10,1). can anyone tell me where about on the screen these should be appearing? [Edited by - Unliterate on September 3, 2004 4:24:04 PM]
  15. christ, the fact that i keep making simple mistakes like that is starting to frighten me. thanks tho that was the exact prob. I guess when I was copy/pasting as I added textures to my vertices I forgot to make the change, I looked over that function 10+ times . I cant fathom how i missed that so many times. now to discover the incredibly obvious typo im making that prevents me from using non-pretransformed vertices (see my post on beginers forum).
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net 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!