C++/graphics via OpenGL
Expert: Eddie - 6/19/2005
Questionsir i m going to make a project in opengl.it is a type of house.sir i m going to make one room.i wanna place some oblects in it like bed,table,chair etc.
sir guide me how to make a room and place objects in it.sir give me some idea of texture mapping as well n how to use it.
waiting for response.
thanks
AnswerHello naveed, thank you for the question.
Mapping textures in OpenGL isn't too hard. You must first understand how texture coordinates work. The entire image can be thought of as 2 sets of points, 0, 0, and 1, 1. To visually illustrate
(1, 1)
------
| |
| |
------
(0, 0)
Just in case all experts disables my formatting, (0, 0) is in the bottom left corner and (1, 1) is in the top right. You use the image like this to map it over your polygon using the function glTexCoord2f(). The functions glVertex3f() and glNormal3f() to specify your verticies and normals on your objects.
I would suggest that you take a look at the functions glPushMatrix() and glPopMatrix() when it comes to positioning your objects in relation to each other in 3d space. One caveat with that would be that the OpenGL matrix stack limit is 32, but I don't think that should be an issue.
I would like to reference www.opengl.org for helpful tidbits of information.
If you have any other questions, please do not hesistate to ask.
I hope this information was helpful.
- Eddie