Wow thanks man, good observations, ill fix the code later and see what happens!
Thanks everyone for trying to help
Its weird its like half of the texture is stretched and the other half is fine, so it must be an error to do with that, because the texture itself is actually being drawn!
Here, it shows the normal texture in the bottom to top left triangle whereas its like its been stretched across for the one the rightā¦
Also, the new project files:
Start by texturing a VBO quad manually, then a cube. After that, export a quad from blender or whatever you use and write your code from scratch. Make it as simple as possible. When you succeed, only then go on and implement it in your project
I know how they work so this would be pointless man ;D
If you have so much knowledge on the subject I would love to see if you could fix the problem here ;D ;Dā¦
Haha, the problem is I -donāt- have the knowledge :-X Iāll have a go, but I donāt know when Iāll have free time :clue:
Thanks man, thats the spirit!
Eh, you make it sound like Iām doing work for youā¦
Haha. No, your just being a nice gentlemen by helping out a fellow JGOer
Any one figured it out yet, theres $5 up for grabs!
So did you change UV component amount to 2 instead of 3?
In the code in the first post, you tell opengl that your UVs are of 3 components, but you put only 2.
From this:
glTexCoordPointer(3, GL_FLOAT, 0, 0)
To this:
glTexCoordPointer(2, GL_FLOAT, 0, 0)
Yes I have done that, here is the latest source code:
The main reason people arenāt helping you is that you keep giving us your code via dropbox and not via pastebin like people keep saying.
Short of pastebin, you could use Github or something of the like.
But tbh I donāt think JGO is the place to be giving out money as a reward, generally if people have the abilities to help you (and youāre not making it too hard for them), they will help you.
Well I thought putting the project up would be easier and from what I remember no one has said use pastebin, but I shall if it helps. Thanks! ;D
Pastebin Links:
MAIN GAME:
http://pastebin.java-gaming.org/7fd9d8a529f
DISPLAY MANAGER:
http://pastebin.java-gaming.org/d9da20f6b99
FACE:
http://www.java-gaming.org/?action=pastebin&id=961
MODEL:
http://www.java-gaming.org/?action=pastebin&id=962
OBJLOADER:
http://www.java-gaming.org/?action=pastebin&id=963
Thereās almost literally no reason to ever bump a post here on JGO, pretty much all the regulars read everything⦠not to mention itās a fairly small community (at least, active poster wise), itās not like youāre going to bump off the first page in 24 hours.
Ahh, now heres a man I know well. Hows your game coming on? Do you still livestream? and do you know what my projects problem is?
and yeah sorry for the bump, my bad. I dont usually do it im just a little stressed because I really cant figure it outā¦
8)
Iāve just had a really quick look into your source code and one minor issue that Iāve spotted is that when youāre loading OBJ files you should negate 1 from the indices (because OBJ starts indexing at 1, while Java and most of the programming languages start indexing arrays and lists at 0). So essentially you should change your OBJ loaderās last lines to something like:
} else if (line.startsWith("f ")) {
Vector3f vertexIndices = new Vector3f(Float.valueOf(line.split(" ")[1].split("/")[0]-1),
Float.valueOf(line.split(" ")[2].split("/")[0]-1),
Float.valueOf(line.split(" ")[3].split("/")[0]-1));
Vector3f uvIndices = new Vector3f(Float.valueOf(line.split(" ")[1].split("/")[1]-1),
Float.valueOf(line.split(" ")[2].split("/")[1]-1),
Float.valueOf(line.split(" ")[3].split("/")[1])-1);
Vector3f normalIndices = new Vector3f(Float.valueOf(line.split(" ")[1].split("/")[2]-1),
Float.valueOf(line.split(" ")[2].split("/")[2]-1),
Float.valueOf(line.split(" ")[3].split("/")[2])-1);
m.faces.add(new Face(vertexIndices, uvIndices, normalIndices));
}
Edit: Do not mind the code snippet above. Iāve just noticed that you negate 1 from your indices in your gameās setupVBOs() method. By the way, no offense but your code is bit uhm⦠Ugly.
Also some general tips that can help: Always make sure that youāre checking for OpenGL errors with glGetError(), and donāt enable face culling until youāve got everything working. Once thatās done enable culling and if you get weird results make sure that your winding order is correct, or change the default winding order from CCW to CW.
Finally, it would might help to take a look at my extremely small 3D engineās graphics package (it isnāt even capable of using textures on models, just vertices, normals and a single light source), it uses modern OpenGL (3.1+) but it shouldnāt be an issue for you to port it to older OpenGL.
Edit2: Downloaded your eclipse project, now Iām trying to make sense of things. Hopefully I will be able to soon spot the mistake.
Cheers buddy and yeah I know the codes ugly and probably extremely unoptimised but Iāll get round to sorting it once the errors fixes, I like your effort and attitude to contribution here. Good job buddy! ;D and I hope you can help fix it!
I have been speaking with a fellow member of the community whom i believe speaks for many in that i have acted inappropriately. I apologise if i came across aggressive, or if i offended anyone with my language. I also apologise for the large amounts of unnessacary code.
All in all, i apologise!
Giving you a solution to your current problem would be doing you a disservice.
The problem described in the original post is a side effect of the way in which you program, try to consider how you got in a situation where you are unable to find (Let alone fix) a bug that could be in any part of 5 different files.
If you keep working like you are now, youāll keep running into problems like this.
I recommend that you carefully document your code as you are writing it and take great care in writing programs that are modular so you can point at the exact subroutine that is causing you problems and fix or replace it.
Take time to consider your programās design, in a perfect world you could test each component of your program individually and determine if it is stable.
In the real world, components depend on each other, but we can at least try to determine a component is stable before allowing new components to depend on it.
I hope you can tell Iām trying to help and not trying to be condescending : )