void TechniqueToon::InitTextures() { Image<ColorRGB> TmpImage; //Load the color scheme #1 image and send it to the GPU as a texture. LoadBmp("Resources/ToonScheme1.bmp",TmpImage); mLookups[0] = LoadTexture(TmpImage); //Load the color scheme #2 image and send it to the GPU as a texture. LoadBmp("Resources/ToonScheme2.bmp",TmpImage); mLookups[1] = LoadTexture(TmpImage); //Load the color scheme #3 image and send it to the GPU as a texture. LoadBmp("Resources/ToonScheme3.bmp",TmpImage); mLookups[2] = LoadTexture(TmpImage); }
void main() // pics() { int gd = 9, gm = 2; initgraph(&gd, &gm, "g:\\tc1\\bgi"); cleardevice(); setfillstyle(1,15); bar(0,0,getmaxx(),getmaxy()); LoadBmp(10,10,"g:\\asd.bmp");getch(); cleardevice(); setfillstyle(1,15); /* bar(0,0,getmaxx(),getmaxy()); LoadBmp(0,0,"H:\\PROJECT\\PICS\\KITCHEN.bmp");delay(1000); cleardevice(); setfillstyle(1,15); bar(0,0,getmaxx(),getmaxy()); LoadBmp(0,0,"H:\\PROJECT\\PICS\\TOILETS.bmp");delay(1000); cleardevice(); setfillstyle(1,15); bar(0,0,getmaxx(),getmaxy()); LoadBmp(200,100,"H:\\PROJECT\\PICS\\STUDY.bmp");delay(1000); cleardevice(); setfillstyle(1,15); bar(0,0,getmaxx(),getmaxy()); LoadBmp(200,100,"H:\\PROJECT\\PICS\\STAIRCASE.bmp");delay(1000); getch();*/ closegraph(); }
void Sprite::LoadSprite( Sprite* sprite,const char* file_name, unsigned int width,unsigned int height,D3DCOLOR key) { sprite->surface = (D3DCOLOR*)malloc( sizeof( D3DCOLOR ) * width * height ); LoadBmp( file_name,sprite->surface ); sprite->height = height; sprite->width = width; sprite->key = key; }
void AddBGRT(){ EFI_STATUS status; ACPI_BGRT *bgrt; EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; EFI_PHYSICAL_ADDRESS BmpAddress; UINT32 BmpSize; const char data[0x38] = "BGRT" "\x38\x00\x00\x00" "\x00" "\xd6" "INTEL " " EDK2" "\x20\x17\x00\x00" "PTL " "\x02\x00\x00\x00" "\x01\x00" "\x00" "\x00"; BmpAddress = 0; DEBUG ((EFI_D_INFO, "HackBGRT Start\n")); status = gBS->HandleProtocol ( gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, (VOID**)&GraphicsOutput ); // Replace missing = allocate new. gBS->AllocatePool(EfiACPIReclaimMemory, sizeof(*bgrt), (void**)&bgrt); if (!bgrt) { DEBUG ((EFI_D_INFO, "HackBGRT MEM ERR\n")); return; } DEBUG ((EFI_D_INFO, "HackBGRT Load Bmp\n")); status = LoadBmp(&BmpAddress, &BmpSize); if (EFI_ERROR(status)){ DEBUG ((EFI_D_INFO, "HackBGRT BMP Load ERR\n")); return; } DEBUG ((EFI_D_INFO, "HackBGRT Set Table; BMP Size: %d\n", BmpSize)); // Clear the BGRT. CopyMem(bgrt, data, sizeof(data)); if (GraphicsOutput != NULL && GraphicsOutput->Mode != NULL && GraphicsOutput->Mode->Info != NULL) { bgrt->image_address = (UINTN)BmpAddress; bgrt->image_offset_x = (GraphicsOutput->Mode->Info->HorizontalResolution - 200)/2; bgrt->image_offset_y = (GraphicsOutput->Mode->Info->VerticalResolution * 2/3 - 161)/2; DEBUG ((EFI_D_INFO, "HackBGRT Set checksum\n")); SetAcpiSdtChecksum(bgrt); DEBUG ((EFI_D_INFO, "HackBGRT Add Table\n")); HandleAcpiTables(bgrt); } else { DEBUG ((EFI_D_INFO, "HackBGRT no display connected, skip adding table\n")); } }
void LoadTextures() { Image *image = (Image*)malloc(sizeof(Image)); if ((LoadBmp("Data/block.bmp", image)) != 1) { printf("Error on loading textures!\n"); exit(1); } glGenTextures((GLsizei)1, &texture[0]); glBindTexture(GL_TEXTURE_2D, texture[0]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, 3, image->sizeX, image->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, image->data); }
void Graphic::Messages() { while( logistics.MessageCount( "graphic" ) ) { Logistic::Message message( logistics.GetMessage( "graphic" ) ); if( message.info == "load" ) { std::string r = message.ReceiveMessage< std::string >(); if( r.find( ".bmp" ) != std::string::npos ) { textures.push_back( LoadBmp( r ) ); } else if ( r.find( ".obj" ) != std::string::npos ) { models.push_back( LoadObj( r ) ); } else { throw std::string( "Cannot load file format!" ); } } else // Must call ReceiveMessage for memory to be deleted throw std::string( "Must receive message!" ); } }
void demo_init_gui(void) { init_font(); root1 = gui_create_control(GUI_CTRL_FORM, 6, 6, 1012, 756, 3, 0, 0, FORM_STYLE_XP_BORDER); if(!root1)return; gui_form_init_private(root1, 32); gui_form_set_caption(root1, "Root1"); root2 = gui_create_control(GUI_CTRL_FORM, 400, 360, 560, 345, 8, 64, 0, 0); if(!root2)return; gui_form_init_private(root2, 32); gui_form_set_caption(root2, "Root2"); form1 = gui_create_control(GUI_CTRL_FORM, 180, 50, 320, 82, 5, 0, 0, FORM_STYLE_XP_BORDER); if(!form1)return; gui_form_init_private(form1, 32); gui_form_set_caption(form1, "Form1"); label1 = gui_create_control(GUI_CTRL_LABEL, 50, 50, 100, 32, 4, 0, 0, LABEL_STYLE_BORDER); if(!label1)return; gui_label_init_private(label1, 32); gui_label_set_text(label1, "标签"); edit1 = gui_create_control(GUI_CTRL_EDIT, 50, 100, 100, 32, 9, 0, 0, 0); gui_edit_init_private(edit1, 32); gui_edit_set_text(edit1, "this is a edit!"); if(!edit1)return; button1 = gui_create_control(GUI_CTRL_BUTTON, 3, 3, 314, 32, 9, 0, 0, 0); if(!button1)return; progress1 = gui_create_control(GUI_CTRL_PROGRESS, 50, 150, 420, 32, 1, 0, 0, 0); if(!progress1)return; gui_set_control_associated(progress1, &assoc1, 0); gui_progress_init_private(progress1); my_control = gui_create_control(my_ctrl_id, 0, 0, 0, 0, 0, 0, 0, 0); if(!my_control)return; about_system_root = gui_create_control(GUI_CTRL_FORM, 6, 6, 1012, 756, 3, 0, 0, FORM_STYLE_XP_BORDER); if(!about_system_root)return; gui_form_init_private(about_system_root, 32); gui_form_set_caption(about_system_root, "about_system_root"); sys_monitor = gui_create_control(GUI_CTRL_SYS_MNTR, 16, 16, 1, 1, 0, 0, 0, SYS_MNTR_STYLE_STATIC_BDR|SYS_MNTR_STYLE_NO_BORDER); if(!sys_monitor)return; gui_sys_mntr_init_private(sys_monitor); pic1 = gui_create_control(GUI_CTRL_PICTURE, 50, 200, 150, 100, 0, 0, 0, 0); gui_picture_init_private(pic1); if(1){ InitBMPINFO(&info[0]); LoadBmp(&info[0], "demo.bmp"); InitBMPINFO(&info[1]); LoadBmp(&info[1], "demo1.bmp"); InitBMPINFO(&info[2]); LoadBmp(&info[2], "demo2.bmp"); InitBMPINFO(&info[3]); LoadBmp(&info[3], "demo3.bmp"); InitBMPINFO(&info[4]); LoadBmp(&info[4], "demo4.bmp"); InitBMPINFO(&info[5]); LoadBmp(&info[5], "demo5.bmp"); gui_picture_set_picture(pic1, &info); } gui_control_link(NULL, root1); gui_control_link(NULL, root2); gui_control_link(about_system_root, sys_monitor); gui_control_link(root2, form1); gui_control_link(root2, my_control); gui_control_link(root2, label1); gui_control_link(root2, edit1); gui_control_link(form1, button1); gui_control_link(root2, progress1); gui_control_link(root2, pic1); RegisterKeyHook(gui_keyhook); init_welcome_screen(); StartGUI(); return; }
//extern HMODULE g_hModule; BOOL KDrawFrame::Init(int nValue /*= 0*/) { TCHAR tszPath[MAX_PATH*2] = {0}; GetModuleFileName( (HINSTANCE)&__ImageBase, tszPath, MAX_PATH * 2 ); CPath path( tszPath ); path.RemoveFileSpec(); path.Append( TEXT("webui/splock/images/") ); m_nStatus = nValue; if (-1 == m_nStatus) { LoadBmp(m_bmpLeftTop, ATL::CString(path+TEXT("red_top_left.bmp"))); LoadBmp(m_bmpLeftBoder, ATL::CString(path+TEXT("red_left.bmp"))); LoadBmp(m_bmpLeftBotton, ATL::CString(path+TEXT("red_bottom_left.bmp"))); LoadBmp(m_bmpRightTop, ATL::CString(path+TEXT("red_top_right.bmp"))); LoadBmp(m_bmpRightBoder, ATL::CString(path+TEXT("red_right.bmp"))); LoadBmp(m_bmpRightBotton, ATL::CString(path+TEXT("red_bottom_right.bmp"))); LoadBmp(m_bmpTopBoder, ATL::CString(path+TEXT("red_top_middle.bmp"))); LoadBmp(m_bmpBottonBoder, ATL::CString(path+TEXT("red_bottom_middle.bmp"))); } else { LoadBmp(m_bmpLeftTop, ATL::CString(path+TEXT("xzbh_top_left.bmp"))); LoadBmp(m_bmpLeftBoder, ATL::CString(path+TEXT("xzbh_left.bmp"))); LoadBmp(m_bmpLeftBotton, ATL::CString(path+TEXT("xzbh_bottom_left.bmp"))); LoadBmp(m_bmpRightTop, ATL::CString(path+TEXT("xzbh_top_right.bmp"))); LoadBmp(m_bmpRightBoder, ATL::CString(path+TEXT("xzbh_right.bmp"))); LoadBmp(m_bmpRightBotton, ATL::CString(path+TEXT("xzbh_bottom_right.bmp"))); LoadBmp(m_bmpTopBoder, ATL::CString(path+TEXT("xzbh_top_middle.bmp"))); LoadBmp(m_bmpBottonBoder, ATL::CString(path+TEXT("xzbh_bottom_middle.bmp"))); } return TRUE; }
void demo_init_gui(void) { InitBMPINFO(&icon); LoadBmp(&icon, "icon.bmp"); load_fonts(); gui_desktop_enable(); gui_desktop_set_color(CLRSCR_COLOR2); form = gui_create_widget(GUI_WIDGET_FORM, 180, 120, 632, 500, 0, 0, 0, FORM_STYLE_XP_BORDER|FORM_STYLE_TITLE); if(!form) goto err; gui_form_init_private(form, 128); gui_form_set_caption(form, "控件演示"); gui_form_set_icon(form, &icon); edit = gui_create_widget(GUI_WIDGET_EDIT, 80, 270, 460, 48, color, bkcolor, 0, style); if(!edit) goto err; gui_edit_init_private(edit, 128); gui_edit_set_text(edit, "这是一个文本框"); button = gui_create_widget(GUI_WIDGET_BUTTON, 235+156, 142+100, 236, 32, COLOR_YELLOW, 64, font16, 0); /*BUTTON_STYLE_CLIENT_BDR*/ if(!edit) goto err; gui_button_init_private(button, 128); gui_button_set_caption(button, "将那个Label盖住"); test = gui_create_widget(GUI_WIDGET_EDIT, 80, 330, 460, 32, 0, 0, 0, 0); if(!test) goto err; gui_edit_init_private(test, 128); gui_edit_set_text(test, ""); label = gui_create_widget(GUI_WIDGET_LABEL, 80, 380, 460, 64, COLOR_WHITE, 66, font48, LABEL_STYLE_SUBSIDE); if(!edit) goto err; gui_label_init_private(label, 128); gui_label_set_text(label, "Startting..."); view = gui_create_widget(GUI_WIDGET_VIEW, 80, 48, 460, 200, 0, 0, 0, VIEW_STYLE_NONE_FIRST|VIEW_STYLE_FIELDS_TITLE|VIEW_STYLE_STATISTIC_BAR); if(!view) goto err; init_view(view); progress1 = gui_create_widget(GUI_WIDGET_PROGRESS, 80, 251, 460, 14, 0, 0, 0, PROGRESS_STYLE_BORDER); if(!progress1) goto err; gui_progress_init_private(progress1, 100); dialog = input_dialog_initialize(&abcde); if(!dialog) goto err; gui_widget_link(NULL, form); gui_widget_link(form, view); gui_widget_link(form, edit); gui_widget_link(form, label); gui_widget_link(form, progress1); gui_widget_link(form, test); gui_widget_link(NULL, dialog); gui_widget_link(NULL, button); window1 = gui_create_window(form); gui_show_window(window1); window2 = gui_create_window(dialog); gui_show_window(window2); window3 = gui_create_window(button); gui_show_window(window3); gui_form_set_caption(form, os_get_description()); StartGUI(); err: return; }
void demo_init_gui(void) { demo_init_font(); my_ctrl_id=gui_register_usr_ctrl(&my_control_type); sys_monitor_id = gui_register_usr_ctrl(&sys_monitor_type); root1 = gui_create_control(GUI_CTRL_FORM, 60, 100, 800, 500, 3, 0, 0, 0); if(!root1)return; root2 = gui_create_control(GUI_CTRL_FORM, 100, 200, 800, 368, 5, 0, 0, 0); if(!root2)return; form1 = gui_create_control(GUI_CTRL_FORM, 180, 50, 320, 82, 5, 0, 0, FORM_STYLE_XP_BORDER); if(!form1)return; label1 = gui_create_control(GUI_CTRL_LABEL, 50, 50, 100, 32, 7, 0, 0, LABEL_STYLE_BORDER); if(!label1)return; gui_label_init_private(label1, 32); gui_label_set_text(label1, "this is a label!"); edit1 = gui_create_control(GUI_CTRL_EDIT, 50, 100, 100, 32, 9, 0, 0, 0); gui_edit_init_private(edit1, 32); gui_edit_set_text(edit1, "this is a edit!"); if(!edit1)return; button1 = gui_create_control(GUI_CTRL_BUTTON, 3, 3, 314, 32, 9, 0, 0, 0); if(!button1)return; progress1 = gui_create_control(GUI_CTRL_PROGRESS, 50, 150, 700, 32, 0, 0, 0, 0); if(!progress1)return; gui_set_control_associated(progress1, &assoc1, 0); gui_progress_init_private(progress1); my_control = gui_create_control(my_ctrl_id, 0, 0, 0, 0, 0, 0, 0, 0); if(!my_control)return; sys_monitor = gui_create_control(sys_monitor_id, 30, 6, 10, 10, 0, 0, 0, 0); if(!sys_monitor)return; pic1 = gui_create_control(GUI_CTRL_PICTURE, 50, 200, 150, 100, 0, 0, 0, 0); gui_picture_init_private(pic1); if(1){ InitBMPINFO(&info[0]); LoadBmp(&info[0], "demo.bmp"); InitBMPINFO(&info[1]); LoadBmp(&info[1], "demo1.bmp"); InitBMPINFO(&info[2]); LoadBmp(&info[2], "demo2.bmp"); InitBMPINFO(&info[3]); LoadBmp(&info[3], "demo3.bmp"); InitBMPINFO(&info[4]); LoadBmp(&info[4], "demo4.bmp"); InitBMPINFO(&info[5]); LoadBmp(&info[5], "demo5.bmp"); gui_picture_set_picture(pic1, &info); } gui_control_link(NULL, root1); gui_control_link(NULL, root2); gui_control_link(root1, sys_monitor); gui_control_link(root2, form1); gui_control_link(root2, my_control); gui_control_link(root2, label1); gui_control_link(root2, edit1); gui_control_link(form1, button1); gui_control_link(root2, progress1); gui_control_link(root2, pic1); RegisterKeyHook(gui_keyhook); #if 0 printf("root1-1: %d, %d, %d, %d, %d\n", root1->rect.x, root1->rect.y, root1->rect.width, root1->rect.height, root1->color); printf("root1-2: %d, %d, %d, %d, %d\n", root1->real_rect.x, root1->real_rect.y, root1->real_rect.width, root1->real_rect.height, root1->color); printf("root2-1: %d, %d, %d, %d, %d\n", root2->rect.x, root2->rect.y, root2->rect.width, root2->rect.height, root2->color); printf("root2-2: %d, %d, %d, %d, %d\n", root2->real_rect.x, root2->real_rect.y, root2->real_rect.width, root2->real_rect.height, root2->color); printf("label1-1: %d, %d, %d, %d, %d\n", label1->rect.x, label1->rect.y, label1->rect.width, label1->rect.height, label1->color); printf("label1-2: %d, %d, %d, %d, %d\n", label1->real_rect.x, label1->real_rect.y, label1->real_rect.width, label1->real_rect.height, label1->color); getch(); #endif StartGUI(); gui_set_root_control(root1); return; }
void Object::Load(){ if (!isStatic){ btTransform trans; trans.setFromOpenGLMatrix(glm::value_ptr(position)); btDefaultMotionState* motState = new btDefaultMotionState(trans); btScalar mass = 1; btVector3 fallInertia(0, 0, 0); shape->calculateLocalInertia(mass, fallInertia); btRigidBody::btRigidBodyConstructionInfo fallRigidBodyCI(mass, motState, shape, fallInertia); rigidBody = new btRigidBody(fallRigidBodyCI); rigidBody->setFriction(1.35f); if (isGhost){ rigidBody->setCollisionFlags(rigidBody->getCollisionFlags() | rigidBody->CF_NO_CONTACT_RESPONSE); } world->addRigidBody(rigidBody); } else{ btTransform trans; trans.setFromOpenGLMatrix(glm::value_ptr(position)); btDefaultMotionState* motState = new btDefaultMotionState(trans); btRigidBody::btRigidBodyConstructionInfo groundRigidBodyCI(0, motState, shape, btVector3(0, 0, 0)); rigidBody = new btRigidBody(groundRigidBodyCI); rigidBody->setFriction(1.35f); if (isGhost){ rigidBody->setCollisionFlags(rigidBody->getCollisionFlags() | rigidBody->CF_NO_CONTACT_RESPONSE); } world->addRigidBody(rigidBody); } shader = LoadShaders(vertexName, "geometry-shader[basic].txt", fragmentName); cameraUniform = shader->uniform("camera"); posNormUniform = shader->uniform("normalPos"); texUniform = shader->uniform("tex"); disUniform = shader->uniform("dis"); normUniform = shader->uniform("norm"); posUniform = shader->uniform("position"); normal = LoadTexture(LoadBmp(normalName)); texture = LoadTexture(LoadBmp(textureName)); displacement = LoadTexture(LoadBmp(displacementName)); glGenVertexArrays(1, &vao); glBindVertexArray(vao); glGenBuffers(1, &vbo); glBindBuffer(GL_ARRAY_BUFFER, vbo); glBufferData(GL_ARRAY_BUFFER, sizeof(Vertex)*vertices.size(), &vertices.front(), GL_STATIC_DRAW); glEnableVertexAttribArray(shader->attrib("vert_VS_in")); glVertexAttribPointer(shader->attrib("vert_VS_in"), 3, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat), NULL); glEnableVertexAttribArray(shader->attrib("frag_VS_in")); glVertexAttribPointer(shader->attrib("frag_VS_in"), 2, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat), (const GLvoid*)(3 * sizeof(GLfloat))); glEnableVertexAttribArray(shader->attrib("normal_VS_in")); glVertexAttribPointer(shader->attrib("normal_VS_in"), 3, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat), (const GLvoid*)(5 * sizeof(GLfloat))); glGenBuffers(1, &ibo); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo); glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(Index)*indices.size(), &indices.front(), GL_STATIC_DRAW); glBindVertexArray(0); }