Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Automatic texture generation

This topic is 6492 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello again, Right now i am working on using the textures or "materials" as 3dstudio max puts it in my program. I am using ase files and load in most of the attributes specified. I noticed many of the materials it exports to the file have no image reference so I am creating a 64x64x4 array, to hold a rbga value for each pixel. I then store in each of the pixels the ambience value multiplied by the diffuse for each pixel * 255. Is this the correct way to get the color of the material? I call glBindTexture and glTexImage2d with each of the textures i create. From my readings I have guessed that for opengl to create the texture coordinates for my material i need to use the following: glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); glEnable(GL_TEXTURE_2D); currentCoeff = xequalzero; currentGenMode = GL_OBJECT_LINEAR; currentPlane = GL_OBJECT_PLANE; glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, currentGenMode); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, currentGenMode); glTexGenfv(GL_S, currentPlane, currentCoeff); glTexGenfv(GL_T, currentPlane, currentCoeff); xequalzero is an array defined as 1,0,0,0 I initially set these parameters then before i draw the verticies for each object a material applies to i call glBindTexture(GL_TEXTURE_2D, texture[subobject.material_no]); material_no basically refers to which texture no it uses. right now this does not effect the way my object looks at all, it looks exactly the same as before i implemented all of texturing code- it still is displaying the vertex colors as I orinally set them, I use glColor3f(r,g,b) to color each vertex still -the gl coloring between the vertexes is done with glShadeModel(GL_SMOOTH) this shade model should be overwritten by the texture for each object should it not? Is there something i''m missing? like needing to call something else for gl to automatically generate coordinates? unfortunatly 3dstudio max does not generate texture coordinates for non image based materials from what i can tell so i need to figure this out! Thanks to anyone who can help me with this!

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!