Jump to content
  • Advertisement

FunLogic

Member
  • Content Count

    48
  • Joined

  • Last visited

Community Reputation

154 Neutral

About FunLogic

  • Rank
    GDNet+
  1. I'm having some trouble running an MD2 Model Loader on Vista 64-bit. The loader itself works perfectly on 32-bit XP, so I figured all I would need to do is recompile the project in VS2008, sadly it doesn't seem to have had any effect. Here's the relevant section of code: std::ifstream fFile; S_MD2Header header; fFile.open(pFilename, std::ios::in | std::ios::binary); if(!fFile.is_open()) { return false; } fFile.read(reinterpret_cast<char*>(&header), sizeof(S_MD2Header)); if((header.indent != MD2_IDENT) && (header.version != MD2_VERSION)) { fFile.close(); return false; } The file is opened correctly but when I call std::ifstream::read() all that is placed inside the header is zeros. What am I missing?
  2. I'm trying to compile some simple OOP samples from the Lua wiki, and there appears to be some problems involving scope. Here's the code: System.lua: module("system", package.seeall) -- function extends(base_class) local new_class = { } local class_mt = { __index = new_class } -- function new_class:create() local new_inst = { } setmetatable(new_inst, class_mt ) return new_inst end if base then setmetatable(new_class, { __index = base_class } ) end return new_class end Object.lua: require "system" module("object", package.seeall) object = extends(nil) -- function object:set_name(name) _name = name return end -- function object:get_name() return _name end Boot.lua: require "object" -- local function boot() local test test = object:create() test:set_name("Test_Object_01") print(test:get_name()) return end The error I get back from attempting to run this program (starting at boot()) is that an attempt to call method 'create' failed because of a nil value. I'm thinking this is a result of how I'm linking / 'requiring' the modules. Any ideas?
  3. FunLogic

    Void pointers and casting

    Thanks for all the replies Quote:stop passing it NULL? Nope, not the problem. Quote:Why? If you know what to cast it to, why wouldn't you just accept that kind of pointer? Because I didn't write, and cannot re-write the functions prototype. Quote:We'll need to see some code if that's not similar to what you have. In my code, the function in the base class is pure virtual, and is redefined by the derived class. (Perhaps I should have mentioned that to begin with).
  4. I've got a function that takes a void pointer as an argument (pParam) and in the body of the function I need to be able to cast the void pointer to a pointer of a base class and call one of the base classes member functions. I've tried all different ways of casting the pointer but the program is still throwing errors (Access violation). Any ideas?
  5. FunLogic

    Chase camera

    Chase Camera Sample ^ It's in C# using the XNA Framework, but if you take a look at the source you should be able to port the code into whatever language you're using. It's a pretty good chase camera implementation.
  6. Quote:Is it a good practice to store a VB and IB for each patch? I would appreciate an answer to this one myself as it's something I'm working on as well. The approach I'm currently taking is to use a dynamic index buffer and a single vertex buffer. Traverse the quad tree and assemble the index buffer from the indices stored in the visible patches, then draw.
  7. FunLogic

    Texturing terrain slopes

    Quote:Original post by Treesong ... 3b. Detail texturing In the fragment shader, use the elevation and the components of surface normal to calculate blend factors for blending (tiling) detail textures. The surface normal manipulates the blend factor for steep or flat terrain sections, the elevation selects different textures to match the altitude. Pro's - No hand made terrain matching texture needed - Very good result are possible - High resolution texturing - Alternative info can be used to improve/alter detail texture selection - No texel stretching - As many different textures as the hardware allows are possible. Con's - Shaders needed - Only for modern hardware - More difficult to implement - All possible detail textures must be available in the fragment shader ... Great post thanks, but 3b. was all I was after - Rating++ for the help!
  8. Presently I'm texturing my terrain based on vertex heights, which is okay but the results it produces are not very natural looking. I was wondering what's the best way to go about texturing terrain geometry that takes into account slope angles, so that steeper areas can be textured to look like rock and flat areas like grass etc. Would I be along the right lines in thinking that the terrains surface normals are what I would use to compute the correct texture to use? I've searched around for some tutorials that cover terrain texturing this way but with no luck - any help would be greatly appreciated. Thanks!
  9. FunLogic

    SDL 1.2.12 app not compiling

    Yeah tried that. Unfortunately it didn't seem to work. It's only happening in VS, so for the moment I've just switched compilers.
  10. FunLogic

    SDL 1.2.12 app not compiling

    Compiles fine, doesn't execute. All DLLs are local, I link every necessary library and include every header. There's really not any point me showing code because it fails even if the only code is an empty main function. The error is complaining about the projects configuration file. Oh, I get LNK4098 warning: defaultlib 'msvcrt.lib' conflicts with use of other libs.
  11. I get the following error when I try to compile a skeleton SDL app under visual studio: Unable to start program 'program name' Apparently the application configuration is incorrect, but I've set up loads of SDL projects before - has something changed between .11 and .12 releases of SDL?
  12. Is there any particular reason why calling: PostMessage(m_hWindow, WM_QUIT, NULL, NULL); would work over: PostQuitMessage(0); I'm using a message routing function to forward WM_ messages to a handler inside a class, the handler then calls a specific event function such as OnQuit() in the case of a WM_QUIT message. For some reason when I call PostQuitMessage(0); from my OnDestroy() event handler the system doesn't handle the WM_QUIT message, but when I use PostMessage() with the above parameters it works fine...
  13. FunLogic

    Use of 'friend'

    So ideally Script::Update() should be public and function correctly regardless of whether my ScriptManager calls it or not. In other words Main() could make a call to it? The use of a ScriptManager should just make performing the same task on many Scripts easier. i.e. pManager->Update(); as opposed to... pScript1->Update(); pScript2->Update(); pScript3->Update();
  14. I have both a script and a script_manager class. The manager is responsible for updating an array of script instances that it holds in a std::list<>. Pretty straight forward, but the update member in the script class is private (and I'd like it to stay that way). In order to let the script_manager call script::update(), I've made the script_manager class a friend of the script class - is this justified or am I covering up for a bad design decision?
  15. FunLogic

    Scene Graphs and Octrees

    Quote:Original post by T1Oracle All that you could ever need to know about scene graphs is right here. Thanks for the link, a very interesting article. Quote:You might want to take a look at the WildMagic source code and see how David Eberly implements this. Will do. I think it's best if I just clean up the scene graph implementation I have already written.
  • 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!