primitive polygon problems

This is a discussion on primitive polygon problems within the Game Programming forums, part of the General Programming Boards category; I've finally worked out the big questions surrounding a wireframe engine, now I'm trying to fill these triangles in with ...

  1. #1
    GA ichijoji's Avatar
    Join Date
    Nov 2002
    Posts
    179

    Question primitive polygon problems

    I've finally worked out the big questions surrounding a wireframe engine, now I'm trying to fill these triangles in with solid colors. This results in two problems:

    1. The function I use to fill the shapes is limited to triangles, and even this function is framerate killingly slow.
    2. My models don't look right because their polygons draw on top of each other, regardless of their positions relative to the camera.

    These problems rule out using this engine for an actual game, which is my ultimate goal. Any help would be greatly appreciated.
    Illusion and reality become impartiality and confidence.

  2. #2
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078

    Re: primitive polygon problems

    Originally posted by ichijoji
    1. The function I use to fill the shapes is limited to triangles
    Just about all APIs are limitted to only drawing triangles as well. When you tell opengl or directx to draw a quadralateral or a more complex flat polygon, it just separates them into individual triangles and then draws them.

    Originally posted by ichijoji
    2. My models don't look right because their polygons draw on top of each other, regardless of their positions relative to the camera.
    You're not going to be able to use many complex models (IE moving/animated player models) without z-buffering. You can do software z-buffering, but it will run unbelievably slow. If you don't have moving polygons (IE if you are just dealing with static levels), you can avoid z-buffering by just using binary space partitioning to partion the levels and figure out draw order, and 2D sprites for characters (oldschool stuff). What it comes down to, though, is you're better off just using opengl or directx so that you can very easily take advantage of hardware acceleration. Your project is great and you're learning a lot, but don't expect it to run very fast with just software rendering.

    Originally posted by ichijoji
    These problems rule out using this engine for an actual game, which is my ultimate goal. Any help would be greatly appreciated.
    You can solve those problems, but most-likely, not the speed problem, unless you take advantage of hardware acceleration. Run Half-Life in software rendering mode. Even with a very new computer, you're not going to get much speed. I suggest you continue with your engine, but realize that you most-likely won't be able to get it to commercial quality and running at the same framerate as modern games.

  3. #3
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    Does hardware-accelerated mean that the work is passed onto the video card instead of forcing the processor to perform all of that work?

    EDIT:
    To ichijoji
    The function I use to fill the shapes is limited to triangles, and even this function is framerate killingly slow.
    Could you show or explain how you are doing this? Is writing your own rasterization routines difficult? I really have little clue how it is done. I guess it is done involving some kind of equation to determine which pixels are lit up and with what intensity etc using the uv texture coordinates, correct? Or am I incorrect somehow?
    Last edited by Silvercord; 01-23-2003 at 10:39 PM.

  4. #4
    Banned frenchfry164's Avatar
    Join Date
    Oct 2001
    Posts
    1,552
    yep. When you use hardware acceleration you use the chip on the graphics card rather than your main processor. The video card's chip is designed specifically for graphics, so it runs faster, as well as it takes the workload off the processor. Hardware acceleration CAN actually be slower as well. Before I put my GeForce 4 on my comp software actually ran faster. I had integrated graphics, which was stupidly placed on the motherboard chip. On top of that, it didn't support hardly any effects, so it would make certain games turn out looking psycodelic, like pure white walls and stuff.

  5. #5
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    On top of that, it didn't support hardly any effects, so it would make certain games turn out looking psycodelic, like pure white walls and stuff.
    lmao, that's cool, kind of like a counter strike hack I saw so you could see the black CTs better

    I wonder if there will be any MORE hardware added ontop of the CPU and GPU, maybe we'll be getting cards with dual graphics processors (didn't some of the voodoo cards have that?) or maybe we'll be able to actually buy GPUs separately from the cards themselves so we can always leave the same card in the agp slot while doing an upgrade, being able to add ram independently of the card would be nice as well.

  6. #6
    GA ichijoji's Avatar
    Join Date
    Nov 2002
    Posts
    179
    Could you show or explain how you are doing this? Is writing your own rasterization routines difficult? I really have little clue how it is done.
    I didn't actually do any rasterization to do this, I just ranked the x-coords of the vertices of the triangle, then counted through them applying the functions for the sides to find y-coords for a big set of vertical lines that *look* solid.

  7. #7
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    In addition to what P OOP said, you might want to look into back-face culling. This will only draw faces that you will see. Basically you just dot your viewing vector with the normal of the face and if the result is > 0 that means they are pointing the same way and you don't need to draw this because it won't be visible.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  8. #8
    Banned frenchfry164's Avatar
    Join Date
    Oct 2001
    Posts
    1,552
    yeah I think the Voodoo had a second chip just for antialiasing I think. It may have been filtering as well.

  9. #9
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    Originally posted by frenchfry164
    yeah I think the Voodoo had a second chip just for antialiasing I think. It may have been filtering as well.
    Voodoo 5 5500 has two, Voodoo 5 6000 had four.

  10. #10
    Registered User
    Join Date
    Dec 2002
    Posts
    29
    I used to run halflife on a 300mhz laptop with no 3d card and a ****ty video system. 48 meg of ram. Never noticed any slow down.

  11. #11
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078
    yeah, prolly in 320x240 resolution

  12. #12
    Registered User
    Join Date
    Dec 2002
    Posts
    29
    nope, min of 640x480...sometimes at 800x600 but it wasn't as smooth. Todays processors would easily rock half life with no 3d card. It wouldn't be as pretty, but it certainly works, and I can't be sure...but the z buffer doesnt even seem to look like its choking...like, things that are supposed to go on top of each other DO. Its amazing. Half Life is amazing.

    If your latest comp cant run it in software mode, it's time to through away that Mac and buy a real pc.

  13. #13
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    If your latest comp cant run it in software mode, it's time to through away that Mac and buy a real pc.
    ahahaha, lmao. I don't actually like macs all that much. Why is it that despite the fact that their processors have 128 bit registers they still run like crap? It's kind of like the same thing with ATI's cards vs the geforce4 cards (don't quote me on any of this) where the ATI cards have more internal registers and can address more textures at once (7?) where the geforce4 cards must do it in 2 or 3 passes but yet the geforce4 cards consistently run faster (well, that's what that guy at id software says, what's his name? Bob Carmack or something?)

  14. #14
    Registered User
    Join Date
    Dec 2002
    Posts
    29
    Well...they don't really run like crap. All of their "advanced" features allow them to match a pc at like half the MHZ (thats just a random figure, but you get the idea). The problem is in their support. There's not a huge demand for macs...which really doesnt help to drive their tech. Plus Motorolla and IBM (or whoever makes the powerPC) doesn't seem to be putting their all into advancing the chip. Even Apple is pretty dissipointed with them from what Ive been reading. Their advancment just hasnt been keeping pace with the pc. They even have an x86 version of OSX that is kept up to par with the powerPC version. Some have speculated the jump to AMD or something in the future. I doubt it...but you never know.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. No clue how to make a code to solve problems!
    By ctnzn in forum C Programming
    Replies: 8
    Last Post: 10-16-2008, 03:59 AM
  2. Point in polygon test - spherical coords
    By bhdz in forum C Programming
    Replies: 1
    Last Post: 11-07-2007, 01:25 PM
  3. help how to make polygon
    By gamett711221 in forum C++ Programming
    Replies: 3
    Last Post: 02-20-2005, 08:33 PM
  4. Operator overloading in template classes
    By moejams in forum C++ Programming
    Replies: 5
    Last Post: 07-21-2003, 06:16 PM
  5. IDEA: Polygon unions and intersections
    By Magos in forum Contests Board
    Replies: 3
    Last Post: 05-21-2003, 08:16 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21