hi


doesnt work
what my problem??


LoadUnCompressedTGA proc,lpTtexture,hFhandle
LOCAL SizeReadWrite:DWORD
LOCAL cswap:GLuint

ASSUME edi:ptr Texture
mov edi,lpTtexture

invoke SetFilePointer,hFhandle,12, NULL, FILE_BEGIN


invoke ReadFile,hFhandle,ADDR tga.header,sizeof tga.header,ADDR SizeReadWrite,NULL


movzx ecx,word ptr
movzx eax,word ptr

; movzx ecx,byte ptr
; movzx eax,byte ptr
; shl eax,8
; add eax,ecx
mov .width1,eax

; movzx ecx,byte ptr
; movzx eax,byte ptr
; shl eax,8
; add eax,ecx

mov .height,ecx


movzx eax,byte ptr
mov .bpp, eax

mov eax,.width1
mov tga.Width1,eax

mov eax,.height
mov tga.Height,eax

mov eax,.bpp
mov tga.Bpp,eax

mov eax,.width1
test eax,eax
jz error

mov eax,.height
test eax,eax
jz error



.if .bpp == 24
mov edx,GL_RGB
mov .type1,edx
.elseif .bpp == 32
mov edx,GL_RGBA
mov .type1,edx
.else
jmp error
.endif



mov eax,tga.Bpp
shr eax,3
mov tga.bytesPerPixel,eax

imul eax,tga.Width1
imul eax,tga.Height
mov tga.imageSize,eax


push eax
invoke GetProcessHeap
pop ebx


invoke HeapAlloc,eax, NULL,ebx

.if eax == 0
jmp error
.endif


mov .imageData,eax



invoke ReadFile,hFhandle,Ttexture.imageData,tga.imageSize,ADDR SizeReadWrite,NULL

xor ecx,ecx
mov esi,.imageData

loop@:
movzx edx,byte ptr
movzx eax,byte ptr
xor eax,edx
xor edx,eax
xor eax,edx
mov ,dl
mov ,al
add ecx,3

.if ecx == tga.imageSize
jmp okswap
.endif
jmp loop@


okswap:

invoke CloseHandle,hFhandle

ret



error:
invoke CloseHandle,hFhandle
xor eax,eax
ret

LoadUnCompressedTGA endp








LoadGLTexture PROC

LOCAL hFile:DWORD
LOCAL SizeReadWrite:DWORD
LOCAL cswap:GLuint

invoke CreateFile,ADDR TgaName1,\

GENERIC_READ or GENERIC_WRITE ,\
FILE_SHARE_READ or FILE_SHARE_WRITE,\
NULL,OPEN_EXISTING,FILE_ATTRIBUTE_ARCHIVE,\
NULL
mov hFile,eax


invoke ReadFile,hFile,ADDR tgatestbuff,12,ADDR SizeReadWrite,NULL




cld
lea esi,uTGAcompare
lea edi,tgatestbuff
mov ecx,12
repz cmpsb
jz uncompress


jmp okload


cld
lea esi,cTGAcompare
lea edi,tgatestbuff
mov ecx,12
repz cmpsb
jnz error


; invoke LoadCompressedTGA,ADDR Ttexture,hFile
jmp error



uncompress:


invoke LoadUnCompressedTGA,ADDR Ttexture,hFile



invoke glGenTextures, 1, ADDR Ttexture.texID

invoke glBindTexture,0de1h,Ttexture.texID



invoke glTexParameteri,GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR
invoke glTexParameteri,GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR

invoke glTexImage2D, GL_TEXTURE_2D, 0, 1907h,tga.Width1,tga.Height,\
0,1907h, GL_UNSIGNED_BYTE,Ttexture.imageData



okload:

mov eax,1
ret

error:
invoke CloseHandle,hFile
xor eax,eax
ret
LoadGLTexture ENDP



DrawGLScene proc


invoke glClear, GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
invoke glLoadIdentity
_glTranslatef 0, 0, -5.0f



invoke glBindTexture, GL_TEXTURE_2D,1

invoke glBegin,7

push ecx
fldz
push ecx
fstp real8 ptr
push ecx
push ecx
fldz
fstp real8 ptr
call glTexCoord2d





push ecx
fldz
push ecx
fstp real8 ptr
push ecx
push ecx
fldz
fstp real8 ptr
call glVertex2d





push ecx
push ecx
fldz
fstp real8 ptr
push ecx
push ecx
fld1
fstp real8 ptr
call glTexCoord2d




push ecx
push ecx
fldz
fstp real8 ptr
fld real8 ptr
push ecx
push ecx
fstp real8 ptr
call glVertex2d




push ecx
push ecx
fld1
fstp real8 ptr
push ecx
push ecx
fld1;
fstp real8 ptr
call glTexCoord2d





fld real8 ptr
push ecx
push ecx
fstp real8 ptr
fld real8 ptr
push ecx
push ecx
fstp real8 ptr ;
call glVertex2d




push ecx
push ecx
fld1
fstp real8 ptr
push ecx
push ecx
fldz
fstp real8 ptr
call glTexCoord2d

fld real8 ptr
push ecx
push ecx
fstp real8 ptr
push ecx
push ecx
fldz
fstp real8 ptr
call glVertex2d


invoke glEnd


mov eax, 1
ret
DrawGLScene endp

END start
:confused:
Posted on 2004-02-07 00:13:35 by playh
Ehhh, right.
"Please fix this" *large unreadable source with no description at all*
Posted on 2004-02-07 05:23:48 by Henk-Jan
Enable texturing winth glEnable (GL_TEXTURE_2D).

Toni
Posted on 2004-02-07 17:01:27 by minimoog