You are here:

C++/grphics via OpenGL

Advertisement


Question
sir i have made a room using GlutWireCube();.it is looking fine.now i want to paint its walls using texture mapping using red color.give me a code to do this.and give a idea of walk through in a room.
waiting for response.
thanks.

Answer
Hello naveed, thank you for the question.

Now that you have your room, you want to color its walls. This shouldn't be too hard.

I'm not too familiar with glut like I am with native OpenGL, but I'm sure if there is a function to create a cube there is a way to access each side of it. Once you access each side just call: glColor3f(1.0f, 0.0f, 0.0f). OpenGL color methods take parameters in the RGB form, with 0, 0, 0 being completely dark and 1, 1, 1 being completely white.

If there is no access method, you can do it the old fashioned way:

glBegin(GL_QUADS);
// set up the rest of the vertices
// glVertex3f()
// set the color of each
// glColor3f(1.0f, 0.0f, 0.0f)
glEnd();

Let me know how this works out.

If you have any other questions, please do not hesistate to ask.

- Eddie

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Eddie

Expertise

I can answer questions about the C++ language, object oriented design and architecture. I am knowledgable in a lot of the math that goes into programming, and am certified by ExpertRating.com. I also know a good deal about graphics via OpenGL, and GUIs.

Experience

I have completed numerous games and demos created with the C++ programming language. Currently employed as a software engineer in the modeling and simulation field. I have about 7 years experience.

©2016 About.com. All rights reserved.