DevIL_manual (1265195), страница 5

Файл №1265195 DevIL_manual (Задания) 5 страницаDevIL_manual (1265195) страница 52021-08-18СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 5)

If the image already hasmipmaps, the previous mipmaps are erased, and new mipmaps are generated. Otherwise,iluBuildMipmaps generates mipmaps for the image.The mipmaps built are always powers of 2. If the original image does not have power-of-2dimensions, iluBuildMipmaps resizes the original image via iluScale to have power-of-2dimensions.9.1.2 Mipmap AccessAccess mipmaps through the iluActiveMipmap function:ILboolean ilActiveMipmap(ILuint MipNum);iluActiveMipmap sets the current image to the MipNum mipmap level of the currentimage. If there are no mipmaps present, then iluActiveMipmap returns IL_FALSE, else itreturns IL_TRUE. The base image is mipmap level 0, so specify 0 for MipNum to return tothe base image.

The only other method for setting the current image to the base image isto call ilBindImage again.9.2 AnimationsAnimations are similar to mipmaps, but instead of being smaller successive images, theimages are the same size but have different data.

The successive animation chains in DevILcan be used to create animations in your programs. File formats that natively supportanimations are .gif and .mng. You can also create your own sub-images as animations.9.2.1 Animation Chain CreationTo be added...9.2.2 Animation Chain AccessAccess animations through the iluActiveImage function:ILboolean ilActiveImage(ILuint ImageNum);Chapter 9: Sub-Images20iluActiveImage sets the current image to the ImageNum animation frame of the currentimage. If there are no animation frames present, then iluActiveImage returns IL_FALSE,else it returns IL_TRUE.

The base image is animation frame 0, so specify 0 for ImageNumto return to the base image. The only other method for setting the current image to thebase image is to call ilBindImage again.iluActiveImage is functionally equivalent to iluActiveMipmap, except that it dealswith animations and not mipmaps.9.3 LayersDevIL does not have a full layer implementation yet.9.4 Sub-Image MixingAn image can have both mipmaps and animations at the same time.

Every image inan animation chain can have its own set of mipmaps, though it is not necessary by anymeans. If you “activate” an animation image in the base image’s animation chain, theactive image becomes the new “base” image. Therefore, if you call iluActiveMipmap afteriluActiveImage, a mipmap from the selected image in the animation chain is chosen.Chapter 10: DXTC/S3TC Notes2110 DXTC/S3TC Notes10.1 DDS Loading/SavingDevIL supports loading and saving of Microsoft .dds files.

DDS files can either be compressed or uncompressed. If they are compressed, DDS files use DirectX Texture Compression (DXTC). DXTC is also known as S3TC, since Microsoft licensed the compressiontechnology from S3.10.1.1 Keeping DXTC DataWhen loading, DevIL uncompresses the DXTC. If you call ilEnable with theIL KEEP DXTC DATA parameter, DevIL will keep an uncompressed copy of the DXTCdata along with the image.

Functions that deal with DXTC data can use this data withouthaving to recompress the uncompressed data, making these functions operate faster. Theonly drawback is the use of more memory.10.1.2 Controlling SavingDevIL’s DXTC support consists of three different compression formats: DXT1, DXT3 andDXT5. DXT2 and DXT4 use premultiplied alpha, which not even OpenGL supports. DevILloads DXT2 and DXT4 textures but immediately converts them to formats that do not usepremultiplied alpha. To set what format to save DDS files in, use this line:ilSetInteger(IL_DXTC_FORMAT, Format);Format can be IL DXT1, IL DXT3 or IL DXT5.10.2 Retrieving DXTC DataTo retrieve a copy of the DXTC data, use ilGetDXTCData. To determine how large Buffershould be, first call ilGetDXTCData with the Buffer parameter as NULL.

This function willthen return the number of bytes that are required to completely store the DXTC data. Callit a second time to actually retrieve the data.ILuint ilGetDXTCData(ILvoid *Buffer, ILuint BufferSize,ILenum DXTCFormat);If the DXTC data does not exist in the format that you request, DevIL will automaticallycompress the data. If ilGetDXTCData returns 0, then the data could not be compressed.To see if a certain format of DXTC data already exists for the currently bound image, callilGetInteger with the IL_DXTC_DATA_FORMAT parameter.10.3 OpenGL/Direct3D DXTC SupportILUT allows you to directly send the DXTC data to OpenGL or Direct3D.

Several modesin ILUT directly control this behavior.10.3.1 OpenGL S3TC SupportOpenGL can use S3TC (DXTC) textures via extensions. If a computer does not supportthe S3TC texture extension, DevIL will just send the data normally through glTexImage2D,as always. Please keep in mind that DDS files store their data in a top-down format, so ifChapter 10: DXTC/S3TC Notes22you enable the OpenGL S3TC support, make certain to set the origins of all images in theupper left:ilEnable(IL_ORIGIN_SET);ilSetInteger(IL_ORIGIN_MODE, IL_ORIGIN_UPPER_LEFT);To enable the OpenGL S3TC support, use the ilutEnable function with the ILUT_GL_USE_S3TC parameter:ilutEnable(ILUT_GL_USE_S3TC);Setting this parameter means that ILUT will only use DXTC data from images that arealready compressed with DXTC (e.g.

DDS files). To force ILUT to compress any image itsends to OpenGL, use ilutEnable again:ilutEnable(ILUT_GL_GEN_S3TC);This can adversely affect your performance while loading textures, though, so use it withcaution, especially if you are running a performance-critical application.10.3.2 Direct3D DXTC SupportILUT’s Direct3D (D3D) support works exactly like the OpenGL support, except you usethe ILUT_D3D_USE_DXTC and ILUT_D3D_GEN_DXTC defines instead of ILUT_GL_USE_S3TC andILUT_GL_GEN_S3TC, respectively.Appendix A: Common DevIL #defines23Appendix A Common DevIL #definesHere goes lists of DevIL #defines used in functions that manipulate image data. As youcan see, they are self-explanatory.A.1 format-related #definesIL_COLOUR_INDEXIL_RGBIL_RGBAIL_BGRIL_BGRAIL_LUMINANCEA.2 type-related #definesIL_BYTEIL_UNSIGNED_BYTEIL_SHORTIL_UNSIGNED_SHORTIL_INTIL_UNSIGNED_INTIL_FLOATIL_DOUBLEA.3 Language-related #definesIL_ENGLISHIL_ARABICIL_DUTCHIL_GERMANIL_JAPANESEIL_SPANISHAppendix B: Common DevIL Error Codes24Appendix B Common DevIL Error CodesErrors sometimes occur within DevIL.

To get the error code of the last error that occurred,call ilGetError with no parameters. To get a human-readable string of an error code, calliluErrorString with the error code. A table of error codes follows:Error code #defineIL_NO_ERRORIL_INVALID_ENUMIL_OUT_OF_MEMORYIL_FORMAT_NOT_SUPPORTEDIL_INTERNAL_ERRORIL_INVALID_VALUEIL_ILLEGAL_OPERATIONIL_ILLEGAL_FILE_VALUEIL_INVALID_FILE_HEADERIL_INVALID_PARAMIL_COULD_NOT_OPEN_FILEIL_INVALID_EXTENSIONIL_FILE_ALREADY_EXISTSIL_OUT_FORMAT_SAMEIL_STACK_OVERFLOWIL_STACK_UNDERFLOWIL_INVALID_CONVERSIONIL_BAD_DIMENSIONSIL_FILE_READ_ERRORIL_LIB_JPEG_ERRORIL_LIB_PNG_ERRORIL_LIB_TIFF_ERRORIL_LIB_MNG_ERRORIL_LIB_JP2_ERRORIL_UNKNOWN_ERRORHexvalue0x0000x5010x5020x5030x5040x5050x5060x5070x5080x5090x50A0x50B0x50C0x50D0x50E0x50F0x5100x5110x5120x5E20x5E30x5E40x5E50x5E60x5FFDecimalvalue0128112821283128412851286128712881289129012911292129312941295129612971298150615071508150915101535Appendix C: Supported File Formats25Appendix C Supported File FormatsDevIL supports loading and saving of a large number of image formats.

Table lists theformats DevIL supports sorted according to #define.Format nameWindows bitmapC-style headerDr. Halo Cut FileZSoft Multi-PCXDirectDraw surfaceDOOM walls/flatsExtension.bmp.h.cut.dcx.dds.lmpIL #defineIL_BMPIL_CHEDIL_CUTIL_DCXIL_DDSIL_DOOM,IL_DOOM_FLATIL_GIFIL_ICOLoading?yesnoyesyesyesyesGraphics Interchange Format .gifyesRadianceHighDynamic .hdryesRangeIcons.ico, .curIL_ICOyesMacintosh Icons.icnsIL_ICNSyesJpeg Network Graphics.jngIL_JNGyesJpeg 2000.jp2IL_JP2yesJpeg.jpg, .jpe, .jpegIL_JPGyesInterlaced Bitmap.lbmIL_LBMyesHomeworld File.lifIL_LIFyesHalf-Life Model.mdlIL_MDLyesMng Animation.mngIL_MNGyesPhotoCD.pcdIL_PCDyesZSoft PCX.pcxIL_PCXyesPIC.picIL_PICyesPIX.pixIL_PIXyesPortable Network Graphics.pngIL_PNGyesPnm.pbm, .pgm, .ppm, .pnm IL_PPMyesAdobe PhotoShop.psdIL_PSDyesPaintShop Pro.pspIL_PSPyesPixar.pxrIL_PXRyesRaw data*IL_RAWyesSilicon Graphics.sgi, .bw, .rgb, .rgbaIL_SGIyesTarga.tgaIL_TGAyesTIFF.tif, .tiffIL_TIFyesQuake2 Texture.walIL_WALyesX Pixel Map.xpmIL_XPMyesException: IL_JPG (IJL) type is not supported by ilLoadF nor by ilSaveF.

IL_JPG(libjpeg) is supported by both.Saving?yesyesnonoyesnonoyesnonononoyesnononononoyesnonoyesyesyesnonoyesyesyesyesnoyesAppendix D: Sample DevIL program26Appendix D Sample DevIL programIf you are not used to this approach, you may be grateful for a short program demonstratinghow to actually use DevIL:#include<IL/il.h>#include<stdlib.h>// because of malloc() etc.int main(){ILunt handle, w, h;// First we initialize the library. Never forget that...ilInit();// We want all images to be loaded in a consistent mannerilEnable(IL_ORIGIN_SET);// In the next section, we load one imageilGenImages(1, & handle);ilBindImage(handle);ilLoadImage("our_image_file.jpg");// Let’s spy on it a little bitw = ilGetInteger(IL_IMAGE_WIDTH);// getting image widthh = ilGetInteger(IL_IMAGE_HEIGHT);// and heightprintf("Our image resolution: %dx%d\n", w, h);// how much memory will we need?int memory_needed = w * h * 3 * sizeof(unsigned char);// We multiply by 3 here because we want 3 components per pixelvoid * data = malloc(memory_needed);// finally get the image datailCopyPixels(0, 0, 0, w, h, 1, IL_RGB, IL_UNSIGNED_BYTE, data);// now we don’t need the loaded image - the data is already oursilDeleteImages(1, & handle);// We want to process the image, right?process image(data, w, h);// And maybe we want to save that all...// So we have to define a new image..ilGenImages(1, & handle);ilBindImage(handle);// and stuff it with our precious data!ilTexImage(w, h, 1, 3, IL_RGB, IL_UNSIGNED_BYTE, data);// and dump them to the disc...ilSaveImage("our_result.png");// Finally, clean the mess!ilDeleteImages(1, & handle);free(data);return 0;}IndexIndexindex entry, another .

. . . . . . . . . . . . . . . . . . . . . . . . . . . 127.

Характеристики

Тип файла
PDF-файл
Размер
664,41 Kb
Материал
Тип материала
Высшее учебное заведение

Список файлов учебной работы

Задания
DevIL
include
IL
devil_cpp_wrapper.hpp
il.h
ilu.h
ilu_region.h
ilut.h
ilut_config.h
lib
libIL.a
libIL.la
libILU.a
libILU.la
libILUT.a
libILUT.la
DevIL-master
DevIL
org.eclipse.cdt.make.core.ScannerConfigBuilder.launch
org.eclipse.cdt.make.core.makeBuilder.launch
.cvsignore
org.eclipse.wst.sse.core.prefs
org.eclipse.wst.validation.prefs
src-ILUT
include
Makefile.am
ilut_allegro.h
ilut_internal.h
ilut_opengl.h
ilut_states.h
msvc8
resources
IL Logo.ico
ILUT.rc
ILUT Unicode.rc
ILUT Unicode.vcproj
ILUT.dsp
ILUT.rc
ILUT.vcproj
ilut.def
resource.h
msvc9
resources
IL Logo.ico
ILUT.rc
main.cpp
makefile.
QuantumOperation
definitions.h
header.h
helpers.cpp
kernel.cu
main.cpp
makefile.
Свежие статьи
Популярно сейчас
Зачем заказывать выполнение своего задания, если оно уже было выполнено много много раз? Его можно просто купить или даже скачать бесплатно на СтудИзбе. Найдите нужный учебный материал у нас!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6392
Авторов
на СтудИзбе
307
Средний доход
с одного платного файла
Обучение Подробнее