Ask the ZMan: Applying Textures, Part 2

Sign in to queue

The Discussion

  • User profile image
    Rapid

    Hi Mr. Zman,

    I have a question that has bothered me for 2 weeks: how to render/rotate text using directx fast/efficiently? (e.g. render 'hello world' from (1, 0, 0) to (0, 0, 0)) I have tried the following but none of them is good:

    1. Use GDI+ to draw text on a bitmap and convert to texture

    2. Use a mesh from a string to render

    3. Use Surface.GetGraphics method to get GDI+ graphics to render

    4. Directly draw the rotated text using GDI+ after rendering directx stuff.

    5. Tried Sprite.Transform (not successfully and I do not believe it will work as I need)

    Could you please help me? Also, is there any simple way to detect collisions among texts in a 3D space? (Currently I have to convert the 3d coordinates of texts to screen coordinates and calculate rectangles or use ray trace for meshes. Very slow and ugly)

    Thanks a million and I am looking forward to hearing from you.

    Best Regards,

  • User profile image
    Marcos

    Hi.

    If I have one single mesh, with six subsets (each one is one side of the box), can I apply a different texture to each side? I would not like to use the same file, because my textures are separated, one per file.

    I've done a single test, like this:

    private void DrawMesh()

    {

       if (mesh != null)

       {

           for (int i = 0; i < mesh.NumberAttributes; i++)

           {

               if (textures[i] != null)

                   device.SetTexture(0, textures[i]);

               device.Material = materials[i];

               mesh.DrawSubset(i);

           }

       }

    }

    But all the SubSets are drawn with the same (the first) texture.

    Could you help me? Smiley

    Thanks.

  • User profile image
    Visitor

    1. Having to download and install just to go through and learn is stupid.

    2. Everything is custom or sub Classed. How are we supposed to learn when you can’t even see the form in the designer?

    3. Why convolute everything? Simplify things so we can get inspired and become creative and release that creativity by adding on to what you provide.

    4. If you’re going to make things complicated then clarify a masters in computer science or Microsoft certifications are required before following any of your post.

    I keep finding you on the search engines while looking for a solution to my problem and as always, there's a learning curve just to opening up your solutions. No answers, no solutions, just tons of custom crap you create! We get it; you’re great at what you do. Unfortunately that doesn’t do anything for us.

    Thanks for nothing!

  • User profile image
    Clint

    @Vistor, Video game development does have an extremely high learning curve.  Making games is hard.  There really aren't designers for them.  Typically you build out the designer and tools for them.  What ZMan is doing is giving you the theory behind it and showing you how to properly code it.

    3D development requires complex math.  Sadly, knowing how to do that type of math is semi required if you don't use a framework like XNA.  Even then it comes in handy.

    If you want to do video game development, check out http://creators.xna.com they have some very nice tutorials.

Add Your 2 Cents