Wireframe mode

Previous topic - Next topic

MrTAToad

Would be nice if there was a wireframe mode for objects.

Schranz0r

Take a look at : X_GETFACE
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

MrTAToad

Thats true - the only problem is that X_LINE could do with being sped up a bit.  The larger object would be slower to display than a native command.

Quentin

#3
It is quite easy to use wireframe mode, if you use the OpenGL-Wrapper from Gernot

in the following example you'll have to add the files
3DPrimitives.gbas
gl.gbas
to your project and you can see the torus in wireframe mode

Code (glbasic) Select

CreateTorus(0, 2, 5, 20, 4, 0, 0, RGB(255, 255,255))

glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)

WHILE TRUE
X_MAKE3D .1, 1000, 45
X_CAMERA 2, 2, -20, 0, 0, 0
X_AMBIENT_LT 0, RGB(255, 255, 255)
X_ROTATION phi, 1, 1, 0
X_DRAWOBJ 0, 0
INC phi, .2
SHOWSCREEN
WEND


you can switch back to filled mode easily with

glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)

MrTAToad

Ah, thats handy!

Quentin

by the way: as it seems that glPolygonMode is what X_CULLMODE is in GLBasic  ...

what about a second optional paramter for X_CULLMODE? e.g.  X_CULLMODE mode%, wire% = FALSE

bigsofty

#6
Word to the wise, be aware that glPolygonMode is not available in OpenGLES, so anything off of a desktop probably does not support this code...
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Quentin

#7
hi Ocean,
sure, it's also possible to use these functions within the loop.

Code (glbasic) Select

CreateTorus(0, 2, 5, 20, 4, 0, 0, RGB(255, 255,255))
CreateSphere(1, 2, 10, RGB(255, 255, 255))

WHILE TRUE
X_MAKE3D .1, 1000, 45
X_CAMERA 2, 2, -20, 0, 0, 0
X_AMBIENT_LT 0, RGB(255, 255, 255)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
X_ROTATION phi, 1, 1, 0
X_DRAWOBJ 0, 0
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
X_MOVEMENT 0, 0, 2
X_ROTATION phi, 1, 0, 1
X_DRAWOBJ 1, 0
INC phi, .2
SHOWSCREEN
WEND


see also documentation here
http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/polygonmode.html