Java-Gaming.org Hi !
Featured games (88)
games approved by the League of Dukes
Games in Showcase (679)
Games in Android Showcase (194)
games submitted by our members
Games in WIP (732)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Can anyone help me understand these texture coordinates?  (Read 815 times)
0 Members and 1 Guest are viewing this topic.
Offline Addictman

Senior Devvie


Medals: 3
Projects: 1


Java games rock!


« Posted 2011-09-20 12:53:53 »

Hi.

Imagine a very basic Texture atlas, looking roughly like this: (A and B are the 2 different pieces).

AAB
AA

Now, judging from this, piece A can be found at
1  
[ left: 0.0f, bottom: 0.0f, right: 0.66667f, top: 1.0f ]

I have always imagined, and was sure that piece B could be found at
1  
[ left: 0.66667f, bottom: 0.5f, right: 1.0f, top: 1.0f ]


However, that's not coming out right at all. Piece B IS coming out right at
1  
[ left: 0.66667f, bottom: 0.0f, right: 1.0f, top: 0.5f ]
however.

I render as triangles, and my data for rendering B looks like this:

Vertexbuffer
1  
2  
3  
4  
5  
6  
float[] {
                       x - 64, y + 64, // top left
             x - 64, y - 64, // bottom left
             x + 64, y - 64, // bottom right
                       x + 64, y + 64 // top right
                  }


Texturebuffer (doesnt work, but what I thought was correct)
1  
2  
3  
4  
5  
6  
float[] {
                       0.66667f, 1.0f,
             0.66667f, 0.5f,
             1.0f,0.5f,
             1.0f,1.0f
                   }


Texturebuffer (works, but what I thought was wrong)
1  
2  
3  
4  
5  
6  
float[] { 
                       0.66667f, 0.5f,
             0.66667f, 0.0f,
             1.0f,0.0f,
             1.0f,0.5f
                   }


I hope my question is understandable, and that someone can explain to me what's going on here.
Offline Addictman

Senior Devvie


Medals: 3
Projects: 1


Java games rock!


« Reply #1 - Posted 2011-09-20 13:11:40 »

Ok, I should have tried this first of course, rendering the entire Atlas... The entire texture is flipped vertically, so that explains the weird texture coordinates.
Offline theagentd

« JGO Bitwise Duke »


Medals: 751
Projects: 4
Exp: 8 years



« Reply #2 - Posted 2011-09-20 17:06:30 »

Ok, I should have tried this first of course, rendering the entire Atlas... The entire texture is flipped vertically, so that explains the weird texture coordinates.
I was just going to say that. xD

Myomyomyo.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 
Hydroque (18 views)
2016-05-26 14:45:46

Mac70 (40 views)
2016-05-24 21:16:33

theagentd (42 views)
2016-05-14 18:38:35

theagentd (76 views)
2016-05-10 22:37:41

theagentd (84 views)
2016-05-10 22:33:46

IanParcs (110 views)
2016-04-18 14:18:53

KaiHH (108 views)
2016-04-18 08:35:41

KaiHH (130 views)
2016-04-15 12:43:58

theagentd (135 views)
2016-04-14 02:16:17

theagentd (158 views)
2016-04-14 02:15:43
FPS Camera Tutorial
by Hydroque
2016-05-22 05:40:58

Website offering 3D Models specifically for games for free
by vusman
2016-05-18 17:23:09

Website offering 3D Models specifically for games for free
by vusman
2016-05-09 08:50:56

Website offering 3D Models specifically for games for free
by vusman
2016-05-06 11:10:21

Website offering 3D Models specifically for games for free
by vusman
2016-04-29 12:56:17

List of Learning Resources
by SilverTiger
2016-02-05 09:39:47

List of Learning Resources
by SilverTiger
2016-02-05 09:38:38

List of Learning Resources
by SilverTiger
2016-02-05 09:35:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!