News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

NeHe Tutorial in masm64

Started by Mikl__, August 06, 2020, 12:55:45 PM

Previous topic - Next topic

TouEnMasm

soluce write the readfile correctly:
Quote
BOOL ReadFile(
  HANDLE       hFile,
  LPVOID       lpBuffer,
  DWORD        nNumberOfBytesToRead,
  LPDWORD      lpNumberOfBytesRead,
  LPOVERLAPPED lpOverlapped
);
in 64,there only one dword,nNumberOfBytesToRead others are qword
tut45 part of code
   mov   [rsp+20h],rbx
   lea   r9d,szReadWrite
        invoke   ReadFile,hFile,eax,FSize   ;<<<<<<<<<<<<<<<<<<<<<<<<< eax wrong ,not a qword adress

This error don't append with UASM or JWASM >>> compile error "incorrect size"


looking upper:

   push   rsi
   push   rsi
   sub   esp,20h                 ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> perhaps RSP not ?


it seems there is many local dword here :

Quote
LoadHeightmap proc
local   nX:dword
local   nZ:dword
local   nTri:dword
local   nIndex:dword; Ñîçäàòü ïåðåìåííûå
local   flX:dword
local   flZ:dword
local   buff:dword
local   buff1[256]:byte
local   szReadWrite:QWORD   ;number of bytes actually read or write
local   hFile:dword            ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< at least one wrong
local   FSize:dword

   mov   ecx,offset aTerrain
   invoke   CreateFile,,GENERIC_READ,0,0,OPEN_EXISTING,\
        FILE_ATTRIBUTE_ARCHIVE,rbx
   mov   hFile,eax
        invoke   GetFileSize,eax,0
        mov   FSize,eax
   inc   eax            ; Append a 0 char
   invoke   GlobalAlloc,GMEM_ZEROINIT or GMEM_FIXED,eax
   mov   buff,eax
   mov   [rsp+20h],rbx
   lea   r9d,szReadWrite
        invoke   ReadFile,hFile,eax,FSize

..............................





Fa is a musical note to play with CL

Mikl__

Programs run under Win7 and Win10
to be Continued. . .

Mikl__


six_L

Hi,Mikl__
the tut_40-12.exe works failed, others is ok.
;-------------------------------------------------------
        mov ecx,offset FileName2 ;<==
        xor r8d,r8d
mov [rsp+30h],r8
invoke CreateFile,,GENERIC_READ,,0,OPEN_EXISTING,FILE_FLAG_SEQUENTIAL_SCAN
        mov esi,eax         ;<==
        invoke GetFileSize,eax,0
        mov FSize,eax
inc eax ; Append a 0 char
invoke GlobalAlloc,GMEM_ZEROINIT or GMEM_FIXED,eax
mov texture,eax        ;<==
        mov edi,eax
lea r9d,szReadWrite
        and qword ptr [rsp+20h],0
        invoke ReadFile,esi,eax,FSize
        invoke CloseHandle,esi         ;<==
mov esi,edi
        add esi,[rdi + BITMAPFILEHEADER.bfOffBits]
lea edi,[rdi + sizeof BITMAPFILEHEADER]
mov eax,[rdi + BITMAPINFOHEADER.biWidth]
        mov w,eax
        movzx eax, word ptr [rdi + BITMAPINFOHEADER.biHeight]
        mov h,eax
;--------------------------------------------------------------
mov edx,offset Texture1_Id               ;<==
invoke glGenTextures,1

HANDLE, ADDRESS should be QWORD.
Say you, Say me, Say the codes together for ever.

Mikl__


six_L

Hi,Mikl__
Now, the tut_40-12.exe works ok. :thumbsup:
Say you, Say me, Say the codes together for ever.

TouEnMasm


All was good (except one) until this time.
:skrewy: Courage
Fa is a musical note to play with CL

LiaoMi

NeHe OpenGL Tutorials.pdf - http://bandido.ch/programming/Opengl_Tutorial.pdf

Mikl__

#98
Lesson #44: 3D-Lens Flare With Occlusion Testing

Learn how to do lens flares by extending a glCamera class. If you look at a lens flare you will notice that they all share one thing in common. They all seem to move through the center of the screen. With this in mind you could actually just throw out the z coordinate and make your flares all 2D. The only problem with this approach is without a z coordinate how do you find out if the camera is looking at the light source or not? In this tutorial we will be making 3D lens flares so get ready for a little bit of math.

https://nehe.gamedev.net/tutorial/3d_lens_flare_with_occlusion_testing/16007/

Interaction:
  • 'W', 'S', 'A' and 'D' keys ― to change the direction the camera is pointed in
  • '1'/'2' keys ― toggle information on/off
  • 'Z' key ― gives the camera a constant forward velocity
  • 'C' key ― gives the camera a constant backward velocity
  • 'X' key ― stop the camera from moving at all
There are asm-\bmp-\exe-files and cursor in the 44.zip attachment.

Mikl__


Mikl__


Mikl__


Mikl__


Mikl__


Mikl__

to be Continued. . .

P.S. File movie0.avi for Lesson #35 is here