Page 1 of 1

Line Drawing

Posted: Sat Mar 16, 2019 9:29 pm
by johnfarrant
I'm trying to draw a rotating wire frame cube.
My first problem was drawing a line. The only way I could achieve this was by using Bresenham. This went ok. (Is there a line drawing routine in libnx for the Switch??)
The next problem was actually rotating the wire frame cube.
pp=cos(phi) is ok BUT pp=cos(phi+1) throws up the following error - unknown cos. When ever I try to increment the angle (degrees or radians) it fails to recognise the cos or sin commands. But cos(45) is ok but not cos(44+1). Even phi+1 followed by cos(phi) gives a similar error.
The actual wire frame cube is a standard C program and the rewritten code runs on everthing else I've tried - including LUA, qb45 etc - and it rotates as it should by incrementing phi and theta.
I've included all the relevant libraries etc. in my C source

Why no line drawing routine (or have I missed it?) and why does cos(phi+1) give an error.

It's driving me nuts. Any help would be appreciated.

Thanks, John

Re: Line Drawing

Posted: Wed May 08, 2019 8:08 pm
by WinterMute
There are no line drawing functions in libnx, no. The switch has a fairly advanced GPU which is more than capable of drawing wireframe cubes by itself - see https://github.com/switchbrew/switch-ex ... ics/opengl which should be in your installation under /opt/devkitpro/examples/switch/.

The other problems you're reporting don't seem to make much sense. Can we see your source code and the actual verbatim error output if possible?