LWJGL - Rendering A Texture Onto A VBO >>($10 REWARD)<<

Wow thanks man, good observations, ill fix the code later and see what happens!
Thanks everyone for trying to help :slight_smile:

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…
Imgur

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 :smiley:

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! :smiley: :slight_smile: :slight_smile:

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?
:smiley: :smiley: :smiley: :smiley: :smiley: :smiley:

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. :smiley:

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. :slight_smile:

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 :smiley: 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! :smiley:

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 : )