OpenGL проблема с текстурой

Тема в разделе "WASM.OpenGL", создана пользователем Al Shark, 24 май 2006.

  1. Al Shark

    Al Shark New Member

    Публикаций:
    0
    Регистрация:
    16 май 2006
    Сообщения:
    13
    Адрес:
    Moscow
    решил серьезно заняться OpenGL и столкнулся с проблемой при работе с текстурами

    создаю обьект описанный в массиве GL_T2F_N3F_V3F, а при его отображении текстура ведет себя не так как ожидалось



    результат работы и текстура лежат в прикрепленном архиве (в текстуре зелеными линиями показано как она должна накладываться на куб)



    ;-----------------------------



    куб я использую только как тест - моя цель текстурировать очень сложный обьект поэтому кубические текстуры и авто генерация текстурных координат мне не подойдут



    ;-----------------------------

    ...

    invoke glEnable,GL_TEXTURE_2D

    invoke glGenTextures,1,offset texturename

    invoke glBindTexture,GL_TEXTURE_2D,[texturename]

    invoke glTexParameteri,GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR

    invoke glTexParameteri,GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR

    invoke glTexImage2D,GL_TEXTURE_2D,0,GL_RGB,128,128,0,GL_RGB,GL_UNSIGN ED_BYTE,offset texture

    ...

    invoke glHint,GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST

    invoke glInterleavedArrays,GL_T2F_N3F_V3F,0,offset t2n3v3

    invoke glDrawArrays,GL_TRIANGLES,0,12*3

    ...

    ;-----------------------------



    данные получены с помощю скрипта из 3ds max

    в формате GL_T2F_N3F_V3F по одному face-у в строке т.е. t1x,t1y,n1x,n1y,n1z,v1x,v1y,v1z,t2x,t2y,n2x,n2y,n2z,v2x,v2y,v2z,t3x,t3 y,n3x,n3y,n3z,v3x,v3y,v3z



    ;-----------------------------

    t2n3v3 dd 0.5,0.5,0.0,0.0,-1.0,-30.0,-30.0,-30.0,0.5,0.25,0.0,0.0,-1.0 ,-30.0,30.0,-30.0,0.75,0.25,0.0,0.0,-1.0,30.0,30.0,-30.0

    dd 0.75,0.25,0.0,0.0,-1.0,30.0,30.0,-30.0,0.75,0.5,0.0,0.0,-1.0,30.0 ,-30.0,-30.0,0.5,0.5,0.0,0.0,-1.0,-30.0,-30.0,-30.0

    dd 0.25,0.5,0.0,0.0,1.0,-30.0,-30.0,30.0,1.0,0.5,0.0,0.0,1.0,30.0,-3 0.0,30.0,1.0,0.25,0.0,0.0,1.0,30.0,30.0,30.0

    dd 1.0,0.25,0.0,0.0,1.0,30.0,30.0,30.0,0.25,0.25,0.0,0.0,1.0,-30.0,3 0.0,30.0,0.25,0.5,0.0,0.0,1.0,-30.0,-30.0,30.0

    dd 0.5,0.5,0.0,0.0,-1.0,-30.0,-30.0,-30.0,0.75,0.5,0.0,0.0,-1.0,30.0 ,-30.0,-30.0,1.0,0.5,0.0,0.0,1.0,30.0,-30.0,30.0

    dd 1.0,0.5,0.0,0.0,1.0,30.0,-30.0,30.0,0.25,0.5,0.0,0.0,1.0,-30.0,-3 0.0,30.0,0.5,0.5,0.0,0.0,-1.0,-30.0,-30.0,-30.0

    dd 0.75,0.5,0.0,0.0,-1.0,30.0,-30.0,-30.0,0.75,0.25,0.0,0.0,-1.0,30. 0,30.0,-30.0,1.0,0.25,0.0,0.0,1.0,30.0,30.0,30.0

    dd 1.0,0.25,0.0,0.0,1.0,30.0,30.0,30.0,1.0,0.5,0.0,0.0,1.0,30.0,-30. 0,30.0,0.75,0.5,0.0,0.0,-1.0,30.0,-30.0,-30.0

    dd 0.75,0.25,0.0,0.0,-1.0,30.0,30.0,-30.0,0.5,0.25,0.0,0.0,-1.0,-30. 0,30.0,-30.0,0.25,0.25,0.0,0.0,1.0,-30.0,30.0,30.0

    dd 0.25,0.25,0.0,0.0,1.0,-30.0,30.0,30.0,1.0,0.25,0.0,0.0,1.0,30.0,3 0.0,30.0,0.75,0.25,0.0,0.0,-1.0,30.0,30.0,-30.0

    dd 0.5,0.25,0.0,0.0,-1.0,-30.0,30.0,-30.0,0.5,0.5,0.0,0.0,-1.0,-30.0 ,-30.0,-30.0,0.25,0.5,0.0,0.0,1.0,-30.0,-30.0,30.0

    dd 0.25,0.5,0.0,0.0,1.0,-30.0,-30.0,30.0,0.25,0.25,0.0,0.0,1.0,-30.0 ,30.0,30.0,0.5,0.25,0.0,0.0,-1.0,-30.0,30.0,-30.0

    ;-----------------------------

    подскажите где ошибка или что я делаю не так

    [​IMG] 912132260__result.rar
     
  2. Al Shark

    Al Shark New Member

    Публикаций:
    0
    Регистрация:
    16 май 2006
    Сообщения:
    13
    Адрес:
    Moscow
    ошибка была с скрипте. сейчас я его исправил и выкладываю в прикрепленном архиве - там 2е версии экспорт в txt и dat форматы. скрипты написаны под 3ds max 8 но вроде бы должны пойти на 6 и 7.

    [​IMG] _343943684__t2n3v3.rar