Jump to content
  • Advertisement

gcooper

Member
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

130 Neutral

About gcooper

  • Rank
    Newbie
  1. Assimp::Importer importer; const aiScene* scene = importer.ReadFile("table.3DS", aiProcess_CalcTangentSpace | aiProcess_Triangulate | aiProcess_JoinIdenticalVertices | aiProcess_SortByPType | aiProcess_MakeLeftHanded ); // If the import failed, report it if (!scene) { MessageBoxA(0, importer.GetErrorString(), "",0); } std::vector<DWORD> indices; std::vector<Vertex> vertices; for (unsigned int i = 0; i < scene->mNumMeshes; i++) { const aiMesh* paiMesh = scene->mMeshes[i]; for (unsigned int e = 0; e < paiMesh->mNumFaces; e++){ const aiFace& Face = paiMesh->mFaces[i]; indices.push_back(Face.mIndices[0]); indices.push_back(Face.mIndices[1]); indices.push_back(Face.mIndices[2]); } for (unsigned int r = 0; r < paiMesh->mNumVertices; r++){ Vertex v; v.pos.x = paiMesh->mVertices[r].x; v.pos.y = paiMesh->mVertices[r].y; v.pos.z = paiMesh->mVertices[r].z; vertices.push_back(v); v.texCoord.x = paiMesh->mTextureCoords[0][r].x; v.texCoord.y = paiMesh->mTextureCoords[0][r].y; } } So I use the above code to load a model. Keep in mind that there is no issue with vertex/index buffers, i'm already rendering cubes with vertices& indices writen in code, so no problem there.   I am using TRIANGLELIST for topology.   All I get is a triangle, or a couple of triangles, no matter what model I try.   Any ideeas?
  2. I have a FTP stream that writes the data it receives to a local file, and it does so just fine. However, I'd like to save that data in the memory, as a string(since its actually text).   So I went to the part of the code where I'm writing to the local file stream, and added: MemoryStream stream = new MemoryStream(); while (bytesRead > 0) { stream.Write(byteBuffer, 0, bytesRead); localFileStream.Write(byteBuffer, 0, bytesRead); bytesRead = ftpStream.Read(byteBuffer, 0, bufferSize); } StreamReader s = new StreamReader(stream); return s.ReadToEnd();   The file & its content gets created ok, but the returned string is empty. Am I missing something?
  3.   Yes, the pointer keys I am using are not from the same array. Can you explain a bit, how this generates undefined behavior? I mean, since they're pointers, to compare the keys, the addresses are the only thing that is compared, right?     Well, I'm not sure if I explained correctly, but I delete the item from the map, before actually creating an iterator and looping through it(so I'm not deleting anything while iterating it).     As for the code, I'll try to get access to it as soon as possible(I don't work alone on it, and I currently don't have access at this time).
  4. Suppose I have a class AS, and I make a map that contains pointers of that type, and uses as keys, the addresses of AS objects, so:   std::map<AS*,AS*> mymap;   Suppose I add 2 items. And execute the following loop.   typedef std::map<AS*,AS*>::iterator it_type;   for(it_type iterator = mymap.begin(); iterator != mymap.end(); iterator++) { iterator->first->update().   }   I all works fine. Then,suppose I delete one item.   And execute the loop again.     That loop raises an error saying that it cannot increment the iterator.   What could be the problem?
  5. gcooper

    Price for this GPU

    So, I have this old GPU standing around, and I'm thinking about selling it, however I can't manage to find any others on the web just to get an idea about the price: http://www.newegg.com/Product/Product.aspx?Item=N82E16814130496   Any recommendations?
  6. So, consider the following code: #ifndef HEADER1 #define HEADER1 #include "header2.h" #endif Keep in mind that header 2 also has header guards, and all my other headers in the project. However, when I compile the above code, I get an error saying that namespaces/classes that EXIST in header2 don't actually exist.   But then I tried an old trick: #ifndef HEADER1 #define HEADER1 namespace namespace_in_header2{ class class_i_need; } #endif And after that I only included the actual header2.h in my header1.cpp. And it worked!   I'm sure that the first problem is caused somehow, by including header 2 again and again until chaos happens. But why? I mean all my header have header guards! Also, why including header2.h only in the cpp file fixes things? Wouldn't there still be a way in which it still gets added 2 or more times?    
  • 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!