Skip to main content
GameDev.net gamedev.net
🔒 Locked

Trouble Understanding Textures in OpenGL

Started by Trent Linton Mar 27, 2012 at 3:35 PM 3 replies 1k views
Original Post
Trent Linton
Trent Linton
I am trying to texture a Mini Maze in OpenGL using a bunch of hard coded wire cubes, but I don't Understand how to get it to display on the faces of the cube and not display in between each connected cube so it looks like a long hallway.

//Map for Maze
//....................Finish..............
//......................{F}.................
//......................[6]..................
//......................[5]..................
//..

[8][9][0][1][4][1][0][9][8]


//......[7]............................[7]...
//......[6]............................[6]...
//......[5]............

............[5]...
//..

[4][3][2][1][3][1][2][3][4]


//......................[2]................
//......................[1].................
//......................{S}................
//....................Start..............

Disclamer: I am Not in any sense of the word, a decent programmer, It is likely I will Not understand your answer to my questions about programming.
WhiskyJoe
WhiskyJoe
I'm not sure if I understand you correctly, but if you mean that you want your hall to look like it is one seamless texture, you can do either of these 2:

Create a texture that is tileable, so the end of one part is the beginning of the new part of your blocks texture.

Or manage your UV coordinates to go over the span of an X amount of blocks.
Trent Linton
Trent Linton
I don't care if it's seamless for now, because I'm just trying to get a different texture applied to the "walls", "ceiling", & "floor". It won't be until after I can get it to work will I worry about the look of it.

My original post May have been a little unclear, I have no idea how to get texture to display in the manner I am asking, probally because I've never work with OpenGL texture stuff before. I understand the how it works, but I can't get it to work
Disclamer: I am Not in any sense of the word, a decent programmer, It is likely I will Not understand your answer to my questions about programming.
frob
frob
What have you tried?

There are resources online (such as NeHe) and offline (such as the OpenGL Programming Guide) that explain it rather well.
WhiskyJoe
WhiskyJoe
Ah right, you're looking for "per face material/textures" than? if you create the geometry yourself you might want to just create individual planes and apply the texture to that and construct those in a box.

Eventually, you will most likely want to add some more complex geometry and perhaps create a modelloader of some format.

Anyway, as frob already mentioned. Nehe (and plenty others) have some good tutorials that can help you get on track.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.