Jump to content

View more

Image of the Day

Inventory ! Va falloir trouver une autre couleur pour le cadre D: #AzTroScreenshot #screenshotsaturday https://t.co/PvxhGL7cOH
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Texturing a cube via glTexGen

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
No replies to this topic

#1 D.Chhetri   Members   

181
Like
0Likes
Like

Posted 13 November 2012 - 09:17 PM

void Building::_renderDefaultBuilding()const{
    glColor3f(1.0f,1.0f,1.0f);
    glTranslatef(m_position.x,m_position.y,m_position.z);
    Vector3f t = m_size / 2.0f;
    glTranslatef(t.x,t.y,-t.z); //translate so its bottom surface starts at (0,0,0)
    glScalef(m_size.x,m_size.y,m_size.z);
   
    if(!Resource::textureList.empty()){
	    glBindTexture(GL_TEXTURE_2D, Resource::textureList[Resource::NIGHT_BUILDING_TEXTURE]);
	    float s[] = {0.01f,0.0f,0.0f,0.0f};
	    float t[] = {0.0f,0.01f,0.0f,0.0f};
	    glTexGenfv(GL_S, GL_OBJECT_LINEAR, s);
	    glTexGenfv(GL_T, GL_OBJECT_LINEAR, t);
	    glEnable(GL_TEXTURE_GEN_S);		 // Auto Texture Generation
	    glEnable(GL_TEXTURE_GEN_T);
    }
    glutSolidCube(1.0f);
    glScalef(1.0f/m_size.x,1.0f/m_size.y,1.0f/m_size.z);
    glTranslatef(-t.x,-t.y,t.z);
    glTranslatef(-m_position.x, -m_position.y, -m_position.z);
}

so I have the above code, but I need help with auto generating the textures such that I can scale which part of the texture gets rendered. Any help on this?
Edge cases will show your design flaws in your code!
Visit my site
Visit my FaceBook
Visit my github




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.