0

I have a simple 3D cube in openGL drawn by glut:

glLoadIdentity();
glTranslatef(0.0f,0.0f,-5.0f);
glutWireCube(2.0f);

Now, if I'm using a very simple model / texture (say a RAW file drawn in photoshop) how can I then assign these textures (for a cube I'd probably make a "face" model and simply display it across the 6 faces of the cube) to the shape in the code so that when I manipulate the shape - resize, translate, etc. - the texture / model changes along with the shape?

genpfault
  • 51,148
  • 11
  • 85
  • 139
lululoo
  • 163
  • 2
  • 14
  • 1
    Can you try to clear up your terminology a bit? The 'model' **is** the shape. When you say 'move the model along with the shape' that makes no sense to me. – Tim May 11 '12 at 04:23
  • 1
    [Possible duplicate](http://stackoverflow.com/questions/327043/how-to-apply-texture-to-glutsolidcube). It doesn't make sense to texture a _wire_ cube. – Stefan Hanke May 11 '12 at 05:27
  • Sorry about the misunderstanding. Could you explain why it doesn't make sense to texture a wire cube? I'm new to this and that seems like a perfectly fine idea. To clarify, I have an openGL geometric primitive of some sort. Is there any way I can somehow overlay a texture onto this geometric primitive, in a way where if I were to change the geometric primitive, the texture would change along with it? – lululoo May 11 '12 at 12:34
  • The wire cube consists only of lines, and thus has no faces that could be _textured_. You just need the solid cube. As the other post stated, there is no way to attach texture coordinates to the geometry generated by the `glut*` functions. You need to do this on your own. Oh, and please use @StefanHanke in front of a comment if you want someone to be notified -- see the help to the right of the comment box. – Stefan Hanke May 11 '12 at 14:08
  • @StefanHanke thanks for giving the right terminology to continue this search on my own; I found this: http://www.gamedev.net/page/resources/_/technical/opengl/opengl-texture-mapping-an-introduction-r947 I'll have to study on my own from this point. Thanks again! – lululoo May 11 '12 at 20:20

0 Answers0