News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

OpenGL in masm64

Started by Mikl__, May 02, 2020, 05:08:37 PM

Previous topic - Next topic

Mikl__

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__

Not interested? You'll write about it, please

Siekmanski

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.

avcaballero

I'm a Mikl's OpenGL examples addicted  :thumbsup: Please, go ahead

Mikl__

A prototype is "Alpha Blend Texture.asm" by Franck Charlet. There are asm-file, cursor, bmp-file and exe-file in the attachment

Mikl__

#80
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.)

Mikl__

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__

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__

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__

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__

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__

#86
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

Mikl__

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.

Mikl__

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.

Mikl__

#89
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.