Crystal Space
Welcome, Guest. Please login or register.
September 18, 2014, 07:02:50 pm

Login with username, password and session length
Search:     Advanced search
9018 Posts in 2051 Topics by 8478 Members
Latest Member: Annaatkinson
* Home Help Search Login Register
  Show Posts
Pages: 1 [2] 3 4
16  Crystal Space Development / Support / Rendering text to a texture on: April 28, 2009, 02:26:55 am
Hi,
I'm writing a function for my app that draws text directly onto a texture (it's for elevator buttons and floor indicators; currently I'm using lots of image files), and was wondering if there was a preferred way of doing this.  Originally (since I'm still working a lot with CS 1.2) I started setting everything up to use the iGraphics2D::CreateOffscreenCanvas function (where I'd allocate a buffer the same size as the original image, blit the texture onto it, draw text, etc to create a new image) but noticed it was marked deprecated in 1.4.  I'm looking over the iGraphics3D::SetRenderTarget function (which replaces it) and am mainly wondering if there's another facility in the API for doing this kind of work, or if I should just try to work with that function.  Thanks

-eventhorizon
17  Crystal Space Projects / WIP Projects / Skyscraper 2.0 Alpha1 on: January 07, 2009, 06:49:16 pm
Last night I released the C++/CS rewrite of my Skyscraper simulator, and it's been 4 1/2 years since the previous version (it's gone through 2 rewrites).  There's lots of pictures to see, and I won't post them directly on here, but here's the links:

http://www.skyscrapersim.com

General screenshots:
http://www.skyscrapersim.com/screenshots_general.html

Triton Center screenshots (gives a very good overview of the whole thing):
http://www.skyscrapersim.com/screenshots_tritoncenter.html

-eventhorizon
18  Crystal Space Development / Support / Re: Help with either thing size bug or genmesh on: January 05, 2009, 01:20:25 am
Fixed it - had to do some serious digging around in CS to figure it out.  I attached a patch to the bug page:
http://crystalspace3d.org/trac/CS/ticket/576#comment:1

Here's my comment from the page:
"Found the problem (see attached patch) - first, poly3d.cpp was calling the ceil() function with 2 integers, causing vertex values over 2,147 to go beyond the integer limit when multiplied with 1,000,000 (since the compiler assumed both were integers, it returned the multiplied value as an integer). I fixed that by forcing it to a float (1000000.0). Next, the ceil function was being casted as an integer, and being returned into an integer-based temporary 3d vector (which doesn't make sense since csVector3 is float-based), so I changed those. Now polygons with vertices that go beyond 2147 units work again Smiley"

-eventhorizon
19  Crystal Space Development / Support / Re: Is there a way to locate the world coordinates of the mouse cursor? on: January 04, 2009, 07:10:02 am
Is there a way to know the location of the mouse cursor in world coordinates? And maybe also the mesh/polygon it's on?

That's explained in the CS manual:
http://www.crystalspace3d.org/docs/online/manual/HOWTO-Clicking-on-Objects.html

-eventhorizon


20  Crystal Space Development / Support / Help with either thing size bug or genmesh on: December 30, 2008, 05:44:37 am
I'm trying to get a thing-based skybox I made working again (the app is based around thing meshes) - a bug seemed to have popped up in 1.2 that is causing polygons over 4294 units in size (maybe only quads) to not render, and seems to be still there - I reported it in bug #576 but haven't gotten a response.  I've been trying to figure out how to create a genmesh instead, but the genmesh system doesn't really make much sense when coming from the perspective of thing meshes.

Here's the test case I put in the ticket that doesn't work (keep in mind that this is after the thing mesh init and stuff; mesh_state is also of type csRef<iThingFactoryState>):
Code:
    int firstidx = mesh_state->AddInsideBox(csVector3 (-2148, -2148, -2148), csVector3 (2148, 2148, 2148));
    mesh_state->SetPolygonMaterial (csPolygonRange(firstidx, firstidx + 5), tm);
    mesh_state->SetPolygonTextureMapping (csPolygonRange(firstidx, firstidx + 5),

    csVector2 (0, 1), csVector2 (1, 1), csVector2 (1, 0));

    engine->SetLightingCacheMode (0);
    engine->SetAmbientLight(csColor(1, 1, 1));

In that above example, if you change the size values to 2147 instead of 2148, the box is visible.

Here's the current thing code that doesn't work (I'm currently using widths of 10,000 for testing):
Code:
csRef<iMeshWrapper> SkyBox = (engine->CreateSectorWallsMesh (area, "SkyBox"));
csRef<iThingFactoryState> SkyBox_state = scfQueryInterface<iThingFactoryState> (SkyBox->GetMeshObject()->GetFactory());
SkyBox->SetZBufMode(CS_ZBUF_USE);

int firstidx = SkyBox_state->AddInsideBox(csVector3(-5000, 0, -5000), csVector3(5000, 10000, 5000));
material = engine->GetMaterialList ()->FindByName ("SkyBack");
SkyBox_state->SetPolygonMaterial (csPolygonRange(firstidx, firstidx), material);
material = engine->GetMaterialList ()->FindByName ("SkyRight");
SkyBox_state->SetPolygonMaterial (csPolygonRange(firstidx + 1, firstidx + 1), material);
material = engine->GetMaterialList ()->FindByName ("SkyFront");
SkyBox_state->SetPolygonMaterial (csPolygonRange(firstidx + 2, firstidx + 2), material);
material = engine->GetMaterialList ()->FindByName ("SkyLeft");
SkyBox_state->SetPolygonMaterial (csPolygonRange(firstidx + 3, firstidx + 3), material);
material = engine->GetMaterialList ()->FindByName ("SkyBottom");
SkyBox_state->SetPolygonMaterial (csPolygonRange(firstidx + 4, firstidx + 4), material);
material = engine->GetMaterialList ()->FindByName ("SkyTop");
SkyBox_state->SetPolygonMaterial (csPolygonRange(firstidx + 5, firstidx + 5), material);

SkyBox_state->SetPolygonTextureMapping (csPolygonRange(firstidx, firstidx + 5),
csVector2 (0, 1),
csVector2 (1, 1),
csVector2 (1, 0));

With the genmesh idea, I've been trying to implement it, but I can't easily see how to create multiple submeshes (for the multiple textures) on a per-polygon basis like the thing system uses.  This stuff is pretty important since the tiny skybox really looks bad at high altitudes Smiley
Also my project is here: http://www.skyscrapersim.com - I'm trying to get the first test release based on my 2.0 code out any day now (it's currently in RC stage).

-eventhorizon

21  Crystal Space Development / Support / Re: Migrating from csCollider to iDynamics on: December 02, 2008, 07:40:52 pm
I don't understand everything you are saying, but I do have an example from my own app that initializes all meshes in a list to be static physics objects. I add any rigid bodies after.

Still getting the same with your code (since it's still basically the same code as mine, except just traverses the engine's meshlist):
"csODECollider: No collision polygons, triangles or vertices on ..." ('...' being each mesh found).

What I was saying before (didn't really explain it right) is that my app (which is a skyscraper simulator) creates polygons at runtime as it parses a script file and then later divides them up into multiple pieces when doing a hole cut operation (one poly turns into 4, with the 5th being dropped); so it's not easy to create separate collider polygons and keep them associated to the original polygons.  The InitializeCollisionWrappers worked because it automatically created collision geometry from all the existing polygons in the engine.

-eventhorizon
22  Crystal Space Development / Support / Re: Migrating from csCollider to iDynamics on: December 01, 2008, 09:39:15 pm
I think the equivalent would be iRigidBody::AttachColliderMesh().
But if you really have many of them, a few thoughts:
  • try to use more simple shapes like box or sphere collider when possible
  • consider using Bullet plugin instead of ODE
Also, check $CRYSTAL/apps/tutorial/phystut/phystut.cpp for some physics objects creation examples...

AttachColliderMesh() is still the same; it expects collision polygons to exist in the mesh.  Also, both plugins use dynamicsystem, so I don't know how that would change anything.  Most of the stuff I changed was modelled after the phystut app, but my app uses thing meshes with massive amounts of dynamic polygons.

Both calls give this error when trying to feed it existing mesh geometry:
csODECollider: No collision polygons, triangles or vertices

-eventhorizon
23  Crystal Space Development / Support / Migrating from csCollider to iDynamics on: December 01, 2008, 08:13:03 pm
I'm trying to migrate my project from the csCollider system over to ODE using iDynamics, and am trying to figure out something.  Since my app does massive amounts of polygon creation and deletion during startup, I used the csColliderHelper::InitializeCollisionWrappers call to auto-create colliders for all objects (I'm also using it to allow the user to click on polygons such as buttons, and perform actions).  I'm trying to figure out how to get the dynamic system to create colliders for existing mesh geometry (like InitializeCollisionWrapper), and have tried iDynamicSystemCollider::CreateMeshGeometry but that seems to expects meshes to contain collision polygons (instead of creating collision polygons from existing polygons).  Any recommendations on what I should do for this?

-eventhorizon
24  Crystal Space Development / Support / Re: wxgl problem on OSX, and also Solaris & IRIX rendering questions on: May 12, 2008, 10:55:46 pm
  could you create tickets on CS Trac about those issues ?
wxtest works here on Linux with wxWidgets 2.6 (wxGTK-2.6.3).
Be sure to mention the version you're using, and also how you installed/built it (Mac ports or whatever).


I was going to; I mainly didn't know if it was a known problem or not.

-eventhorizon
25  Crystal Space Development / Support / Re: wxgl problem on OSX, and also Solaris & IRIX rendering questions on: May 10, 2008, 01:01:16 am
Here's my screenshots and runtime logs of both wxtest and simple1 on OS X.  The machine is running 10.4.11 PPC with wxWidgets 2.8.7 and Xcode 2.5.

Simple1; works fine:


Simple1 run log:
http://www.skyscrapersim.com/1.1/dev_pics/mac/wx_problem/simple1_mac.txt

wxtest; doesn't work (this is after I moved the window, which reveals the black render area):


wxtest run log:
http://www.skyscrapersim.com/1.1/dev_pics/mac/wx_problem/wxtest_mac.txt

-eventhorizon
26  Crystal Space Development / Support / wxgl problem on OSX, and also Solaris & IRIX rendering questions on: May 09, 2008, 05:54:19 pm
First off I just submitted a patch made by me and Patrick Baggett to add MIPS atomic operations support to the CS 1.2 threading system, mainly for building on SGI machines (IRIX operating system).  http://trac.crystalspace3d.org/trac/CS/ticket/475

The main problem I'm having is that it seems that the wxgl plugin in 1.2 is defective on Mac OSX; the general sample apps (like simple1, etc) run fine, but wxtest seems to have a canvas rendering problem (and since my simulator app uses wxgl, it doesn't work either).  I have CS built in debug mode on the machine if any in-depth info is needed.  I don't know if this issue has been looked at already.
Basically what happens is that the app runs, the wx window displays, but initially nothing appears inside the window; if the window is moved, a black render area appears, but with seemingly no active rendering.  Here's one screenshot of the problem (thought I took more, but I'll get more later - this shot is of my simulator running; the result is the same as with wxtest):



In that image, the entire window titled "Skyscraper 1.1 Alpha" is a render window, but shows nothing; if you move it, the window contents turn black.


The other issue is more complex and has been an issue for a long time.  Me and some other people are trying to get CS to run on both Sun Solaris and primarily SGI IRIX, and are running into problems seemingly related to detection of GLX visuals and renderer parameters.  On both platforms, the CS demos run, but they report that the systems are running in 15-bit color mode (even though Solaris is running in 24-bit mode, and IRIX in 32-bit mode), and end up with a rapidly flickering render window with no visible 3D rendering.  I also have CS built in debug mode on both those platforms if any other info is needed; I'm working with some other people on trying to figure it out on IRIX, but wanted to ask you guys since I don't know a whole lot about the CS internals. 

CS's simple1 verbose output on IRIX:
http://ryan.tliquest.net/cs_patches/cs_1.2_irix_output.txt

IRIX Screenshot:
http://ryan.tliquest.net/cs_patches/cs_irix1.jpg


Solaris screenshot:


and a memory breakdown of the simple1 app on IRIX:
http://ryan.tliquest.net/cs_patches/cs_irix3.jpg


-eventhorizon



 

27  Crystal Space Development / Support / Re: Making holes in polygons on: July 18, 2007, 04:25:41 am
The only way to do this is by actually splitting the bigger polygon into multiple convex polygons. How to do that exactly I don't know.

Greetings,

I've done it - the function I wrote creates square holes, and breaks up the source polygon into 4 (discards the 5th piece, which is the hole itself).  It then stores the original polygon's texture mapping data, deletes the polygon, creates the 4 new polygons, and maps the texture across the new ones.  I was going to try to reduce the polygon count (from 4 to 2), but that would've caused problems later on.

It's in the PerformCut() function in Skyscraper's floor.cpp file, which can be viewed at:
http://cvs.tliquest.net/viewvc/skyscraper/src/floor.cpp?view=markup
(also feel free to use that function's code as a reference to make a CS function if you want)

Some pics:
http://www.skyscrapersim.com/1.1/dev_pics/holes.jpg



Looking down 5 stories:
http://www.skyscrapersim.com/1.1/dev_pics/holes2.jpg



Looking up through the same hole as above:
http://www.skyscrapersim.com/1.1/dev_pics/holes3.jpg


-eventhorizon
28  Crystal Space Development / Support / Re: Making holes in polygons on: June 27, 2007, 04:15:37 am
The only way to do this is by actually splitting the bigger polygon into multiple convex polygons. How to do that exactly I don't know.

Greetings,

That's what I'll do (my app has been able to do that for a while, but was trying to see if I didn't have to split up the polygon).  I read that clipping out portions of polygons like I mentioned above can cause performance problems, and the most efficient way is to just to split.  My function chops it up into 5 polys (only supports making a square hole), and discards the 5th poly.  Now I'm working on getting it to cut multiple holes (splits into 5, then splits the relevant resultant polys, etc).

-eventhorizon
29  Crystal Space Development / Support / Making holes in polygons on: June 22, 2007, 10:48:42 pm
I brought this issue up a while back in a thread about functions I was looking for, and wondered if anyone knows how to do this and if the engine itself supports this yet, since my project (at www.skyscrapersim.com) currently needs this functionality (and I'm trying to come up with ways to do it manually).  I considered on trying to use portals to do this (which Jorrit suggested before), but that would require everything to be divided up into sectors, which I can't do with this type of simulation.

Mainly I'm trying to cut holes in existing polygons, which seems to be done by creating a second smaller polygon on the same plane as the first (located on the first larger polygon), and is used as some form of texture clipper.

The "polygon 1" in this picture explains it:
from http://www.strumapgis.co.uk/htmlhelp/polygonsandstrumap.html


Gmax can also do this (as a boolean compound object), and info on it is at this page:
http://www.ianztrainz.com.au/tutorial1.htm



A C library that supposedly does this stuff:
http://www.cs.man.ac.uk/~toby/alan/software/

Other misc sites on this:
http://www.quantdec.com/SYSEN597/GTKAV/section6/chapters_23_24.htm
http://www.hypack.com/newsletter/5_03/pat_1.htm

30  Crystal Space Development / Support / Re: Problem with the string array's DeleteAll() function on: September 20, 2006, 06:39:11 pm
What do you mean by doesn't work? What happens?

Greetings,

Sorry - forgot info about the error Smiley

On Windows 2000 with VC8 the release build of the software returns "The instruction at "0x004644c9" referenced memory at "0xe80875ff". The memory could not be 'written'" - so it doesn't seem to be a null pointer issue inside CS.
While debugging the debug build, the call stack is usually like this:

    NTDLL.DLL!_DbgBreakPoint@0()    
   Skyscraper.exe!CS::Debug::AssertMessage()  + 0x1c0 bytes   
    Skyscraper.exe!ptfree()  + 0x6b bytes   
    Skyscraper.exe!operator delete[](void * p=0x0012ec5c)  Line 717 + 0x27 bytes   C++
    Skyscraper.exe!csStringArrayElementHandler::Destroy(const char * * address=0x06af4724)  Line 43 + 0x17 bytes   C++
    Skyscraper.exe!csArray<char const *,csStringArrayElementHandler,CS::Memory::AllocatorMalloc,csArrayCapacityDefault>::DeleteAll()  Line 939 + 0x12 bytes   C++
    Skyscraper.exe!SBS::~SBS()  Line 130   C++
    Skyscraper.exe!SBS::`scalar deleting destructor'()  + 0x2b bytes   C++
    Skyscraper.exe!Skyscraper::OnInit()  Line 97 + 0x2d bytes   C++
    wxbase26d_vc_custom.dll!wxAppConsole::CallOnInit()  Line 87 + 0x1e bytes   C++
    wxbase26d_vc_custom.dll!wxEntryReal(int & argc=1, char * * argv=0x01037d48)  Line 423 + 0x1d bytes   C++
    wxbase26d_vc_custom.dll!wxEntry(int & argc=1, char * * argv=0x01037d48)  Line 216 + 0xd bytes   C++
    wxmsw26d_core_vc_custom.dll!wxEntry(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * __formal=0x00000000, HINSTANCE__ * __formal=0x00000000, int nCmdShow=1)  Line 386 + 0x10 bytes   C++
    Skyscraper.exe!WinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00132f40, int nCmdShow=1)  Line 35 + 0x36 bytes   C++
    Skyscraper.exe!main(int argc=1, char * * argv=0x0145b988)  Line 44   C++
    Skyscraper.exe!__tmainCRTStartup()  Line 586 + 0x19 bytes   C
    Skyscraper.exe!mainCRTStartup()  Line 403   C

It's crashing at line 717 of cssysdef.h at the ptfree():
CS_FORCEINLINE void operator delete[] (void* p) throw()
{ ptfree (p); }

-eventhorizon
Pages: 1 [2] 3 4
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 9.191 seconds with 16 queries.