Results 1 to 5 of 5

Thread: Texturing problems

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2001
    Location
    Whangarei , New Zealand
    Posts
    29

    Texturing problems

    I have been coding OpenGl for 3 days now
    my object renders but without the texture
    my code looks like this

    Setup routine

    FList := glGenLists(1);
    glGenTextures(1,@tn);
    glNewList(FList, GL_COMPILE);
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_TEXTURE_2D);
    glTexImage2D(GL_TEXTURE_2D,0,GL_RGB8,128,128,0,GL_ RGB,GL_UNSIGNED_BYTE,@bmp);
    glFrontFace(GL_CCW);
    glBegin(GL_TRIANGLE_FAN);
    glTexCoord2f(0,0);
    glVertex3f(0, -1, 0);
    glTexCoord2f(0,1);
    glVertex3f(-1, 0.5, 1);
    glTexCoord2f(1,0);
    glVertex3f(1, 0.5, 1);
    glTexCoord2f(1,1);
    glVertex3f(0, 0.5, -1);
    glTexCoord2f(0,1);
    glVertex3f(-1, 0.5, 1);
    glEnd;
    glEndList;


    Render Routine
    gluLookAt(0, 0, 6, 0, 0, -10, 0, 1, 0);
    glRotatef(FAngle, rx, ry, rz);
    glCallList(FList);


    What do i need to add / change to get the texture on the object

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,595

    Re: Texturing problems

    Hi !

    After glGenTextures() you must call glBindTexture() to select a texture to use.

    Mikael

  3. #3
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: Texturing problems

    You must also think about the minification filter. The default minification filter in OpenGL is GL_LINEAR_MIPMAP_NEAREST (or maybe it was GL_NEAREST_MIPMAP_LINEAR), and this filtermore requires a full set of mipmaps. Either create this fill set of mipmaps, or set minification filter to GL_NEAREST/GL_LINEAR.

    You might have to set wrapmodes aswell, but I dunno if this is required.

  4. #4
    Junior Member Newbie
    Join Date
    Aug 2001
    Location
    Whangarei , New Zealand
    Posts
    29

    Re: Texturing problems

    I have added 'glBindTexture(GL_TEXTURE_2D,tn);' after
    glGenTextures(1,@tn);

    it still makes no difference
    model still comes up white

  5. #5
    Junior Member Newbie
    Join Date
    Aug 2001
    Location
    Whangarei , New Zealand
    Posts
    29

    Re: Texturing problems

    I have added 'glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILT ER,GL_NEAREST);' after 'glBindTexture(GL_TEXTURE_2D,tn);'

    it still makes no difference
    model still comes up white

Similar Threads

  1. SDL and OpenGL Texturing Problems.
    By kabbotta in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 07-21-2015, 04:01 AM
  2. simple texturing problems
    By marty_arts in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 12-16-2006, 12:13 PM
  3. texturing problems
    By d-monster in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 11-23-2005, 05:48 PM
  4. Texturing problems;
    By LordOfTheUniverse in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 12-03-2002, 02:39 PM
  5. frustrating texturing problems
    By naz in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 02-19-2001, 01:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean