AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX: Программирование
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 21.11.2006, 16:57   #1  
Eldar9x is offline
Eldar9x
MCTS
Аватар для Eldar9x
Oracle
MCBMSS
 
1,064 / 166 (8) ++++++
Регистрация: 29.09.2006
Адрес: Казань
OpenGL (вот что есть на данный момент)
Код:
static void Job5(Args _args)
{
    HWND mainWindow;
    HWND dc;
    HWND hrc;
    // Загрузка библиотек
    DLL  opengl32 = new DLL("opengl32.dll");
    DLL  glu32    = new DLL("glu32.dll");
    DLL  gdi32    = new DLL("gdi32.dll");
    //
 
    // Получение точек входа функций
    DLLFunction opengl32_wglCreateContext = new DLLFunction(opengl32, "wglCreateContext");
    DLLFunction opengl32_wglMakeCurrent   = new DLLFunction(opengl32, "wglMakeCurrent");
    DLLFunction opengl32_glEnable         = new DLLFunction(opengl32, "glEnable");
    DLLFunction gdi32_ChoosePixelFormat   = new DLLFunction(gdi32,    "ChoosePixelFormat");
    DLLFunction gdi32_SetPixelFormat      = new DLLFunction(gdi32, "SetPixelFormat");
    DLLFunction opengl32_glMatrixMode     = new DLLFunction(opengl32, "glMatrixMode");
    DLLFunction opengl32_glLoadIdentity   = new DLLFunction(opengl32, "glLoadIdentity");
    DLLFunction glu32_gluPerspective      = new DLLFunction(glu32, "gluPerspective");
    //
    Binary  pixelFormatDescriptor = new Binary(40);
    void setDCPixelFormat()
    {
        int nPixelFormat;
        ;
        pixelFormatDescriptor.Word(0, 40);                // nSize
        pixelFormatDescriptor.Word(2, 1);                 // nVersion
        pixelFormatDescriptor.dWord(4, 4 | 32 | 1);     // dwFlags
        pixelFormatDescriptor.byte(8, 0);                 // iPixelType
        pixelFormatDescriptor.byte(9, 24);                // cColorBits
        pixelFormatDescriptor.byte(10, 0);  // cRedBits;
        pixelFormatDescriptor.byte(11, 0);  // cRedShift;
        pixelFormatDescriptor.byte(12, 0);  // cGreenBits;
        pixelFormatDescriptor.byte(13, 0);  // cGreenShift;
        pixelFormatDescriptor.byte(14, 0);  // cBlueBits;
        pixelFormatDescriptor.byte(15, 0);  // cBlueShift;
        pixelFormatDescriptor.byte(16, 0);  // cAlphaBits;
        pixelFormatDescriptor.byte(17, 0);  // cAlphaShift;
        pixelFormatDescriptor.byte(18, 0);  // cAccumBits;
        pixelFormatDescriptor.byte(19, 0);  // cAccumRedBits;
        pixelFormatDescriptor.byte(20, 0);  // cAccumGreenBits;
        pixelFormatDescriptor.byte(21, 0);  // cAccumBlueBits;
        pixelFormatDescriptor.byte(22, 0);  // cAccumAlphaBits;
        pixelFormatDescriptor.byte(23, 32); // cDepthBits;
        pixelFormatDescriptor.byte(24, 0);  // cStencilBits;
        pixelFormatDescriptor.byte(25, 0);  // cAuxBuffers;
        pixelFormatDescriptor.byte(26, 0);  // iLayerType;
        pixelFormatDescriptor.byte(27, 0);  // bReserved;
        pixelFormatDescriptor.dWord(28, 0); // dwLayerMask;
        pixelFormatDescriptor.dWord(32, 0); // dwVisibleMask;
        pixelFormatDescriptor.dWord(36, 0); // dwDamageMask
        nPixelFormat = gdi32_ChoosePixelFormat.call(dc, pixelFormatDescriptor);
        gdi32_SetPixelFormat.call(dc, nPixelFormat, pixelFormatDescriptor);
 
    }
    void initializeRC()
    {
        opengl32_glEnable.call(2929);
        opengl32_glEnable.call(2896);
        opengl32_glEnable.call(16384);
    }
 
    void repaint()
    {
    }
    ;
    // Установка функций
    opengl32_wglCreateContext.returns(ExtTypes::DWord);
    opengl32_wglCreateContext.arg(ExtTypes::DWord);
    opengl32_wglMakeCurrent.returns(ExtTypes::DWord);
    opengl32_wglMakeCurrent.arg(ExtTypes::DWord, ExtTypes::DWord);
    opengl32_glEnable.returns(ExtTypes::void);
    opengl32_glEnable.arg(ExtTypes::DWord);
    gdi32_ChoosePixelFormat.returns(ExtTypes::DWord);
    gdi32_ChoosePixelFormat.arg(ExtTypes::DWord, ExtTypes::Pointer);
    gdi32_SetPixelFormat.returns(ExtTypes::DWord);
    gdi32_SetPixelFormat.arg(ExtTypes::DWord, ExtTypes::DWord, ExtTypes::Pointer);
    opengl32_glMatrixMode.returns(ExtTypes::void);
    opengl32_glMatrixMode.arg(ExtTypes::DWord);
    opengl32_glLoadIdentity.returns(ExtTypes::void);
    opengl32_glLoadIdentity.arg();       // возможно нужно добавить
    glu32_gluPerspective.returns(ExtTypes::void);
    glu32_gluPerspective.arg(ExtTypes::Double, ExtTypes::Double, ExtTypes::Double, ExtTypes::Double);
    //
    mainWindow = infolog.hWnd();
    dc         = WinAPI::getWindowDC(mainWindow);
    setDCPixelFormat();
    hrc = opengl32_wglCreateContext.call(dc);
    opengl32_wglMakeCurrent.call(dc, hrc);
    initializeRC();
    opengl32_glMatrixMode.call(5889);
    opengl32_glLoadIdentity.call();
    glu32_gluPerspective.call(10.0, 1.0, 1.0, 10.0);
 
 
 
    info(mainWindow?"mainWindow = OK":"mainWindow = Error");
    info(dc?"dc = OK":"dc = Error");
    info(opengl32?"openGL = OK": "opengL = Error");
    info(glu32?"glu32 = OK": "glu32 = Error");
    info(gdi32?"gdi32 = OK": "gdi32 = Error");
    info(opengl32_wglCreateContext?"opengl32_wglCreateContext = OK":"opengl32_wglCreateContext = ERROR");
    info(opengl32_wglMakeCurrent?"opengl32_wglMakeCurrent = OK": "opengl32_wglMakeCurrent = ERROR");
    info(opengl32_glEnable?"opengl32_glEnable = OK": "opengl32_glEnable = ERROR");
    info(gdi32_ChoosePixelFormat?"gdi32_ChoosePixelFormat = OK":"gdi32_ChoosePixelFormat = OK");
    info(gdi32_SetPixelFormat?"gdi32_SetPixelFormat = OK":"gdi32_SetPixelFormat = ERROR");
    info(opengl32_glMatrixMode?"opengl32_glMatrixMode = OK":"opengl32_glMatrixMode = ERROR");
    info(glu32_gluPerspective?"glu32_gluPerspective = OK":"glu32_gluPerspective = ERROR");
    // устанавливаем формат пиксела
    WinAPI::releaseDC(mainWindow, dc);
}
нужно создать еще классы для объектов библиотеки, но пока нехватает времени....

Последний раз редактировалось Eldar9x; 22.11.2006 в 13:08.
За это сообщение автора поблагодарили: PavelX (1).
Теги
opengl, axapta

 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Как получить имена полей, которые есть у таблицы? 3oppo DAX: Программирование 2 22.12.2006 14:30
ALEG: Software-as-a-service есть ли у них будущее в России Blog bot DAX Blogs 0 28.10.2006 16:10
Fullscope - Процессное производство для Axapta есть. mazzy DAX: Функционал 33 28.08.2006 13:22
Есть ли возможность вызывать код с вышележащих слоев ? FishLog DAX: Программирование 5 07.09.2004 17:24
Что есть для Inernet-а ? bucken DAX: Функционал 6 29.10.2003 12:31
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 11:33.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.