Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 43

Thread: 2D using OpenGL

  1. #21

    2D using OpenGL

    Still haven't managed to get it working

    But at the moment that's no problem to me.

    I've got the masking thing going and for now that's enough for me...

    Next is to find out how to load a part of a bitmap onto a texture or to show part of a texture on a quad.

    I now have a mario type guy running around.
    I'm using a seperate folder for each character containing 16 bmp images.
    8 for each animation frame and 8 for the masks.

    I have come across a problem on that, though...
    The program seems to have a slight problem rounding off the textured polygons. When scrolling a very thin black line sometimes appears above my mario dude.
    Any idea of what's causing this?

    A second question... Anyone have any ideas how to put a maximum FPS on the game? I can't do an infinite loop, but there's probably a way to find the time of the CPU's internal clock or something.
    Huhuhu

  2. #22

    2D using OpenGL

    Just to keep you up to date, I've finished quite a bit of the game allready and I'm trying to work with lighting now.

    Managed to do quite a lot on that part.
    Behold my lovely museum:


    This is simply placing a square for each block. I am using 5 layers for this:
    layer 1 - Way back there is the sky, not visible here, but it's there
    layer 2 - Background blocks used for mountains and other things (in this case an excavation)
    layer 3 - Very close background blocks usually used for bridges, flowers or indoor walls.
    layer 4 - The usefull layer, places obstacles, the main character and some NPCs.
    layer 5 - viewblockers. Things you can walk behind like the darkened eagle statue on the right.

    I've also planted a spotlight and lo and behold, it bound itself to the camera.
    Very nice for a spotlight tracking the main character (like the camera does), but as you can see there are a couple of bowls of fire on the background too.

    It would be great to be able to position a light not relative to the camera position, but to position 0.0 , 0.0 , 0.0 so I can easily place a light on top of the bowl as I create it.

    I've spent over 1 hour finding out how to do that, but all I found was vague babbling about it being possible, but no where could I find a single snippet of code showing me how.

    So I was wondering, Anyone else had this problem and if so, how to fix it?
    Something's telling me I'm overlooking something quite obvious, I usually am.

    --EDIT--
    Another Thing I found out on the internet was the fact that I can place a maximum of 8 lights on the screen GL_Light0 to GL_Light7, is this true? and if so, I there a way to work around that?
    Huhuhu

  3. #23

    2D using OpenGL

    Quote Originally Posted by Smotsholle
    --EDIT--
    Another Thing I found out on the internet was the fact that I can place a maximum of 8 lights on the screen GL_Light0 to GL_Light7, is this true? and if so, I there a way to work around that?
    Yes, alpha maps

  4. #24

    2D using OpenGL

    Quote Originally Posted by Smotsholle
    I've spent over 1 hour finding out how to do that, but all I found was vague babbling about it being possible, but no where could I find a single snippet of code showing me how.

    So I was wondering, Anyone else had this problem and if so, how to fix it?
    Something's telling me I'm overlooking something quite obvious, I usually am.
    Before rendering anything, call glLoadIdentity, then position your lights and then setup the camera.
    Another Thing I found out on the internet was the fact that I can place a maximum of 8 lights on the screen GL_Light0 to GL_Light7, is this true? and if so, I there a way to work around that?
    It is true that OpenGL can use up to eight lights. You can have more lights than that but only eight of them can be used at the same time. So in each frame you should decide which lights are active (up to eight) and use only them. The other possibility to avoid max_eight_lights restriction is to make your own lightning by lightmaps (alphamaps?) or shaders.

  5. #25

    2D using OpenGL

    I've been fiddling around with the extra lights, but it gave me too much lighting, but not to worry, I replaced the lights with some viewports showing an extra bit of the excavation.

    But I'll certainly keep these advices in mind, maybe something to use for later on.

    To show you what's next here's the background for the menu.
    I know it isn't possible to get a fixed image as a background fill, but I don't mind that. I'll just make a big quad which is just big enough to fill the background (I'm working with a fixed resolution, so that won't be a problem).

    The game will be in dutch and later on commercial (planning to convert it to freepascal later on due to student's license at school), so you won't get to see the full version when it's finished.
    Huhuhu

  6. #26

    2D using OpenGL

    Working title, I presume? :lol:

  7. #27

    2D using OpenGL

    Well this title is actually the definite title.
    This title actually came forward from a little discussion.

    To translate freely I came up with "Salto and the 'something' cards" on which I asked someone to will something in on the word 'something' (huppelepup in dutch) and actually they found huppelepup to be a funny name so that's how we came up with it (The joke is more of a dutch thing, hard to translate, in short the word is as useless as it sounds).

    An extra in this game is the ability to play a parody on the triple triad card game (made more suitable for children of course).

    see http://en.wikipedia.org/wiki/Triple_Triad for details on the game. In my version I will forget about the extra rules (same, wall, combo, plus).

    The cards will represent characters you meet in the game. and of course these cards are called the huppelepup-cards.
    Huhuhu

  8. #28

    2D using OpenGL

    Ps...

    Just wondering if you guys know what can cause an opengl based game to work under win98 and not to work under winXP.

    Over here XP has just been installed, wonder why te game suddenly doesn't work.
    On xp I only see the background color. (no polys, no textures, no lighting effects)
    Huhuhu

  9. #29

    2D using OpenGL

    Over here XP has just been installed, wonder why te game suddenly doesn't work
    Could be a GFX driver issue. I've never experienced any problems with opengl before in the way you mentioned.

    What gfxcard do you have installed?

  10. #30

    2D using OpenGL

    It's the exact same pc, just with a different windows.

    Found out 2 issues so far on which XP and 98 differs....

    One is a zeromemory command I got from a tutorial.
    - 98 doesn't see a problem if the memory is allready free.
    - XP simply gives an access violation error.
    The other one is the order in which I run my initialization commands.
    - 98 has no real problems with that.
    - XP is more precise on that.

    Since it's for public schools I need to calculate the factor they are behind a couple of years (many public schools are) and therefore it needs to be compatible with both win98 and winXP.

    Fixed the current problem now (init order) but any other info on this would be welcome).
    Huhuhu

Page 3 of 5 FirstFirst 12345 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •