Invoke glTexParameteri,GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR // Linear Filtered Invoke glTexParameteri,GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR // Linear Filtered Invoke glBindTexture,GL_TEXTURE_2D,TextureID Invoke MessageBox,0,TEXT_("Can't load Texture file"),TEXT_("Siekmanski antwoordt."),MB_ICONSTOPĭrawQuad2D proc Xpos:REAL4,Ypos:REAL4,QuadWidth:REAL4,QuadHeight:REAL4,QuadDepth:REAL4,TextureID:DWORD Invoke glTexImage2D,GL_TEXTURE_2D,0,InternalFormat,IP_Width,IP_Height,0,Format,GL_UNSIGNED_BYTE,Texture_Data Invoke glTexParameteri,GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST Invoke glTexParameteri,GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST Invoke glTexParameteri,GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT Invoke glTexParameteri,GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT Invoke glBindTexture,GL_TEXTURE_2D,TextureTemp Invoke Load_Bitmap,TextureName,addr Bitmap,TRUE Load_Texture proc TextureName:DWORD,TextureID:DWORD,InternalFormat:DWORD,Format:DWORD,ColorKey:DWORD Invoke CreateDIBSection,hdcTemp,addr binfo,DIB_RGB_COLORS,addr IP_Data,NULL,0Ĭoinvoke pPicture,IPicture,Render,hdcTemp,0,0,IP_Width,IP_Height,0,IPicHeight,IPicWidth,eax,0 we do a "CreateDIBSection" so we have access to the pixel-data and change whatever we want. Invoke RtlZeroMemory,addr binfo.bmiHeader,sizeof BITMAPINFOHEADER Invoke MulDiv,IPicHeight,eax,HIMETRIC_INCH Invoke MulDiv,IPicWidth,eax,HIMETRIC_INCH Invoke OleLoadPicture,pStream,NULL,TRUE,GUID_ADDR(IID_IPicture),addr pPictureĬoinvoke pPicture,IPicture,get_Width,addr IPicWidthĬoinvoke pPicture,IPicture,get_Height,addr IPicHeight Invoke CreateStreamOnHGlobal,PictureBuffer,TRUE,addr pStream Jz Find_Picture No picture in the resource, so look somewhere else Invoke FindResource,NULL,PictureName,TEXT_("PICTURE") Load_Bitmap proc uses esi edi PictureName:DWORD,BitmapID:DWORD,PowerOf2:DWORD Shl eax,cl -> New Pic Width or Height (Powerof2) Jae Max_TextureSize Not bigger than Max of gfxcard Invoke ReadFile,hFile,pPTR,dwLength,addr dwReadbytes,NULL Invoke CreateFile,Filename,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL LOCAL hFile,dwLength,dwReadbytes,pPTR:DWORD &CastName&_put_KeepOriginalFormat comethod2 ? &CastName&_get_KeepOriginalFormat comethod2 ? ĮXITM %((blauw shl 16) or (groen shl 8) or (rood))ĮXITM %((alpha shl 24) or (blauw shl 16) or (groen shl 8) or (rood)) Code: - * Siekmanski (c) 2005 - laad jpg, bmp, gif, ico etc. Here is an example how to load BMP JPEG GIF EMF WMF ICO pictures in memory and create textures in opengl. So is there anyone who could explain me or show me an example on how to use this color table for the glTexImage2D function ? this function is the important one for this questionĪlso in the glTexImage2D proc the GL_BGR_EXT param should be changed to GL_COLOR_INDEX. Invoke glBindTexture,GL_TEXTURE_2D,addr texture these functions don't really matter for this question LOCAL TextureImage:DWORD is a pointer to a texture image Invoke MapViewOfFile,eax,FILE_MAP_READ,0,0,0 Invoke CreateFileMapping,fhandle,0,PAGE_READONLY,0,0,0 Jnz CreateFile,Filename,GENERIC_READ,0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0 Code: -LoadBMP proc Filename:DWORD Filename is a pointer to the file name. In my program I open up the file as follows: glPixelTasferf and glPixelMapfv ((v=vs.85).aspx and (v=vs.85).aspx). Now I have been trying to use this in my program and I found 2 functions that should be useful but I don't really understand how to use the parameters. In this specific file each index xy (x and y are from 0 to F so together they're 1 byte) becomes a color xy,xy,xy. I've been reading on wikipedia about the bmp file format (). The first bitmaps I used had the standard BGR format but now I have a. I am currently working with bitmap files (.BMP) to be used in an OpenGL program.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |