Jump to content

Scott Richmond

Members
  • Posts

    422
  • Joined

  • Last visited

Posts posted by Scott Richmond

  1. Hi guys,

     

    I've spent the last day reading up on and learning Qt as well as searching high and low for any C++ examples of anyone using custom buffers to render to another OpenGL context and have come up with nothing. Apparently someone had got it working previously but it must have been lost in the last forum purge.

    I'd love it if anyone could pipe up if they've worked it out. This is what I've got so far:

    Extremely old C# example of how to use custom buffers to render to a Windows form GL context.

    Forum post circa 2009 discussing the c# custom buffers and having problems.

    Leadwerks Wiki entry on CustomBuffer. Has no examples.

    Looks like a .NET attempt at custom buffers.

     

    Finally, very easy to understand Qt guide on a simple OpenGL Hello World application for those interested in helping me integrate Leadwerks.

  2. Hi,

     

    I need to be able to completely remove a model instance from a running LE game during runtime via C++. Any ideas? I've tried .free() and it seems to do nothing. I've tried deleting the pointer object, but I don't think Model has a comprehensive destructor setup.

    Help?

  3. C++11, also formerly known as C++0x (pronounced "see plus plus oh ex wtf lol").

    The 11 just means 2011, and the 0x means any year from 2000 to 2009.

    Oh interesting. I did not know that.

  4. C++11 has threading facilities, so I honestly think you are wasting your time to reinvent this...

    I think you mean C++0x. But you're correct. Its why I mentioned the TinyThread library, as its an implemented of C++0x.

  5. ..its perfectly doable in LE2..you could create terrain on the fly, out of quads, based on perlin noise as Gardowyr suggested..

    Agreed. I managed to get simple procedural terrain meshes going in LE2 relatively quickly previously. Theoretically you could implement some sort of cell framework like Oblivion did and have endless procedural terrain.

  6. ZMQ is really a communication pipeline that allows you to sidetrack the whole process of trying to interlock and all that other nasty thread stuff by just implementing fast message passing. Its really good if you're willing to design using their concepts.

     

    For pure threading, I might also just point you to TinyThread: http://sourceforge.net/projects/tinythread/

    TinyThread++ is a minimalist, portable threading library for C++. It is modeled after the current C++0x standard (draft), implementing a subset thereof, and acts as a simple replacement library for compilers that lack support for C++0x.

     

    Kind of sounds like the wrapper class you're making now.

  7. Don't know if this is any help to anyone but I thought I'd just say that if one needs some sort of reliable, safe and easy inter-thread communication then ZeroMQ is an amazing library.

  8. You're assuming we're using a scene file. For the project that pertains to this issue, I'm procedurally generating terrains during runtime. The 'map' is made up of a huge amount of models. The polygon count isn't the problem, its the occlusion culling that causes the problem as more and more models are introduced as the player traverses the map.

    I've managed to optimize the OC octree by tweaking the CLOSE, NEAR, FAR (or whatever they are) groups ranges on the camera which seems to do ok, but I think more could be done. The code in this thread above plays with that.

     

    I'm wondering out loud here - Would parenting groups of models help? Does OC ignore parent-child relationships or does it only check the parent model?

     

    How does the vegetation rendering work?

  9. Josh - vegetation system? I would like to hear more about that if you would. I'm guessing its a shader?

    can I also confirm that you meant cull groups are unsupported?

     

    Kazaar - your cull group code isn't helping because you need to put your tiles into multiple large groups, not just one. Assuming its supported.

  10. I haven't tried this yet but you'll probably need to .hide() all models by default, and .unhide() models that are within the camera frustum. The .hide() method takes the model right out of the OC detection so massively reduces the OC time. But it'll need to be done cheaply. Like if the 'tiles' are a 3D matrix then it should be cheap to know that when the camera moves from (1,1,1) in the world to (1,1,2) then you need to .unhide() all the models at (x,1,32).

    Not sure if that makes sense to you or not - I'm avoiding the problem for now and working on stuff not specific to the engine. I might have to find a new engine for this project unfortunately.

     

    TGroup group1=CreateGroup();
    SetEntityGroup(cube1,group1);
    SetEntityGroup(cube2,group1);

    Ah that too! I must say I haven't tried groups yet. That would probably be the best way.

  11. Hey, I've got a friend who'd like to join me in a simple game project and he simply refuses to use Windows being a hardcore Linux fanboy. So, I come here asking - Does the latest LE2 engine run under linux? Anyone does so? Any complications, etc?

  12. Ok. So I've put together the below demo that spawns 25,000 barrels. Playing with the demo on its own let me see that it does sort of work well - View range culling to nothing still seems to take up a fair bit of time at 10ms for 25k barrels. I suppose at this point the aim is to find further optimisations such as culling groups, or any other ideas?

     

    // Leadwerks engine:
    #include "leo.h"
    using namespace LEO;
    
    int main (int argc, char *argv[])
    {
    // Set graphics mode
    Engine engine("3DF",1024,768);
    engine.AddAbstractPath( "./Data" );
    
    Framework fw(CREATENOW);
    fw.main.world.SetAmbientLight(Vec3(0.13,0.14,0.17));
    fw.main.world.SetCullRange(20.0F, 250.0F, 500.0F); // Near, Medium and Far view ranges
    
    DirectionalLight lig2(CREATENOW);
    lig2.SetShadowmapSize(1024);
    lig2.Turn(5,0,0);
    
    OcclusionCulling(false);
    SetWireframe(false);
    SetStats(2); // Detailed stats
    
    for(int x = 1; x < 50; x++) {
    	for(int y = 1; y < 50; y++) {
    		for(int z = 1; z < 10; z++) {
    			Model *model = new Model();
    			model->Load("abstract::oildrum.gmf");
    			model->SetViewRange(VIEWRANGE_NEAR, RECURSIVE);
    			model->SetShadowMode(false);
    			model->Move(x, y, z);
    			//model->Hide();
    		}
    	}
    }
    
    Body player			= CreateBodySphere(); //Create the player object
    Camera playerCamera	= CreateCamera(); // Create the player camera object
    MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2);
    // Initialize variables:
    TVec3 camRotation		= Vec3(0);
    float mouseX			= 0;
    float mouseY			= 0;
    float playerMove		= 0;
    float playerStrafeUD	= 0;
    float playerStrafeLR	= 0;
    HideMouse();
    player.SetMass(1);
    player.SetGravityMode(0); // Sets whether player should be affected by gravity.
    player.SetDamping(1.0F);
    player.SetType(3);
    player.SetPosition( Vec3(0,0,0) );
    playerCamera.SetPosition( Vec3(0, 0 ,0) );
    playerCamera.SetRotation( Vec3(0, 0, 0) );
    playerCamera.SetParent(player); // Sert the player object as the parent.
    playerCamera.SetRange(0.1F, 20.0F);
    
    //Game game;
    
    while( !Keyboard::I****() && !engine.IsTerminated() ) {
    
    	fw.Update();
    
    	if( !engine.IsSuspended() ) {
    		/****** Update player camera ******/
    		//Camera look
    		mouseX = Curve( MouseX() - GraphicsWidth()/2, mouseX, 6);
    		mouseY = Curve( MouseY() - GraphicsHeight()/2, mouseY, 6);
    		MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2);
    		camRotation.X	= camRotation.X + mouseY / 10.0F;
    		camRotation.Y	= camRotation.Y - mouseX / 10.0F;
    		RotateEntity(player, camRotation);
    		playerMove		= KeyDown(KEY_W)-KeyDown(KEY_S);
    		playerStrafeLR	= KeyDown(KEY_D)-KeyDown(KEY_A);
    		// Double movement speed with shift
    		if (KeyDown(KEY_LSHIFT)||KeyDown(KEY_RSHIFT)) {
    			playerMove*=20.0;
    			playerStrafeLR*=20.0;
    		}
    		// Make the player travel for slightly longer after keypress:
    		TVec3 playerForce = Vec3(playerStrafeLR*10.0, 0, playerMove*10.0);
    		playerForce = TFormVector(playerForce, player, 0);
    		player.AddForce(playerForce);
    		fw.Render();
    
    		engine.Flip( 0 );
    	}
    }
    
    return engine.Free();
    }

×
×
  • Create New...