Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (769)
Games in Android Showcase (230)
games submitted by our members
Games in WIP (856)
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  
  Texture problems  (Read 1585 times)
0 Members and 1 Guest are viewing this topic.
Offline weston
« Posted 2004-12-18 00:21:22 »

I've just started writing a 2D game, my first with lwjgl, and I noticed that the image I loaded was a bit skewed. The image was much wider and shorter than it should be. The image is a 24-bit png. The projection setup I'm using looks like this:

GLU.gluOrtho2D(0, Game.gameWidth, 0, Game.gameHeight);

I'm trying to map an image to a quad so that the corners of the image meet up with the corners of the quad, code looks like this:

     GL11.glTranslatef(x, y, 0);
         GL11.glTexCoord2f(1f, 0); GL11.glVertex2f(400, 0);
         GL11.glTexCoord2f(1f, 1f); GL11.glVertex2f(400, 400);
         GL11.glTexCoord2f(0, 1f); GL11.glVertex2f(0, 400);
         GL11.glTexCoord2f(0, 0); GL11.glVertex2f(0, 0);

I tried a different image that doesn't use transparency and it draws a black square the actual size of the image with the actual image occupying the lower-lefhand side of that square, heres a screen:

the current color is set to red, so I don't know why the square is black. Btw, I'm using KevGlass's TextureLoader class from space invaders 104. Any ideas?

for(int i = 1; i > 0; i++)
     System.out.println(i+" cups of java downed");
Offline weston
« Reply #1 - Posted 2004-12-18 00:33:41 »

ah crud, figured it out... I forgot that I need to use power of two textures, the images were mishapen cause kev's texture  loader class uses the closes size that is a power of two if you give an image with illegal dimensions. I do have another texture problem though. I have two textures, one of them is 256x256 and the other is 512x128, I measured the time required to load the two textures and its about 1200 milliseconds, 1000 if I don't flip the images first. That seems way too long, is it?

for(int i = 1; i > 0; i++)
     System.out.println(i+" cups of java downed");
Offline CaptainJester

JGO Knight

Medals: 12
Projects: 2
Exp: 14 years

Make it work; make it better.

« Reply #2 - Posted 2004-12-18 01:45:43 »

If you start or are using v0.94 of LWJGL, it now includes basic DevIL support.  You can check out NeHe Lesson 6 tutorial for how to use it.

Pages: [1]
  ignore  |  Print  

EgonOlsen (1642 views)
2018-06-10 19:43:48

EgonOlsen (1703 views)
2018-06-10 19:43:44

EgonOlsen (1155 views)
2018-06-10 19:43:20

DesertCoockie (1583 views)
2018-05-13 18:23:11

nelsongames (1183 views)
2018-04-24 18:15:36

nelsongames (1706 views)
2018-04-24 18:14:32

ivj94 (2514 views)
2018-03-24 14:47:39

ivj94 (1731 views)
2018-03-24 14:46:31

ivj94 (2812 views)
2018-03-24 14:43:53

Solater (952 views)
2018-03-17 05:04:08
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 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‑
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!