Author Topic: OpenGL in masm64  (Read 1475 times)

Mikl__

  • Member
  • ****
  • Posts: 892
Re: OpenGL in masm64
« Reply #75 on: May 21, 2020, 09:25:00 PM »
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.

Mikl__

  • Member
  • ****
  • Posts: 892
Re: OpenGL in masm64
« Reply #76 on: May 22, 2020, 10:02:20 PM »
Not interested? You'll write about it, please

Siekmanski

  • Member
  • *****
  • Posts: 2130
Re: OpenGL in masm64
« Reply #77 on: May 22, 2020, 10:18:18 PM »
Cool examples, and you're a very fast coder.  :thumbsup:
Great resource for starting game coders, much respect!
Creative coders use backward thinking techniques as a strategy.

caballero

  • Member
  • *****
  • Posts: 1415
  • Matrix - Noah
    • abre ojos ensamblador
Re: OpenGL in masm64
« Reply #78 on: May 22, 2020, 11:04:14 PM »
I'm a Mikl's OpenGL examples addicted  :thumbsup: Please, go ahead
The logic of the error is hidden among the most unexpected lines of the program

Mikl__

  • Member
  • ****
  • Posts: 892
Re: OpenGL in masm64
« Reply #79 on: May 23, 2020, 11:17:44 AM »
A prototype is "Alpha Blend Texture.asm" by Franck Charlet. There are asm-file, cursor, bmp-file and exe-file in the attachment

Mikl__

  • Member
  • ****
  • Posts: 892
Re: OpenGL in masm64
« Reply #80 on: May 23, 2020, 01:46:47 PM »
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 size in bmp-file must be a power of two (64×64(=26), 128×128(=27), 256×256(=28), 512×512(=29) pixels etc.)
« Last Edit: May 23, 2020, 07:48:28 PM by Mikl__ »

Mikl__

  • Member
  • ****
  • Posts: 892
Re: OpenGL in masm64
« Reply #81 on: May 24, 2020, 01:07:49 PM »
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.

Mikl__

  • Member
  • ****
  • Posts: 892
Re: OpenGL in masm64
« Reply #82 on: May 26, 2020, 12:04:38 AM »
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.

Mikl__

  • Member
  • ****
  • Posts: 892
Re: OpenGL in masm64
« Reply #83 on: May 26, 2020, 12:34:11 PM »
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.

Mikl__

  • Member
  • ****
  • Posts: 892
Re: OpenGL in masm64
« Reply #84 on: May 26, 2020, 01:36:12 PM »
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.

Mikl__

  • Member
  • ****
  • Posts: 892
Re: OpenGL in masm64
« Reply #85 on: May 26, 2020, 04:04:54 PM »
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.

Mikl__

  • Member
  • ****
  • Posts: 892
Re: OpenGL in masm64
« Reply #86 on: May 26, 2020, 07:00:21 PM »
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.

Programm reactions:
  • 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
« Last Edit: May 27, 2020, 09:35:46 AM by Mikl__ »

Mikl__

  • Member
  • ****
  • Posts: 892
Re: OpenGL in masm64
« Reply #87 on: May 27, 2020, 02:39:36 PM »
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.