Jump to content

  • Log In with Google      Sign In   
  • Create Account


haegarr

Member Since 10 Oct 2005
Offline Last Active Today, 05:14 AM
*****

Posts I've Made

In Topic: Why is the first spritesheet laid out like this? Seems harder to read the spr...

Today, 05:15 AM

It should be mentioned that "sprite" nowadays does not necessarily mean the old school image rectangle. Advanced sprite techniques exist that allow for lighting effects, for example. There is also a technique that allows for animation by mesh morphing. The game made by using this is one about zoo animals; I currently do not remember its name. This technique is actually based on irregular meshes and hence would principally allow for an "overlapping" packing like in the 2nd atlas. However, that technique also requires a higher texel resolution than those shown in the OP to look good. (In other words, the 2nd atlas is probably not an example of this technique.)

 

Using irregular bounding boxes is also not exotic these days. Texture packers usually export a file besides the texture, wherein the clips are stored by name/index and texel co-ordinates. However, the usual texture packers still deal with AABB only, even if they support bin packing.

 


Please stop calling them “sprite sheets”. It’s an insult to the industry.

Well, this is interesting. In the world of perhaps not exactly professional 2D game makers there are many examples of tools and libraries that actually use the term "sprite sheet". There are for example Texture Packer, Zwoptex, cocos2d, and perhaps most noticeable Flash (at least in CS6). So the term is effectively introduced in the pre-industrial phase.


In Topic: help in Scaling in OpenGl

18 April 2014 - 10:12 AM


9 come form the scaling in x-axes and y-axes and also the y!that what I want  to understand

Err, well, the factor comes from the separate scalings and the fact that an area is two-dimenional: The area is the product of the two lengths (assuming they are orthogonally oriented, like principal x and y axes are), so when the original area is

     A := x * y

and the lengths are scaled by 3/4, the resulting area is

     A' := ( 3/4 * x ) * ( 3/4 * y ) = ( 3/4 * 3/4 ) * ( x * y ) = 9/16 * A 


In Topic: image Stretching

18 April 2014 - 09:51 AM


… but as i progress through the game driving continuously, the ground image starts stretching.

If the effect actually starts after already driving for a while, the problem may be due to an accumulation. Actually, there is a location in getTerrainNextPoint which is IMO problematic: Therein you continuously add 200 onto a float variable (namely the x co-ordinate of the terrain control points). I have no clue with which rate this is done, but if it happens often enough the float variable's precision will suffer. Could you check for the current value of that variable when the effect starts to be noticeable?

 

BTW: I would expect the problem to have an effect on the top terrain texture, too, but the hills visible in the two screen shots seem to be scaled well. However, that may be due to a difference in the values of terrainBottomTexSize and terrainTopTexSize.


In Topic: help in Scaling in OpenGl

18 April 2014 - 08:54 AM


But I am asking about scaling ,if it is right?,,,

As already said: "in principal, yes". And since you actually use push/pop matrix, its really okay.

 


i want to understand another point ,when I say 3/4 of the original ,that mean the x will be 3/4 of the original and also the y will be 3/4 of the original !

That isn't a question. Do you want a confirmation of what "scale by 3/4" means exactly?

 

Applying the routine glScale( 0.75, 0.75, 1 ) generates a matrix that scales the model in each axis separately, so that the lengths in direction of the principal x and y axes will be reduced to 3/4, and along the z direction nothing is changed. Because of the separation, the area covered by the 2D model will be 9/16-th and hence less than 3/4, of course. It isn't clear whether length or area scaling by 3/4 is meant when reading the OP.


In Topic: help in Scaling in OpenGl

18 April 2014 - 07:48 AM

I wonder why in the days where OpenGL 4.3 is out and 4.4 available at least as specification, still stuff of OpenGL 2.1 is allowed to be used in an assignment. But nevertheless ...

 


i want to draw house which is smaller than the original by 3/4:
I had used glscale(.75,.75,1) ,,,,1 because I use 2D
 
and I want to draw another house which is bigger than the original by 5/4
I had used glscale(1.25,1.25,1) ,,,,1 because I use 2D
 
Is this right??
In principle, yes. But you need to restrict their effect onto the respective model (or else consider an undo as suggested by DiegoSLTS above). Read about glPushMatrix and glPopMatrix to learn how to separate model transforms for different models. Notice however that the view transform is (usually) the same for all models, so that the correct moment of working with glPushMatrix and glPopMatrix is behind composing the view transform.

 

Another aspect is the order of glScale and any other transform you apply to the same house model. For example, the current house should be translated also just to not overlap with one of the other house drawings. If you choose the wrong order, then the scaling will not appear as you want.


PARTNERS