Jump to content
  • Advertisement

polishprogrammer

Member
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

118 Neutral

About polishprogrammer

  • Rank
    Newbie
  1. Now i tried to work it out by trying. I created another project, and started coding   Something weird happens:   Troj.java has 2 significant line groups,  Triangle3D troj1 = new Triangle3D( new Vertex3D[] {new Vertex3D(1, 2, 0), new Vertex3D(1,1, 0),new Vertex3D(2, 1, 0)}, new Vertex3D[] {new Vertex3D(1, 1, 0), new Vertex3D(1, 0, 0),new Vertex3D(0, 1, 0)}); Triangle3D troj2 = new Triangle3D( new Vertex3D[] {new Vertex3D(1, 2, 0), new Vertex3D(2,1, 0),new Vertex3D(2, 2, 0)}, new Vertex3D[] {new Vertex3D(0, 0, 0), new Vertex3D(0, 1, 0),new Vertex3D(1, 0, 0)}); Triangle3D troj3 = new Triangle3D( new Vertex3D[] {new Vertex3D(3, 2, 0), new Vertex3D(4,1, 0),new Vertex3D(4, 2, 0)}, new Vertex3D[] {new Vertex3D(1, 0, 0), new Vertex3D(1, 1, 0),new Vertex3D(0, 1, 0)}); try { troj1.tex = TextureLoader.getTexture("PNG", Troj.class.getResourceAsStream("/wood.png")); troj2.tex = TextureLoader.getTexture("PNG", Troj.class.getResourceAsStream("/wood.png")); //troj3.tex = TextureLoader.getTexture("PNG", Troj.class.getResourceAsStream("/wood.png")); System.out.println(troj1.tex.getImageHeight() + "x" + troj1.tex.getImageWidth()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } troj1.render(); //troj2.render(); //troj3.render(); So the fun begins.   When I comment out troj2.render();, the second triangle doesn't render. That's ok. The first renders ok with the texture in a form that can be distinguished But when i comment out troj2.tex = [...], the first (!) triangle [ named troj1 in code ] doesn't have any texture. it's white!   I have no idea why this happens. It shouldn't happen. troj1 and troj2 are two different variables.   Full code   I'm new to LWJGL and game programming, please help!
  2. As soon as possible i will post the test obj file. I also coded a new obj loader, just to make sure. I will try to find actual uvmap test texture, for OpenGL. Expect it this weekend/Fri.
  3. I think slick makes it to compromise the coordinates, so if your texture wouldn;t be upside down. This may be a part of the problem (What if my OpenGL logic fails to clamp it properly AND additionally Slick flips it upside-down?)   I tried different combos of multiplying texture coords by -1 but it didn't fix it.   I still need to create a basic OBJ file by hand with my own texcoords to see what will it do.    Make sure to check both revisions of the gist linked in the first post. Maybe you could see what's wrong or give me some general directions or tips?
  4. Oh no!   Slick util rotates the texture when loading! http://wiki.lwjgl.org/wiki/The_Quad_textured#.28Texture.29_Coordinates
  5. Oh, I didn't know that! I'll try to modify the OBJ manually to set the coords, and see it it works. 
  6. Hello, I'm new here, so i don't know what to expect   Anyways, i have this weird problem with rendering a 3d model with textures in LWJGL   That's how it works:   1. The OBJ file is loaded, and an instance of Model3D 2. The corresponding MTL file, and a PNG texture is loaded. 3. The 3d model is rendered.   The revelant code (This is a modification of my 2d game i want to port to 3d, basically much stuff needs to be rewritten. That's just the code that works):   The renders       First picture is the render     Second is the wireframe     Third is the texture       and a bit more of discussion here            
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!