Results 1 to 10 of 121

Thread: G.T.A.2 Map Editor

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    You can read the limitations on wiki:
    http://www.opengl.org/wiki/NPOT_Texture
    Bottom line: "All newer hardware can handle NPOTs of any kind perfectly."

    While i still had that white/black texture bug myself because of 3, 4 thing, i implemented the TQuadTexture class. It divides the texture into power of 2 texture parts. There's also 2 different loading options for textures:
    toScale: Loads image into power of 2 texture, and scales to nearest match. For example 400x900 would round to 512x1024.
    toFitScale: Loads image into power of 2 texture, and makes the size to current or higher match. This actually doesn't scale, but leaves black gaps on the outside area. Each texture has separately SizeX, SizeY, Width, Height, where Width/Height is the actual image size, and SizeX, SizeY is texture size. So nx drawing functions still know how to deal with them.

    QuadTexture - Reserves near exactly the needed area from memory, pixel perfect.
    toScale - May cause slight blurring, pixel perfect data is propably lost, memory efficient.
    toFitScale - Keeps pixel perfection but reserves more memory than QuadTexture, propably not very usable on 3D-models.
    (no option at all) - Pixel perfect, memory efficient non power of 2, if card supports it.
    Last edited by User137; 17-02-2013 at 04:04 PM.

  2. #2
    About getting black textures when trying to deal with non-POT stuff, I had the same problem until I began to include this in my texture loading code:
    Code:
    glPixelStorei(GL_UNPACK_ALIGNMENT,1);

  3. #3
    Quote Originally Posted by User137 View Post
    toFitScale - Keeps pixel perfection but reserves more memory than QuadTexture, propably not very usable on 3D-models.
    Why not very usable on 3D models?
    I tried these options and best seems to be toFitScale.
    The other one blurs too much.

    All my 3D models are just small "planes". For ped i created this:
    Code:
    model.CreatePlane(2,2);
    2,2 is ofc too big for ped, it's just for testing purposes. Later it will be even smaller.

    But loading NPOT textures from file seems to work fine.
    Will try later how to supply img data from memory to it and how it renders them.

  4. #4
    Quote Originally Posted by hwnd View Post
    Why not very usable on 3D models?
    Because often times 3D models UV maps rely on coordinate range from 0..1. If Image Width is 257 then texture's sizeX would be 512. So right side of the texture has black stripe. That obviously cannot be used as a repeating texture, and the usable UV range would be closer to 0-0.5.

    edit: Ah it's actually not black stripe. It will clamp with border line like that right side image:
    http://i.msdn.microsoft.com/dynimg/IC142381.gif
    Last edited by User137; 20-02-2013 at 02:35 PM.

  5. #5
    Here i rendered a transparent ped. The lines around him are "little" blocky.
    Is it possible to somehow tell OpenGL to smoothen these curves, so they don't look so blocky?
    If it's not, i can live with that, but i decided to ask just in case.

    The black behind it, is very basic fake shadow.
    It has large offset because ped is dead and floating in air. This i just a test rendering.
    The shadow should be transparent a bit also instead of complete black.
    Shadow is practically same quad rendered with offset and with glColor3f(0,0,0);



    Here is far view of ped
    http://img843.imageshack.us/img843/8071/farview.png
    Last edited by hwnd; 22-02-2013 at 02:15 AM.

  6. #6
    You can make the shadow transparent with alpha color: glColor4f(0,0,0, 0.6);

    Not sure if this is what you are after, but the smoothening of texture's alpha edges is done with:
    Code:
    glAlphaFunc(GL_GREATER, 0.008);
    That means that only color with alpha value greater than 0.008 is rendered.
    If you set it like (GL_ALWAYS, 0), it would draw the whole texture as smooth as it is, also fully transparent pixels with 0 alpha.

  7. #7
    I will leave that sprite rendering for a while. I get tired and bored working on one thing for long time. Instead i worked on some other things.

    With Ctrl+G shortcut it's possible to navigate to any X,Y coordinate on map.
    I use simple Delphi function: InputBox to get coords from user. Temporary thing i guess.
    Later i will use my own dialog i think.

    Instead of instantly going to X,Y location it goes there smoothly. This will be optional of course.
    First it goes fast and when arriving to specific X,Y it slows down until specified X,Y is exactly in center of the cam. And when camera is moving to that point and user clicks on minimap it stops moving.

    Because slow PC im unable to make video, it's smooth in editor but not smooth while recording video.
    Last edited by hwnd; 23-02-2013 at 04:50 PM.

  8. #8
    Found a bit of motivation to work on editor a bit again.
    I was bored. So i took old picking code and copy-pasted this to my latest editor source.
    Works fine as it did previously. I wish i could make other things work so easily (by just copy pasting).
    I don't have very much motivation to actually work on the flat faces again, there are few to add..

    I will add selection boxes in. I actually had working implementation that drew them very nicely.
    Will try to copy paste as much as i can. I had problems with selection going negative, i thought that glTranslatef will not accept negative values, but actually it did. Dunno where i stopped.
    But the code had some neat things already implemented so i will not reinvent it again, there is no point if it works.

Tags for this Thread

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
  •