example of the standard FASM, there are Opengl32.inc, Glu32.inc, Glut32.inc, asm-file, cursor and exe-file in attachemnt.
; Y-axis
; 4-th vertex violet | 3-rd vertex blue
; -0.6,0.6 | 0.6,0.6
; +--------+--------+
; | | |
; | | |
; | |0.0,0.0 |
; ----+--------+--------+-----X-axis
; | | |
; | | |
; +--------+--------+
; -0.6,-0.6 | 0.6,-0.6
; 1-st vertex red | 2-nd vertex dark
OpenGl asm blank text; GUI #
include win64a . inc
; ---------------
WINDOWWIDTH = 440
WINDOWHEIGHT = 400
. code
Winmain proc
msg local : by MSG
xor ebx , ebx
mov edi , offset szClassName
mov esi , IMAGE_BASE
mov ecx , offset FileName
invoke LoadCursorFromFile
push rax ; hIconSm
push rdi ; lpszClassName
push rbx ; lpszMenuName
push COLOR_WINDOWTEXT + 1 ; hbrBackground
push rax ; hCursor
push rax ; hIcon
push rsi ; hInstance
push rbx ; cbClsExtra & cbWndExtra
pushaddr WndProc ; lpfnWndProc
push sizeof WNDCLASSEX ; cbSize & style
invoke RegisterClassEx , esp ; addr WNDCLASSEX
push rbx
push rsi ; rsi = 400000h
shl esi , 9 ; rsi = CW_USEDEFAULT
push rbx
push rbx
push WINDOWHEIGHT
push WINDOWWIDTH
push rsi
push rsi
sub esp , 20h
invoke CreateWindowEx , 0 , edi , edi , WS_OVERLAPPEDWINDOW or WS_CLIPCHILDREN or WS_CLIPSIBLINGS or WS_VISIBLE
; message loop
lea edi , msg
@@ : invoke GetMessage , edi , 0 , 0 , 0
cmp msg . wParam , VK_ESCAPE ; user press 'Esc'?
je wmDESTROY
invoke DispatchMessage , edi
jmp @b
Winmain endp
WndProc proc hWin : QWORD , uMsg : QWORD , wParam : QWORD , lParam : QWORD
mov hWin , rcx
cmp edx , WM_CREATE
je wmCREATE
cmp edx , WM_SIZE
je wmSIZE
cmp edx , WM_PAINT
je wmPAINT
cmp edx , WM_DESTROY
je wmDESTROY
defa ult : leave
jmp NtdllDefWindowProc_
wmDESTROY :: invoke wglMakeCurrent , 0 , 0
invoke wglDeleteContext , hrc
invoke ReleaseDC , hWin , hDC
invoke RtlExitUserProcess , NULL
wmCREATE : invoke GetDC ; get the window context
mov hDC , rax
; initialize the OpenGL pixel format descriptor (support for OpenGL and dual
; buffering) select it
mov edx , offset PixFrm
invoke ChoosePixelFormat , eax
; and install it
mov r8d , offset PixFrm
invoke SetPixelFormat , hDC , eax
; convert the window context to the OpenGL context
invoke wglCreateContext , hDC
mov hrc , rax
; and make it current
invoke wglMakeCurrent , hDC , eax
; choose the mode of calculating perspective transformations (best)
invoke glHint , GL_PERSPECTIVE_CORRECTION_HINT , GL_NICEST ;
; choose a perspective projection matrix for transformations
invoke glMatrixMode , GL_PROJECTION ; selects the active matrix from the list (stack)
; multiply it by the perspective matrix, i.e. just turn it on (use the glcall macro since parameters are transmitted as 8 bytes)
movq xmm0 , constd90_0
movq xmm1 , ratio
movq xmm2 , constd0_1
movq xmm3 , constd100_0
invoke gluPerspective
; choose the image matrix for transformations
invoke glMatrixMode , GL_MODELVIEW ; selects the active matrix from the list (stack)
jmp wmBYE
wmSIZE : ; --------------- Resize the scene
movzx r8 , r9w
shr r9 , 16
invoke glViewport , 0 , 0 ; Change the image display window
jmp wmBYE
wmPAINT : ; No pending messages: draw the scene
; --------------- Display the scene
; clear the screen buffer
invoke glClear , GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
; zero the current matrix (image matrix)
invoke glLoadIdentity
; move objects deep into the screen (z = -5 and left x = -1.5)
movd xmm0 , const_1_5 ; ebx
movd xmm1 , ebx
movd xmm2 , const_5_0
invoke glTranslatef
invoke glFlush
; display the buffer on the screen
invoke SwapBuffers , hDC
wmBYE : leave
retn
Wndproc endp
hDC dq ?
hrc dq ?
PixFrm label PIXELFORMATDESCRIPTOR
PixFrm label PIXELFORMATDESCRIPTOR
nSize dw sizeof PIXELFORMATDESCRIPTOR ; data structure size
nVersion dw 1 ; data structure version
dwFlags dd PFD_SUPPORT_OPENGL or PFD_DOUBLEBUFFER or \
PFD_DRAW_TO_WINDOW ; A set of bit flags that specify the properties of the point buffer
iPixelType db PFD_TYPE_RGBA ; Requires RGBA format
cColorBits db 32 ; Selects a bit of color depth
cRedBits db 0
cRedShift db 0
cGreenBits db 0
cGreenShift db 0
cBlueBits db 0
cBlueShift db 0 ; Ignore color bits
cAlphaBits db 0 ; No transparency buffer
cAlphaShift db 0 ; Shift bit is ignored
cAccumBits db 0 ; No accumulation buffer
cAccumRedBits db 0
cAccumGreenBits db 0
cAccumBlueBits db 0
cAccumAlphaBits db 0 ; Accumulation bits are ignored
cDepthBits db 32 ; 32 bit Z-buffer (depth buffer)
cStencilBits db 0 ; No stencil buffer
cAuxBuffers db 0 ; No auxiliary buffers
iLayerType db PFD_MAIN_PLANE ; Main drawing layer
bReserved db 0 ; Reserved
dwLayerMask dd 0
dwVisibleMask dd 0
dwDamageMask dd 0 ; Layer masks are ignored
szClassName db "Uncle Remus tales: #40 OpenGL" , 0
FileName db "Images\br_Rabbit3.cur" , 0
ratio dq 1.1 ; 440/400
const_1_5 dd - 1.5
const_5_0 dd - 5.0
constd90_0 dq 90.0
constd0_1 dq 0.1
constd100_0 dq 100.0
end
bat-filecls
set masm64_path=\masm43\
set filename=%~n1
if exist errors.txt del errors.txt
call :read_settings %filename%
@echo %kind_of_file%
goto %kind_of_file%
:CONSOLE
if exist %filename%.exe del %filename%.exe
if exist %filename%.obj del %filename%.obj
if exist errors.txt del errors.txt
%masm64_path%bin\ml64 /Cp /c /I"%masm64_path%Include" %filename%.asm >> errors.txt
if errorlevel 1 exit
if exist %1.rc (
%masm64_path%bin\RC /r /i"%masm64_path%\Include" %filename%.rc >> errors.txt
%masm64_path%bin\link /LIBPATH:"%masm64_path%Lib" ^
/LARGEADDRESSAWARE:NO /BASE:0x400000 /STUB:%masm64_path%bin\stubby.exe ^
/SECTION:.text,W /ALIGN:16 /entry:WinMain /MERGE:.rdata=.text ^
/fixed /nocoffgrpinfo %filename%.obj %filename%.res >> errors.txt
if exist %1.res del %1.res
) else (
%masm64_path%bin\link /SUBSYSTEM:CONSOLE /LIBPATH:"%masm64_path%Lib" ^
/entry:WinMain %filename%.obj /LARGEADDRESSAWARE:NO ^
/ALIGN:16 /SECTION:.text,W /BASE:0x400000 /STUB:%masm64_path%\bin\stubby.exe >> errors.txt
)
if errorlevel 1 exit
del %filename%.obj
goto exit1
:GUI
if exist %filename%.exe del %filename%.exe
if exist %filename%.obj del %filename%.obj
if exist errors.txt del errors.txt
%masm64_path%bin\ml64 /Cp /c /I"%masm64_path%Include" %filename%.asm >> errors.txt
if errorlevel 1 exit
if exist %1.rc (
%masm64_path%bin\RC /r /i"%masm64_path%\Include" %filename%.rc >> errors.txt
%masm64_path%bin\link /LIBPATH:"%masm64_path%Lib" ^
/LARGEADDRESSAWARE:NO /BASE:0x400000 /STUB:%masm64_path%bin\stubby.exe ^
/SECTION:.text,W /ALIGN:16 /entry:WinMain ^
/fixed /nocoffgrpinfo %filename%.obj %filename%.res >> errors.txt
if exist %1.res del %1.res
) else (
%masm64_path%bin\link /SUBSYSTEM:WINDOWS /LIBPATH:"%masm64_path%Lib" ^
/LARGEADDRESSAWARE:NO /BASE:0x400000 /STUB:%masm64_path%bin\stubby.exe ^
/SECTION:.text,W /ALIGN:16 /entry:WinMain /MERGE:.rdata=.text ^
/fixed /nocoffgrpinfo %filename%.obj >> errors.txt
)
if errorlevel 1 exit
goto exit1
:DLL
if exist %filename%.dll del %filename%.dll
%masm64_path%bin\ml64 /c /Cp /I %masm64_path%include %filename%.asm >> errors.txt
if errorlevel 1 exit
if exist %1.rc (
%masm64_path%bin\RC /r %filename%.rc >> errors.txt
if errorlevel 1 exit
%masm64_path%bin\link /SUBSYSTEM:WINDOWS /LIBPATH:%masm64_path%lib ^
/ENTRY:DllMain /DLL /DLL /section:.bss,S /stub:%masm64_path%bin\stubby.exe ^
%filename%.obj %filename%.res /DEF:%filename%.def >> errors.txt
if exist %1.res del %1.res
) else (
%masm64_path%bin\link /SUBSYSTEM:WINDOWS /LIBPATH:%masm64_path%lib ^
/ENTRY:DllMain /DLL /DLL /section:.bss,S /stub:%masm64_path%bin\stubby.exe ^
%filename%.obj /DEF:%filename%.def >> errors.txt
)
if errorlevel 1 exit
del %filename%.exp
:exit1
del %filename%.obj
del errors.txt
:: %filename%.exe
exit
:read_settings
for /f "eol=# tokens=2-3" %%A in (%filename%.asm) do (
set kind_of_file=%%A
if %%B == # exit /b )
exit /b
We draw a triangle, there are asm-file, cursor, exe-file and win64a.inc in the attachment.
triangle and rectangle, there are asm-file, cursor and exe-file in the attachment.
Colored triangle and rectangle. There are asm-file, cursor and exe-file in the attachment.
Rotating triangle and the rectangle. There are asm-file, cursor and exe-file in the attachment.
From four triangles we make a rotating tetrahedron (a pyramid in which all faces are equilateral triangles). There are asm-file, cursor and exe-file in the attachment.
This program demonstrates using mipmaps for texture maps. To overtly show the effect of mipmaps, each mipmap reduction level has a solidly colored, contrasting texture image. Thus, the quadrilateral which is drawn is drawn with several different colors. There are asm-file, cursor and exe-file in the attachment. A prototype is model.c from https://www.opengl.org/archives/resources/code/samples/redbook/
This program demonstrates vertex arrays. There are asm-file, cursor and exe-file in the attachment. A prototype is varray.c from https://www.opengl.org/archives/resources/code/samples/redbook/
This program demonstrates using mipmaps for texture maps. To overtly show the effect of mipmaps, each mipmap reduction level has a solidly colored, contrasting texture image. Thus, the quadrilateral which is drawn is drawn with several different colors. A prototype is mipmap.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
Points, lines, triangle, rectangles, pentagon. There are asm-file, cursor and exe-file in the attachment.
A rewrited example from the "FASM OpenGL tutorial from Tyler Durden"
Motion blur - blurring the image when you rotate the camera, play back motion scenes or fast moving objects. Rendering is the process of obtaining an image from a model using a computer program. There are asm-file, cursor and exe-file in the attachment.
Redesigned example from the "FASM OpenGL tutorial from Tyler Durden". Texturing is a stage in the process of creating and visualizing a 3D model, which allows you to give the surface of an object certain parameters and properties in order to obtain maximum realism. There are asm-file, cursor and exe-file in the attachment.
Rewrited example from the "FASM OpenGL tutorial from Tyler Durden"
alpha-blending is a transparency effect. In the attachment, the asm-file, cursor, raw file and exe
Reworked example from the "FASM OpenGL tutorial from Tyler Durden"
The Fog. In the attachment, the asm-file, cursor, raw-file, opengl32.inc and exe-file
Converted example from the tutorial Igor Tarasov "OpenGL Fundamentals" lamps.c There are asm-file, cursor and exe-file in the attachment.
This program demonstrates some characters of a stroke (vector) font. The characters are represented by display lists, which are given numbers which correspond to the ASCII values of the characters. Use of glCallLists() is demonstrated. A prototype is stroke.c from https://www.opengl.org/archives/resources/code/samples/redbook/ . There are asm-file, cursor and exe-file in the attachment.
This is a simple, introductory OpenGL program. A prototype is hello.c from https://www.opengl.org/archives/resources/code/samples/redbook/ . There are asm-file, cursor and exe-file in the attachment.
Very interesting, Mikl :thumbsup:
:thumbsup:
This program demonstrates the use of the GL lighting model. Several objects are drawn using different material characteristics. A single light source illuminates the objects. A prototype is material.c from https://www.opengl.org/archives/resources/code/samples/redbook/ . There are asm-file, cursor and exe-file in the attachment. May be need glut32.dll It is in attachment too
This program uses evaluators to draw a Bezier curve. A prototype is bezcurve.c from https://www.opengl.org/archives/resources/code/samples/redbook/ . There are asm-file, cursor and exe-file in the attachment.
This program demonstrates how to make and execute a display list. Note that attributes, such as current color and matrix, are changed.
A prototype is list.c from https://www.opengl.org/archives/resources/code/samples/redbook/ . There are asm-file, cursor and exe-file in the attachment.
This program demonstrates geometric primitives and their attributes. A prototype is lines.c from https://www.opengl.org/archives/resources/code/samples/redbook/ . There are asm-file, cursor and exe-file in the attachment.
Converted example from the tutorial Igor Tarasov "OpenGL Fundamentals" primitive.c There are asm-file, cursor and exe-file in the attachment.
Converted example from the tutorial Igor Tarasov "OpenGL Fundamentals" sphere2.c There are asm-file, cursor and exe-file in the attachment.
This program demonstrates the use of some of the gluQuadric* routines. Quadric objects are created with some quadric properties and the callback routine to handle errors. Note that the cylinder has no top or bottom and the circle has a hole in it. A prototype is quadric.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
Converted example from the tutorial Igor Tarasov "OpenGL Fundamentals" quadric.c There are asm-file, cursor and exe-file in the attachment.
Cool examples! :cool:
This program demonstrates the use of the OpenGL lighting model. A sphere is drawn using a grey material characteristic. A single light source illuminates the object. A prototype is light.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
After initialization, the program will be in ColorMaterial mode. Interaction: pressing the mouse buttons will change the diffuse reflection values.
A prototype is colormat.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
Flying and rotating cubes. There are asm-file, cursor and exe-file in the attachment.
This program demonstrates the use of the GL lighting model. Objects are drawn using a blue material characteristic. A single light source illuminates the objects. A prototype is scene.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
GLUT32.DLL
Hi, six_L!
Thank you very much, but I uploaded GLUT32.DLL in Replay #20 (http://masm32.com/board/index.php?topic=8514.msg93147#msg93147)
This program demonstrates when to issue lighting and transformation commands to render a model with a light which is moved by a modeling transformation (rotate or translate). The light position is reset after the modeling transformation is called. The eye position does not change. A sphere is drawn using a grey material characteristic. A single light source illuminates the object. Interaction: pressing the left mouse button alters the modeling transformation (x rotation) by 30 degrees. The scene is then redrawn with the light in a new position.
A prototype is movelight.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
A prototype is OpenGL.asm by Franck Charlet from masm32\examples64\opengl There are asm-file, cursor and exe-file in the attachment.
hutch--
please correct, you have a 32-bit program in examples64 (https://wasm.in/styles/smiles_s/mosking.gif)
Hi Mikl,
You are posting great stuff :thumbsup:
Excuse my ignorance: OpenGL does not have anti-aliasing like Gdi+?
Ciao, jj2007
non lo so ancora. Ho iniziato a studiare OpenGL solo due settimane e non so tutte le complessità di questo sistema (https://wasm.in/styles/smiles_s/scratch_one-s_head.gif)
Hi,Mikl__
nice work!
sorry, i did not pay attention to the GLUT32.DLL in Replay #20
Quote from: Mikl__ on May 08, 2020, 06:37:49 PM
Ciao, jj2007
non lo so ancora. Ho iniziato a studiare OpenGL solo due settimane e non so tutte le complessità di questo sistema (https://wasm.in/styles/smiles_s/scratch_one-s_head.gif)
Complimenti per il tuo italiano ;-)
I am looking forward to your next posts,
Mikl :thumbsup:
ho provato (https://wasm.in/styles/smiles_s/blush2.gif) Presto si dice una fiaba, ma si fa una cosa non presto (Скоро сказка сказывается, да не скоро дело делается)
Hi Mikl__!
Sorry, just now I realize that is for fasm :biggrin: :biggrin:
ml64 don't allow movf8.
Regards. HSE
Hi, HSE!
you need file %masm64_path%include\opengl32.inc and %masm64_path%include\win64a.inc
Mikl, we want more!
Mikl, we want more!
Mikl, we want more!
Mikl, we want more!
Mikl, we want more!
Mikl, we want more!
:biggrin: :greenclp:
By the way, I think there's in this forum all the folders and files to compile with ml64, but I dont't find it... Do you mind if...
¡Buena noches caballero!
Mira aqui (https://translate.google.com/translate?sl=ru&tl=es&u=https%3A%2F%2Fwasm.in%2Fthreads%2Fmasm-64-sborka.32766%2F)
presta atención al mensaje número 8
This program demonstrates the creation of a display list. Rotate about x-axis when "x" or "X" typed; rotate about y-axis when "y" or "Y" typed; "i" or "I" returns torus to original view. A prototype is torus.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
This program draws 5 red balls, each at a different Z-distance from the viewer, in different types of fog. This program chooses between 3 types of fog when "f" or "F" typed:
- exponential
- exponential squared
- and linear
In this program, there is a fixed density value, as well as fixed start and end values for the linear fog. A prototype is fog.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
A prototype is Flat Rendering.asm by Franck Charlet. There are asm-file, cursor and exe-file in the attachment.
This program shows how to composite modeling transformations to draw translated and rotated models. Interaction: pressing the "d" (day) (rotation of a satellite planet around its axis clockwise), "D" (rotation of a satellite planet around its axis counterclockwise) and "y" (year) (clockwise rotation of a satellite planet around a large planet) and "Y" (rotation of a satellite planet around a large planet counterclockwise). A prototype is planet.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
Mikl_ looks that you are a genius, this is really great stuff :greenclp:. I will be trying all this demos...I already tried the first one and runs with no problems here (in my pc). Nice that you are still developing and sharing your software.. :thup: :thup: Btw i didn't recall you had your "own" category in the forum (i mean "Mikl__'s ml64 examples"). You sure deserve it. Thanks a lot man! :thup: :greensml:
Second example works fine too :thumbsup:. Didn't know that opengl32.dll is already in the system. And looks that there are no needs to install any extra software to run all this cool demos. So i think that opengl is less bloated/less work than what it is directx...Any thoughts on this comparison? :icon_idea:
Hi Mikl__!
I solved first problem: Ml64 don't know :movq xmm1,rax
In ml64 must be :movd xmm1, rax
:biggrin: very ... something
Now I found I don't have glut32.lib
Where you find that?
Thanks
I just tried the 31.zip. Great stuff. I think opengl is really a worth to try. Nice Mikl__ :thup: one more time, thanks. :greenclp:
¡Hola,
felipe!
¡Muchas gracias!
QuoteNow I found I don't have glut32.lib Where you find that?
Hi,
HSE! Are you from the USA?
I made it myself (https://wasm.in/styles/smiles_s/blush2.gif)
This program demonstrates arbitrary clipping planes. A prototype is clip.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
Quote from: Mikl__ on May 12, 2020, 09:44:20 AM
Are you from the USA?
No. Almost so lazzy :biggrin:
Quote from: Mikl__ on May 12, 2020, 09:44:20 AMI made it myself (https://wasm.in/styles/smiles_s/blush2.gif)
I failed to build glut in 32 bit. I'am not going to try in 64 bit :undecided:. But in 32 bit there is a building available.
I just play in 64 bits from time to time. This examples make that more interesting.
Thanks MIkl__ :thumbsup:
deleted
Thanks. I will test next time in 64bits. :thumbsup:
The program demonstrates polygon stippling. A prototype is polys.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
This is an illustration of the selection mode and name stack, which detects whether objects which collide with a viewing volume. First, four triangles and a rectangular box representing a viewing volume are drawn (drawScene routine). The green triangle and yellow triangles appear to lie within the viewing volume, but the red triangle appears to lie outside it. Then the selection mode is entered (selectObjects routine). Drawing to the screen ceases. To see if any collisions occur, the four triangles are called. In this example, the green triangle causes one hit with the name 1, and the yellow triangles cause one hit with the name 3.
A prototype is select.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
Based on "Hidden Lines" by Franck Charlet. Rotating cubic structure. There are asm-file, cursor and exe-file in the attachment.
This program draws a NURBS surface in the shape of a symmetrical hill. The 'c' keyboard key allows you to toggle the visibility of the control points themselves. Note that some of the control points are hidden by the surface itself. A prototype is surface.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
This program draws a NURBS surface in the shape of a symmetrical hill, using both a NURBS curve and pwl (piecewise linear) curve to trim part of the surface. A prototype is trim.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
Draws the bitmapped letter F on the screen (several times). This demonstrates use of the glBitmap() call A prototype is drawf.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
Based on "Text 2D" by Franck Charlet. There are asm-file, cursor and exe-file in the attachment.
Based on "Text 3D" by Franck Charlet. There are asm-file, cursor and exe-file in the attachment.
"Text 3D". A rewrited example from the "FASM OpenGL tutorial from Tyler Durden". There are asm-file, cursor and exe-file in the attachment.
Good samples, Mikl :thumbsup:. I have tried to find the Tyler Durden's OpenGL tuto, but no success. It seems that the original site is down, do you have any working link?
Buenas tardes Alfonso!
I have a copy of this tutor in Russian
Oh, great, and if it is in Russian, even better :thumbsup: Just need a link :biggrin:
now I have a deep night, morning I will collect html-files and lay out this tutor in this topic
¡Encontró! Enlace al libro de texto del Tyler Durden
http://www.comprog.ru/OpenGL/article_4172.htm
Release the Kraken (https://wasm.in/styles/smiles_s/mosking.gif)
A rewrited example 1k_tentacle from the http://www.pouet.net/prod.php?which=20203 There are asm-file, cursor and exe-file in the attachment.
Rotating primitives, based on "Lists and GLU Primitives" by Franck Charlet. There are asm-file, cursor and exe-file in the attachment.
Torus. Rotate about x-axis when "x" or "X" typed; rotate about y-axis when "y" or "Y" typed; "i" or "I" returns torus to original view. A prototype is torus.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
Converted example from the tutorial Igor Tarasov "OpenGL Fundamentals" stencil.c There are asm-file, cursor and exe-file in the attachment.
Stencil Buffer. This program draws two rotated tori in a window. A diamond in the center of the window masks out part of the scene. Within this mask, a different model (a sphere) is drawn in a different color. This program demonstrates use of the stencil buffer for masking nonrectangular regions. Whenever the window is redrawn, a value of 1 is drawn into a diamond-shaped region in the stencil buffer. Elsewhere in the stencil buffer, the value is 0. Then a blue sphere is drawn where the stencil value is 1, and yellow torii are drawn where the stencil value is not 1. A prototype is stencil.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
Not interested? You'll write about it, please (https://wasm.in/styles/smiles_s/scratch_one-s_head.gif)
Cool examples, and you're a very fast coder. :thumbsup:
Great resource for starting game coders, much respect!
I'm a Mikl's OpenGL examples addicted :thumbsup: Please, go ahead
A prototype is "Alpha Blend Texture.asm" by Franck Charlet. There are asm-file, cursor, bmp-file and exe-file in the attachment
A prototype is "Display BMP.asm" by Franck Charlet. There are asm-file, cursor, bmp-file and exe-file in the attachment. The main thing to remember is that the image width and height in bmp-file must be a power of two (4(=22), 8(=23), 16(=24), 32(=25), 64(=26), 128(=27), 256(=28), 512(=29) pixels etc.)
This program draws several overlapping filled polygons to demonstrate the effect order has on alpha blending results. Use the 't' or 'T' key to toggle the order of drawing polygons. A prototype is alpha.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
The vertex array is almost same as the commands between
glBegin/glEnd, only the map itself executes them, substituting the values from our array. We necessary to describe not only the vertices, but also the normals, texture coordinates, color, and so arrays are different. However, we will not torment ourselves by connecting all arrays, we just throw everything into the heap with the
glInterleavedArrays function (that is, the data in the array goes sequentially, first the normal of one vertex, then its texture coordinates, color, etc. then the vertex coordinates themselves. Then, too most for the next peak, etc.) It takes parameters as the type of "piled up" arrays, here it is
GL_N3F_V3F, that is,
N3F is an array of normals, 3 floats per normal and
V3F an array of vertices, also of 3 floats per vertex, the so-called "stride" - distance "between the data for the neighboring vertex (we will have" 0 "since the data in the array goes in a row), and finally, a link to the data array (
textureBlank). But
glInterleavedArrays only connects arrays to display, they still need to be mapped. This is done with the
glDrawArrays function.
- The first parameter is the type of primitives used (GL_TRIANGLES)
- the second is the first element of the array (= 0, that is, we draw all the elements)
- and the third parameter is the total number of elements
A rewrited example varrays.asm from the "FASM OpenGL tutorial from Tyler Durden". There are asm-file, bin-file, cursor and exe-file in the attachment.
This program renders a lighted, filled Bezier surface, using two-dimensional evaluators. A prototype is bezmesh.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
This program renders a wireframe Bezier surface, using two-dimensional evaluators. A prototype is bezsurf.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
This program uses evaluators to generate a curved surface and automatically generated texture coordinates. A prototype is texturesurf.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
This program demonstrates polygon offset to draw a shaded polygon and its wireframe counterpart without ugly visual artifacts ("stitching"). A prototype is polyoff.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
Interaction: - left mouse clicks ― rotation about x-axis
- right mouse clicks ― rotation about y-axis
- to type "U"/"u" ― I still did not understand what the author of the "polyoff.c" wanted to change
- to type "T"/"t" ― change the distance from the observer to the sphere
- to type "F"/"f" ― change the thickness of the coordinate grid on the sphere
This program demonstrates a single modeling transformation, glScalef() and a single viewing transformation, gluLookAt(). A wireframe box is rendered. A prototype is cube.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
A simple example of using accumulation buffer to do full-scene antialiasing on a scene with orthographic parallel projection. A prototype is accanti.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
Use the accumulation buffer to do full-scene antialiasing on a scene with perspective projection, using the special routines accFrustum() and accPerspective(). A prototype is accpersp.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
This program shows how to draw anti-aliased lines. It draws two diagonal lines to form an X when 'r' or 'R' is typed in the window, the lines are rotated in opposite directions. A prototype is aargb.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
A prototype is "Spot Light" by Franck Charlet. There are asm-file, cursor and exe-file in the attachment.
Stainless steel cylinder. A prototype is "Sphere Mapping" by Franck Charlet. There are asm-file, cursor, bmp-file for texture and exe-file in the attachment.
This program texture maps a checkerboard image onto two rectangles. This program clamps the texture, if the texture coordinates fall outside 0.0 and 1.0. A prototype is checker.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
This program shows how to composite modeling transformations to draw translated and rotated hierarchical models. A prototype is robot.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
Interaction: pressing the "s", "S", "E" and "e" keys (shoulder and elbow) alters the rotation of the robot arm.
Graphic primitives. This program demonstrates polygon tessellation. Two tesselated objects are drawn. The first is a rectangle with a triangular hole. The second is a smooth shaded, self-intersecting star. Note the exterior rectangle is drawn with its vertices in counter-clockwise order, but its interior clockwise. Note the combineCallback is needed for the self-intersecting star. Also note that removing the TessProperty for the star will make the interior unshaded (WINDING_ODD). A prototype is tess.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
It is a small holiday today - I have 900-th post in masm32.com forum (https://wasm.in/styles/smiles_s/party.gif) (http://www.kolobok.us/smiles/artists/vishenka/d_martini.gif) It's a pity that there is no feedback ...
Congratulations :biggrin:
I watched a some of a your examples :thumbsup:
Quote from: Mikl__ on June 03, 2020, 08:09:47 PMIt's a pity that there is no feedback ...
Dear
Mikl,
Congrats to your 900th post :thumbsup:
There is no feedback because we are watching with awe what you produce every day. Most of us are simply not able to follow you... sincere compliments, this is great stuff :thup:
Quote from: jj2007 on June 04, 2020, 01:09:21 AM
Most of us are simply not able to follow you...
That's my case too, especially because i just don't have the time :sad:. But let me tell you: you have done a great job! :greenclp:.
Hi,
TimoVJL,
jj2007,
felipe!
Thanks a lot!
There are asm-file, cursor, raw-file for texture and exe-file in the attachment
Interaction:
- left mouse clicks ― rotation about x-axis
- right mouse clicks ― rotation about y-axis
Hi,
hutch--!
I will can make a planet with only one continent "Australia" and a satellite of such a planet with the continent "New Zealand" (https://wasm.in/styles/smiles_s/mosking.gif) I feel myself the creator of the universe!
There is where to strive for something (https://wasm.in/styles/smiles_s/mosking.gif)
Per aspera ad astra
A few handfuls of stars and the picture came to life. There are asm-file, cursor, bin-file and exe-file in the attachment
This program demonstrates how to intermix opaque and alpha blended polygons in the same scene, by using glDepthMask. Press the 'a' or 'A' keys to animate moving the transparent object through the opaque object. Press the 'r' or 'R' keys to reset the scene. A prototype is alpha3D.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
This program draws a texture mapped teapot with automatically generated texture coordinates. The texture is rendered as stripes on the teapot. Initially, the object is drawn with texture coordinates based upon the object coordinates of the vertex and distance from the plane x=0. Pressing the 'e' or 'E' keys changes the coordinate generation to eye coordinates of the vertex. Pressing the 'o' or 'O' keys switches it back to the object coordinates. Pressing the 's' or 'S' keys changes the plane to a slanted one (x+y+z=0). Pressing the 'x' or 'X' keys switches it back to x=0. A prototype is texgen.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
China shop window (https://wasm.in/styles/smiles_s/mosking.gif)
This program demonstrates lots of material properties. A single light source illuminates the objects. A prototype is teapots.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-file, cursor and exe-file in the attachment.
The teapot again
Converted example from the tutorial Igor Tarasov "OpenGL Fundamentals" common.c There are asm-file, raw-file for texture, cursor and exe-file in the attachment
Converted example from the tutorial Igor Tarasov "OpenGL Fundamentals" control.c There are asm-file, cursor and exe-file in the attachment
Interaction: pressing the "Arrow Left", "Arrow Right", "Arrow Up" and "Arrow Down"
Hi,
All!
I'm interested in
- Do you manage to run programs?
- Are any errors detected?
I have tested most of them, and they work perfect. :cool:
Hallo, Siekmanski!
Bedankt u! (https://wasm.in/styles/smiles_s/thank_you2.gif)
Graag gedaan. :thumbsup:
Tsaar Peter de Grote bracht Nederlandse woorden naar mijn land
He loved the ships we build and the infrastructure of our country. ( channels and roads )
And the lovely, blond and handsome tall women. :biggrin:
Do you have some examples of those Dutch words?
мичман, абрикос, ватерлиния, зюйд, крейсер, ост, флагшток, аврал, ватерпас, кабель, крен, пеленг, флот, адмирал, веер, кабельтов, кубрик, рея, флюгер, апельсин, верфь, камбуз, лавировать, риф, швартов, байка, вест, каюта, лакмус, рубка, шкипер, бакен, вымпел, киль, ливер, руль, шкот, балласт, гавань, кильватер, лиф, рупор, шлюз, банка, газ, кливер, лоцман, сельдерей, шлюпка, баркас, гальюн, клипер, люк, стапель, шпиль, биржа, гарпун, кноп, мат, строп, штиль, бот, грот, койка, матрас, такелаж, штопор, боцман, дамба, кок, матрос, трап, альпеншток, шторм, брандспойт, док, конфорка, мачта, трос, штурвал, брезент, домкрат, кофе, мопс, доктор, трюм, штурман, брюки, киль, драить, компас, краб, мортира, фарватер, шхуна, буй, дюйм, краги, норд, флаг, ювелир, ванта, вантуз, вахта, зонтик, кран, обшлаг, флагман, яхта, суп, инфантерия, кавалерия, артиллерия, бомба, граната, леер, вентилятор, сироп, ватман, кульман, характер...
Deze woorden verschenen in het Russisch onder Peter de Grote. Dit zijn woorden uit het oude Nederlands, je bent een beetje veranderd, maar we hebben het nog steeds. Russische vlag is een gewijzigde vlag van Holland. De rode balk is van boven naar beneden verschoven
Many of the words come from seafaring, cool.
Didn't know we had so many words in common.
Next two examples remind Jules Verne books. (https://wasm.in/styles/smiles_s/mosking.gif)
Twenty Thousand Leagues Under the Seas. Finding captain Nemo
Converted example "Surface by HackMaster" from http://shackmaster.narod.ru/ The surface is programm generated. The texture from the file "texture.bmp" is superimposed on the surface. There are asm-file, bmp-file for texture, cursor and exe-file in the attachment
Around the World in the Aerostat
Converted example "Sierra by HackMaster" from http://shackmaster.narod.ru/ The surface is obtained when processing file "map.bmp". The texture from the file "texture.bmp" is superimposed on the surface. The aerostat moves forward in a sine wave. There are asm-file, bmp-files, cursor and exe-file in the attachment.
Now is not up to OpenGL. Write your comments and suggestions (https://wasm.in/styles/smiles_s/yes3.gif)
Quote from: Mikl__ on June 19, 2020, 02:18:46 AM
I am interrupting for now. I'm not up to OpenGL now. Write about your comments and suggestions. (https://wasm.in/styles/smiles_s/yes3.gif)
Thank you for giving us some time to breathe and digest your code :tongue:
Compliments,
Mikl - your work is fantastic :thumbsup:
Have you relaxed and rested enough? (https://wasm.in/styles/smiles_s/smoke.gif)
AntarcticaConverted example from https://nehe.gamedev.net/tutorial/beautiful_landscapes_by_means_of_height_mapping/16006/ There are asm-file, raw-file, cursor and exe-file in the attachment.
Interaction:
- pressing the "Arrow Left", "Arrow Right" ― surface rotation clockwise and counterclockwise
- pressing the "Arrow Up", "Arrow Down" ― Zoom In and Zoom Out
- Left Mouse Click ― change rendering state between fill/wire frame
January 28, 1820 is the day of the discovery of the sixth continent ― Antarctica. The honor to open the sixth continent fell to the Russian sailors: Thaddeus F. Bellingshausen (1778-1852) and Mikhail P. Lazarev (1788-1851).
[delete]
Hey, Mikl, this is impressive :thumbsup:
But I was convinced that it showed dark clouds over Antarctica - and that seems entirely plausible to me. Even Greta wouldn't mind, I guess :cool:
Btw it shows a weird behaviour on my Win7-64 machine: sometimes it works, sometimes it just shows me a black screen :rolleyes:
QuoteBtw it shows a weird behaviour on my Win7-64 machine: sometimes it works, sometimes it just shows me a black screen
Ciao,
jj2007!
I'm very interested in the stable work of my programs, but this is impossible if there is no feedback between me and the user
Works perfect on my PC, very smooth color transition. :thumbsup:
Hallo, Siekmanski!
Dank je voor het antwoord!
QuoteDen Brer Rabbit talk mighty 'umble.
"I don't keer w'at you do wid me, Brer Fox," sezee, "so you don't fling me in dat brier-patch. Roas' me, Brer Fox" sezee, "but don't fling me in dat brierpatch," sezee.
The prototype is "Display JPG" by Franck Charlet. There are asm-file, jpg-file, cursor and exe-file in the attachment. The main thing to remember is that the width equal to the height of the image in the jpg file, must be a power of two.
Converted example from https://nehe.gamedev.net/tutorial/radial_blur__rendering_to_a_texture/18004/ There are asm-file, cursor and exe-file in the attachment.
The gift for Stive Hutchinson to 72-nd birthday (better late than never)
Converted example from https://nehe.gamedev.net/tutorial/flag_effect_(waving_texture)/16002/ There are asm/bmp/exe-files and cursor in the attachment.
P.S. Sorry, the bmp-file was missing in the attachment, I had to redo it
Converted example from https://nehe.gamedev.net/tutorial/moving_bitmaps_in_3d_space/17001/ There are asm-\bmp-\exe-files and cursor in the attachment.
This program demonstrates drawing pixels and shows the effect of glDrawPixels(), glCopyPixels(), and glPixelZoom().
Interaction: - moving the mouse while pressing the mouse button will copy the image in the lower-left corner of the window to the mouse position, using the current pixel zoom factors. There is no attempt to prevent you from drawing over the original image.
- pressing the 'r' or 'R' key ― the original image and zoom factors are reset
- pressing the 'z' or 'Z' keys ― you change the zoom factors
A prototype is image.c from https://www.opengl.org/archives/resources/code/samples/redbook/ There are asm-\exe-files and cursor in the attachment.
A prototype is "Move Original" by Franck Charlet. There are asm-\exe-files and cursor in the attachment.
A prototype is "Infinite Light" by Franck Charlet. There are asm-\exe-files and cursor in the attachment.
A prototype is "Light and Colored Texture" by Franck Charlet. There are asm-\exe-\bmp-files and cursor in the attachment.
A prototype is "Texture Matrix" by Franck Charlet. There are asm-\exe-\bmp-files and cursor in the attachment.
Quote from: Mikl__ on July 20, 2020, 01:02:44 AM
A prototype is "Texture Matrix" by Franck Charlet
(http://masm32.com/board/index.php?action=dlattach;topic=8514.0;attach=10749)
This is old! (https://spaceship.fandom.com/wiki/Borg_Cube) Show me something new,
Mikl :smiley:
(https://vignette.wikia.nocookie.net/spaceship/images/5/56/Borg_cube_basic.png/revision/latest/scale-to-width-down/340?cb=20120125015656)
Ciao! jj2007!
The Borg cube spaceship is not old. It is vintage. The first television series, called "Star Trek" debuted in 1966. Steve Hutchinson was 18 when this series was begun.
Let's go back to today. A prototype is "Scissor" by Franck Charlet. There are asm\exe-files and cursor in the attachment.
A prototype is "Local Light" by Franck Charlet. There are asm\exe-files and cursor in the attachment.
A prototype is "Specular Material" by Franck Charlet. There are asm\exe-files and cursor in the attachment.
A prototype is "Fog" by Franck Charlet. There are asm\exe-files and cursor in the attachment.
Especially for jj2007. The Armada of Borg cubes is moving to conquer the deepest space
Converted example from https://nehe.gamedev.net/tutorial/display_lists/15003/ There are asm\bmp\exe-files and cursor in the attachment.
Interaction: pressing the "Arrow Left", "Arrow Right", "Arrow Up" and "Arrow Down"
continuation
Quote from: Mikl__ on July 23, 2020, 11:02:14 AM
Especially for jj2007. The Armada of Borg cubes is moving to conquer the deepest space
Converted example from https://nehe.gamedev.net/tutorial/display_lists/15003/ There are asm\bmp\exe-files and cursor in the attachment.
Interaction: pressing the "Arrow Left", "Arrow Right", "Arrow Up" and "Arrow Down"
That's frightening, my friend :greenclp: :greenclp: :greenclp:
C'è niente di pauro, caro jj2007 (https://wasm.in/styles/smiles_s/mosking.gif) It is in the far-far away galaxy
miss just a ball to break this armada :badgrin:
Yvette, tu aimes jouer au billard? (https://wasm.in/styles/smiles_s/good3.gif)
Les jeux de casse boits,c'est pas mal non plus :icon_idea: :biggrin:
Converted example from 'OpenGL tutorial' by Tyler Durden - Radial blur. There are asm\exe-files and cursor in the attachment.
A prototype is dof.c from https://www.opengl.org/archives/resources/code/samples/redbook/ This program demonstrates use of the accumulation buffer to create an out-of-focus depth-of-field effect. The teapots are drawn several times into the accumulation buffer. The viewing volume is jittered, except at the focal point, where the viewing volume is at the same position, each time. In this case, the gold teapot remains in focus. There are asm\exe-files and cursor in the attachment.
Dear Mikl,
I see only a black window - is that intentional?
Hi, jj2007!
I seem to have done everything right, but for some reason the brightness is low. nidud had Same result in http://masm32.com/board/index.php?topic=7599.0 Try to increase the brightness and see 5 teapots. I will probably have to redo the program
Better? ;-)
Of course better! jj2007, what did you fix? There is a picture on the site https://www.opengl.org/archives/resources/code/samples/redbook/
(https://www.opengl.org/archives/resources/code/samples/redbook/dof.jpg)
I think I understand it. jj2007, did you just turn up the brightness on the screen? (https://wasm.in/styles/smiles_s/acute.gif)
I threw it into my trusty old PaintShop 4.1, used a Gamma correction of 1.6 and increased brightness a little bit :tongue:
Especially for jj2007. Second try. Let's find differences from the first version program (https://wasm.in/styles/smiles_s/mosking.gif) Feedback is needed to make programs better
That looks perfect, my friend :thumbsup:
Ciao, jj2007!
Ho fatto del mio meglio. . .(https://wasm.in/styles/smiles_s/blush2.gif)
Rotating model of "the 3-rd planet from the Sun".
Interaction: - pressing "D/d" for day texture
- pressing "N/n" for night texture
There are asm\exe\raw-files and cursor in the attachment -->
77.zip (https://wasm.in/attachments/77-zip.6279/) (1994 Kb)
The Rotating Donut in syrupA prototype is "OpenGL torus in Assembly" by Sergey Chaban. There are asm\exe-files and cursor in the attachment.
- It is third realization of the torus in OpenGL
- first realization (http://masm32.com/board/index.php?topic=8514.msg93317#msg93317)
- second realization (http://masm32.com/board/index.php?topic=8514.msg93624#msg93624)
NeHe's tutorial 15 : Texture mapping outline fonts
There are asm\bmp\exe-files and cursor in the attachment.
You're a tireless programmer, Mikl :thumbsup:
¡Hola Alfonso!
Mis vacaciones se terminaron en la universidad, las conferencias para los estudiantes están comenzando y no tendré tiempo para OpenGL (https://wasm.in/styles/smiles_s/don-t_mention.gif)
Hi Mikl__!
After a while finally I can build something (first example, don't expect a lot :biggrin:).
No AVX here, then movq don't work.
Some modifications are needed in opengl.inc:movf8 macro x,y
ifndef movf8store
.data
movf8store qword 0
.code
endif
db 48h,0B8h
dq y
mov movf8store, rax
movsd x, movf8store
;%movq &x,rax
endm
movf8r macro x,y ; this replace movq xmm, reg
ifndef movf8store
.data
movf8store qword 0
.code
endif
mov movf8store, y
movsd x, movf8store
endm
Regards, HSE.