Click here to Skip to main content
15,920,632 members
Home / Discussions / Graphics
   

Graphics

 
AnswerRe: Image in form of matrix Pin
Ju@ncho8-Nov-07 2:52
Ju@ncho8-Nov-07 2:52 
QuestionGetting Image properties Pin
sniper475-Nov-07 23:19
sniper475-Nov-07 23:19 
AnswerRe: Getting Image properties Pin
MikeMarq8-Nov-07 4:44
MikeMarq8-Nov-07 4:44 
AnswerRe: Getting Image properties Pin
Pawel Gielmuda9-Nov-07 2:59
Pawel Gielmuda9-Nov-07 2:59 
GeneralRe: Getting Image properties Pin
sniper4710-Nov-07 8:15
sniper4710-Nov-07 8:15 
GeneralRe: Getting Image properties Pin
Luc Pattyn10-Nov-07 14:50
sitebuilderLuc Pattyn10-Nov-07 14:50 
QuestionDirect 3D retained mode Pin
anjeneya5-Nov-07 18:34
anjeneya5-Nov-07 18:34 
QuestionSimple Texturing Pin
Cyrilix5-Nov-07 15:29
Cyrilix5-Nov-07 15:29 
I have some pretty basic code that loads a texture, and tries to display it all across my terrain, however, it does not seem to be working and I can't for the life of me figure out why.

The loading code is here:
ifstream texFile("brickbump.bmp");
if (texFile.is_open())
{
    AUX_RGBImageRec* image = auxDIBImageLoad("brickbump.bmp");
    //Generate textures
    glGenTextures(1, &m_textures[0]);
    glBindTexture(GL_TEXTURE_2D, m_textures[0]);
    glTexImage2D(GL_TEXTURE_2D, GL_RGB8, 3, image->sizeX, image->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, image->data);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

    //Close files and free resources
    texFile.close();
    free(image);
}


After this, I have my function that redraws everything. Since it is too long, here is the important snippet:
//Enable texture mapping
glBindTexture(GL_TEXTURE_2D, m_textures[0]);

QuadVNode* tempNode = m_terrain->Tree()->GetFirstNode();
QuadVNode* nextLineNode = tempNode->Bottom();
int count = 0;
while (nextLineNode)
{
    glBegin(GL_TRIANGLE_STRIP);
    while (tempNode)
    {
        glNormal3d(tempNode->m_nx, tempNode->m_ny, tempNode->m_nz);
        if (count % 2 == 0)
            glTexCoord2d(0.0f, 0.0f);
        else if (count % 2 == 1)
            glTexCoord2d(1.0f, 0.0f);
        glVertex3d(tempNode->m_x, tempNode->m_height, tempNode->m_z);
        tempNode = tempNode->Bottom();

        glNormal3d(tempNode->m_nx, tempNode->m_ny, tempNode->m_nz);
        if (count % 2 == 0)
            glTexCoord2d(0.0f, 1.0f);
        else if (count % 2 == 1)
            glTexCoord2d(1.0f, 1.0f);
        glVertex3d(tempNode->m_x, tempNode->m_height, tempNode->m_z);
        tempNode = tempNode->Top()->Right();
        count++;
    }
    glEnd();
    tempNode = nextLineNode;
    nextLineNode = nextLineNode->Bottom();
}


My problem is that it doesn't display the texture. All it does is draw it as if I had simply done glNormal/glVertex over and over again, discarding the glTex2Coord call in between. Another thing I should mention is that I do have glEnable(GL_TEXTURE_2D) somewhere in my initialization code. Also, it does actually find the texFile, and sets m_textures[0] to an unsigned value of 1 when I call glGenTextures().
AnswerRe: Simple Texturing Pin
Cyrilix5-Nov-07 15:52
Cyrilix5-Nov-07 15:52 
QuestionPictureBox Bitmap Manipulation Pin
MikeMarq4-Nov-07 7:03
MikeMarq4-Nov-07 7:03 
AnswerRe: PictureBox Bitmap Manipulation Pin
Luc Pattyn4-Nov-07 8:01
sitebuilderLuc Pattyn4-Nov-07 8:01 
GeneralRe: PictureBox Bitmap Manipulation Pin
MikeMarq4-Nov-07 19:47
MikeMarq4-Nov-07 19:47 
Questionis there size limit for displaying an image? Pin
King Tran3-Nov-07 22:55
King Tran3-Nov-07 22:55 
AnswerRe: is there size limit for displaying an image? Pin
Luc Pattyn4-Nov-07 1:33
sitebuilderLuc Pattyn4-Nov-07 1:33 
GeneralRe: is there size limit for displaying an image? Pin
King Tran4-Nov-07 2:31
King Tran4-Nov-07 2:31 
AnswerRe: is there size limit for displaying an image? Pin
Paul Conrad4-Nov-07 8:00
professionalPaul Conrad4-Nov-07 8:00 
GeneralRe: is there size limit for displaying an image? Pin
King Tran5-Nov-07 2:08
King Tran5-Nov-07 2:08 
GeneralRe: is there size limit for displaying an image? Pin
Dan Neely6-Nov-07 2:19
Dan Neely6-Nov-07 2:19 
AnswerRe: is there size limit for displaying an image? Pin
El Corazon5-Nov-07 11:44
El Corazon5-Nov-07 11:44 
GeneralRe: is there size limit for displaying an image? Pin
Dan Neely6-Nov-07 2:20
Dan Neely6-Nov-07 2:20 
GeneralRe: is there size limit for displaying an image? Pin
El Corazon6-Nov-07 3:25
El Corazon6-Nov-07 3:25 
AnswerRe: is there size limit for displaying an image? Pin
Jheriko++17-Nov-07 16:59
Jheriko++17-Nov-07 16:59 
QuestionDirectX Animated Mesh Pin
Aknght2-Nov-07 16:28
Aknght2-Nov-07 16:28 
Questionscreen split Pin
amit.code31-Oct-07 20:20
amit.code31-Oct-07 20:20 
AnswerRe: screen split Pin
Adeel Chaudhry11-Nov-07 19:36
Adeel Chaudhry11-Nov-07 19:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.