• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

124 Neutral

About Darjk

  • Rank
  1. Cheers dmatter, Was looking at that thread earlier but got sidetracked when I got to your links to OO principles and didn't get to your last post. All your points are very valid, especially in regards to Texture objects loading themselves. Once I've implemented my VFS, that would of caused headaches. Though I guess in particular I'm curious as to point 4 and loading a texture into the GPU memory for use. Actually never mind, there is a simply solution to that. Load from the VFS, load into GPU if needed (vertices / texture / whatever), then pass off to the Resource Manager to "mind". Then there is a question of cleaning up, though that can be done by passing a pointer to a clean up function when allocating the manager. Not the most elegant solution.. but it would work. Don't think I really understood the use of the "TextureAllocator object" but will see how it goes! Makes sense to use SRP and easier to debug as well. Thanks again.
  2. No idea if this is the right board but figured its game-related. This is probably more of a question about the design and theory behind it, as there are already plenty of threads about Resource Managers. Having already gone through all the threads related to the topic. My question is about having the ResourceManager doing the loading of the file as well. Most people seemed to be quite harsh against those that did it that way but I don't fully understand why? I guess if its purely for a "generic game engine X", then yeah you would want the user of the engine to have the flexibility to load the files how and when he wants. But if you're coding more of a frame work then where is the harm? Whether its pre-loaded then passed to the manager, or the manager loads it directly. I'm going to word "frame work" here as "engine" is over used and this specific project is intended only to be used with an (tool program) application. So method A: Resource is loaded by the game/program then passed onto the ResourceManager ("the engine") to look after whats been loaded, what can be re-used, what can be destroyed, etc. Basically a reference counter with associated name and object. What advantage does this have over just using boost::smart_ptr? Method B: The manager does all of the above, as well as handling how its created, destroyed, cleaned up, loaded onto the GPU if needed, etc. Not really OOP etiquette, but sure seems to be a simplified way of doing it. Are there any other common methods of handling resources? I know.. (I think it was) Yann came up with quite a complex resource handling system but I'm trying to keep things simple. As I mentioned its not a next-gen MMO, or the next Quake 5000, nor Oblivion clone, just an tool editing application that also acts as a bit of a tech-demo. I'm currently using Method A using templated class-inheritance, polymorphism, vectors/maps, etc and thats all fine. But now considering taking it further. I think thats mainly whats on my mind, have other questions regarding materials, mesh, surfaces, shaders, etc but thats a whole other bag of tricks. Just a FYI - I'm not a "beginner" per-se, just a hobbyist so I don't really mingle with many other programmers, communities, nor getting other points of view. Which is why I'm asking here, to gain a better understanding of why certain designs are used over others. Thanks all for your time!
  3. Making pong clone, what's next?

    After pong, there is nothing greater. It was and is the greatest game around! :) Seriously though, what Rip-off says is true. Copy-and-pasting doesn't achieve too much, it does help to gain an understanding.. but a very basic one. Writing small applications & games is a great way to go. Don't bite off more than you can chew, otherwise you'll tend to find yourself encountering problems that are overwhelming resulting in a lot of incomplete projects. Personally I started off with (very) basic stuff such as little 2D GDI programs, map makers, solution finding apps (reading memory and giving the best possible outcome). Then moved onto 3D (DirectX 7) of basic games but with enhanced lighting, effects, etc. Once I had that sorted moved onto OpenGL full-immersive tech demo's. Now I play with 3D Tools app programming, basic graphical engines, etc. It really comes down to understanding the concepts, the logic, the process, methodology. Problem solving & logic as Rip-off says. No one can really suggest what to "do next" as only you know what level of understanding you are at.
  4. Thanks for sharing that bzroom. Its a lot bigger and more comprehensive than what I need in my framework, but it has given me a few idea's in regards to resources and materials. Cheers.
  5. This thread has been a great read for me, however I'm just having one design concept problem for my "framework". Its not exactly an engine though it is similar for its purpose (which I'm sorry to say isn't game related this time). Essentially I have this frame work, which so far is designed pretty well, however I was just starting to write out my thoughts on the texture and material system implementations. That alone is pretty straight forward, however it has to be API independent. Currently the Renderer supports both OpenGL and Direct3D, but I'm not quite sure how to go about doing this with the Texture Manager. Now the question, do I make it a sub-system of the Graphics Renderer, or would a better way be to just have it interact with the Renderer directly. Such as, TextureManager::LoadTexture(filename) which would do all the file reading and prepare the texture data into a data buffer. Once the data is ready, a pointer to that buffer is passed to the Renderer to "LoadTexture" returning either a GLuint or LPDIRECT3DTEXTURE9, which is then "managed" to keep track of how many materials are referencing the texture. Am I on the right track to achieve my goal, or is there a more effective and efficient way or going about it? The reason I also brushed off the making it a "sub system" of the Renderer so easily is because I'm also giving the TextureManager the job of loading a whole variety of texture formats. Originally I was going to use a plugin style architecture and write separate DLL plugins to handle particular formats, but I just don't have as much time as I use to and am getting to the point where hard-coding it all in would be faster. Cheers for any feedback or critique.
  6. Are you linking to the Glew DLL and/or Libs? Such as "#pragma comment( lib, "glew32.lib" )" Edit: Also will want to make sure the DLL is in either your Build/Bin directory or is in your System32 directory.
  7. Object Selection Tutorial

    There is a "Picking" tutorial as well as an article on the use of glUnProject. First one being a lot more basic and possibly not much use to most 3D games. The second however more or less tells you how to convert screen coords into 3D coords in your 3D world. The only thing missing is the figuring out what those coordinates intersect with, by taking those coordinates and comparing it against the volume of the "hit boxes" of all the objects in your scene (or view frustum) to find what was selected. I agree that it would be nice for a more complete tutorial to make it easier for people to learn something, that is very much required for any 3D game (and tools, apps, etc).
  8. char's and char*'s in structs

    First you'll need to include the appropriate headers, then its just a matter of using the string class type. For example: #include <string> std::string myString("a string that contains the name Bob"); int myFunc() { // Now you can do things like get the how many chars are in the string int count = myString.length(); // count should now hold the value 35 // or you can get a sub-string of the original std::string mySubString = myString.substr(17) // mySubString should now contain "tains the name Bob" or so return 0; } Reference books/documentation/websites come in handy, such as http://www.cppreference.com/cppstring/index.html
  9. I love the colour map idea and has given me some idea's for my own possible project. A couple years or so back I was looking to turn a board-game into a computer game, but I do was having problems with extreme irregularly shaped places on the board. I also didn't want to go out creating all the correctly shaped polygons for it either which ruled out the poly-intersection method. In the end I didn't go through with it, as it was just going to be a little game for me and my friends as the board game itself takes forever to set up. Love visiting these forums, never know what snippets of good idea's you'll come out with.
  10. FBO - Screenshots?

    Thanks Phantom, figured it would be something simple. Now to implement it and hope that it all works happily together :) Edit: Cheers Phantom, doing glReadPIxels() while it was still bound worked a treat. Previously I was Binding, Rendering, Unbinding, then checking which as you know didn't give me what I wanted. Have it all working well with both my GIF animation exporter and Screenshot Saving. [Edited by - Darjk on May 6, 2006 10:57:47 PM]
  11. G'day all, I just spent the past 30 minutes adding support for both FBO and PixelBuffers which are all working fine. Now I want to switch over my image saving code to make use of them but I have absolutely no idea, and I'm sure its something simple as scouring the net for info has been a lost cause. My current screenshots are being done with the standard glReadPixels() from the Back Buffer which works ok - I just have no idea how to get the image data from the texture that both the FBO and PBuffer have rendered to. Been trying to figure it out for the past couple of hours now with no luck and I know its something simple that I'm missing :( Any info / links / code would be greatly appreciated. Cheers.
  12. Actually WoW creature models have about 20-30 bones. Character models have around 95 bones and 40 "attachment" spots. Vertex count for both ranges between 2000-3500. This is for the Male Human character model, View #6 LOD: 256 Vertices: 3179 Block E - Bones [96 records] NUM ID Flags Parent GeoID Translation Rotation Scaling Pivot point #0 -1 512 -1 0 0 0 1 22 0 0 0 0 0 #1 22 0 -1 0 0 0 0 0 0 0 -0.0772443 0 2.21233 #2 -1 0 -1 0 0 0 0 0 0 0 -0.0836863 0 2.02715 etc. These bones are there for everything from the characters movement, to wearing armour and items, cloaks, tabards, and so forth. It all uses the bone system to attach onto and to move the items correctly as the model moves around. The models also have anywhere from 1 to 150 animations imbedded into the models. [Edited by - Darjk on January 22, 2006 12:56:27 AM]
  13. G'day, just wondering if anyone knows of some decent information or tutorials or anything of the such on Ribbon Emitters? I've searched around and there really isn't that much information about them, and absolutely zero tutorials or articles from what I could find. I'm guessing that 'ribbon emitter' is the correct term as Blizzard, Auran, etc are referring to it as such. I know the basic principle and for the most part have it working, but it just isn't right and in the end looks quite awful and better off with out. So far my Ribbon Emitter has the standard info like number of segments, size of segments, etc, aswell as info for each segment like colour, opacity, firstPos, secondPos, duration, and what have you. I'm using a STL list to store each segment which works for the most part but it needs polishing something chronic, so if anyone knows of some examples / articles / demos I would be in your debt! Cheers.
  14. We use this function to load out BLP textures in a project I'm involved with. This is used to load BLP textures from World of Warcraft, but I'm pretty sure that they didn't modify their BLP format from Warcraft3 so this should work with it aswell. void TextureManager::LoadBLP(GLuint id, Texture *tex) { // load BLP texture glBindTexture(GL_TEXTURE_2D, id); int offsets[16],sizes[16],w,h; GLint format; char attr[4]; MPQFile f(tex->name.c_str()); if (f.isEof()) { tex->id = 0; return; } f.seek(8); f.read(attr,4); f.read(&w,4); f.read(&h,4); f.read(offsets,4*16); f.read(sizes,4*16); tex->w = w; tex->h = h; bool hasmipmaps = attr[4]>0; int mipmax = hasmipmaps ? 16 : 1; if (attr[0] == 2) { // compressed unsigned char *ucbuf; if (!supportCompression) ucbuf = new unsigned char[w*h*4]; format = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; int blocksize = 8; // guesswork here :( if (attr[1]==8) { format = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; blocksize = 16; } else { if (!attr[3]) format = GL_COMPRESSED_RGB_S3TC_DXT1_EXT; } tex->compressed = true; unsigned char *buf = new unsigned char[sizes[0]]; // do every mipmap level for (int i=0; i<mipmax; i++) { if (w==0) w = 1; if (h==0) h = 1; if (offsets[i] && sizes[i]) { f.seek(offsets[i]); f.read(buf,sizes[i]); int size = ((w+3)/4) * ((h+3)/4) * blocksize; if (supportCompression) { glCompressedTexImage2DARB(GL_TEXTURE_2D, i, format, w, h, 0, size, buf); } else { decompressDXTC(format, w, h, size, buf, ucbuf); glTexImage2D(GL_TEXTURE_2D, i, GL_RGBA8, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ucbuf); } } else break; w >>= 1; h >>= 1; } delete[] buf; if (!supportCompression) delete[] ucbuf; } else if (attr[0]==1) { // uncompressed unsigned int pal[256]; f.read(pal,1024); unsigned char *buf = new unsigned char[sizes[0]]; unsigned int *buf2 = new unsigned int[w*h]; unsigned int *p; unsigned char *c, *a; int alphabits = attr[1]; bool hasalpha = alphabits!=0; tex->compressed = false; for (int i=0; i<mipmax; i++) { if (w==0) w = 1; if (h==0) h = 1; if (offsets[i] && sizes[i]) { f.seek(offsets[i]); f.read(buf,sizes[i]); int cnt = 0; p = buf2; c = buf; a = buf + w*h; for (int y=0; y<h; y++) { for (int x=0; x<w; x++) { unsigned int k = pal[*c++]; k = ((k&0x00FF0000)>>16) | ((k&0x0000FF00)) | ((k& 0x000000FF)<<16); int alpha; if (hasalpha) { if (alphabits == 8) { alpha = (*a++); } else if (alphabits == 1) { //alpha = (*a & (128 >> cnt++)) ? 0xff : 0; alpha = (*a & (1 << cnt++)) ? 0xff : 0; if (cnt == 8) { cnt = 0; a++; } } } else alpha = 0xff; k |= alpha << 24; *p++ = k; } } glTexImage2D(GL_TEXTURE_2D, i, GL_RGBA8, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, buf2); } else break; w >>= 1; h >>= 1; } delete[] buf2; delete[] buf; } f.close(); if (hasmipmaps) { glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR); } else { glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); } // some models require texture wrapping though glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE); } Naturally you would have to change things like "MPQFile f(tex->name.c_str());" and actually open the BLP file instead, but this should give you the gist of it. Also the BLP format is closer to TGA's, not JPEG's.
  • Advertisement