| Post Your Message | |
| |
| Previous Messages |
|
Posted By
seff on 2021-04-18 05:39:56
| Re: 3D calculating
@zzarko nice!
|
|
Posted By
zzarko on 2021-04-18 01:37:43
| Re: 3D calculating
If you are interested in that kind of stuff, TRSE just got the library for 3D. Here it is displayed for C64 and BBC, but there are plans to extend the support to other machines, so I guess it will be available at some point for Plus/4 too.
Youtube C64 Youtube BBC
It looks to me that it does what you wanted, but the drawing of lines is realtime, not with bitmaps.
|
|
Posted By
seff on 2021-04-10 16:00:25
| Re: 3D calculating
@gerliczer it's just my point of view. I like Blender though. It's only that OpenGL is so simple when you relate to Plus/4. For example two buffers: with Plus/4 you could have two video RAMs and swap them back and forth, say $2000 and $4000 every two frames to compensate on slow CPU operations. You'd keep on drawing your stuff in the back-buffer meanwhile the TED is working on the front-buffer. Then you'd have to program your primitives to draw lines, circles, polygons, etc. Then you'd have to create matrix transformation operations. This means to create look-up tables with pre-defined sine/cosine functions to offset speed. These functions would not be in radians/degrees, but you would have to define your own metrics in 256 steps for 360 degrees to make it fast. I tried to implement SRGP (low level OpenGL) on Plus/4 in 1994 and I gave it up in favor of 16/32-bit systems. Plus/4 has been a great learning machine and still is a beautiful machine to program in 2021.
The bottom line is that to me OpenGL is very intuitive and fundamentally very close to Plus/4. Blender is a state-of-the-art graphics tool-set, but the learning curve is very steep. OpenGL is just closer to my heart and soul if you will...
|
|
Posted By
gerliczer on 2021-04-10 11:49:22
| Re: 3D calculating
@Seff: Oh, so it is a problem that you have to learn operating a programme but it is not that you have to learn programming OpenGL. Interesting. I wouldn't have thought.
|
|
Posted By
seff on 2021-04-10 02:19:38
| Re: 3D calculating
Here is a sample Python routine that draws a line strip. When you press 'q', it will quit. You could modify it for 320x200 raster and save the bitmap for each rotation:
1. draw a line strip 2. save the current frame-buffer as a bitmap 3. rotate the camera or your object
It's in Python3 on Linux, no need for any compiler.
from OpenGL import * from OpenGL.GL import * import glfw
width = 320 * 5 height = 200 * 5
def draw_object(): # draw a line strip glBegin(GL_LINE_STRIP) if True: # to create an indent in Python glColor3f(0.0, 0.9, 0.0) glVertex2f(0.5, 0.5) glVertex2f(0.4, 0.4) glVertex2f(0.3, 0.3) glVertex2f(0.5, 0.4) glVertex2f(0.1, 0.5) glVertex2f(-0.3, -0.4) glVertex2f(0.3, 0.3) glVertex2f(-0.9, 0.2) glEnd()
def draw(): global width global height # draw my object draw_object()
def process_input(window): if glfw.get_key(window, glfw.KEY_Q) == glfw.PRESS: glfw.set_window_should_close(window, True)
def main(): global width global height
init_status = glfw.init() if not init_status: print('Cannot initialize glfw\n') exit() window = glfw.create_window(width, height, 'Triagle', None, None) # create window if not window: glfw.terminate() print('Cannot create window\n') exit()
glfw.set_window_pos(window, 480, 100) glfw.make_context_current(window) # create opengl object and link it to window glfw.swap_interval(1) # force swap interval
version = glGetString(GL_VERSION) print(version)
while not glfw.window_should_close(window): fb_size = glfw.get_framebuffer_size(window) # get current window width and height width = fb_size[0] height = fb_size[1] glViewport(0, 0, width, height) # everytime the windows is resized - update viewport glClearColor(0.2, 0.2, 0.2, 1) # set clear color glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) # clear screen draw() process_input(window) # check keys
glfw.swap_buffers(window) # swap buffers glfw.poll_events() # listen for window events glfw.destroy_window(window) glfw.terminate() return 0
main()
Blender is a good option too, but then again you'd have to learn how to program/operate the piece of software. IMHO OpenGL is a more programmatic approach to 2D/3D visualization.
|
|
Posted By
gerliczer on 2021-04-09 10:42:29
| Re: 3D calculating
Create your 3D model in Blender and render it to pictures from a number of viewpoints.
|
|
Posted By
Luca on 2021-04-09 08:48:44
| Re: 3D calculating
"Calculate the bitmap" is a misty concept to me, you should just take X screenshots of your S faced solid rotated by 2*pi/X*S (single or multiple axes).
|
|
Posted By
SVS on 2021-04-09 08:20:59
| 3D calculating
Do you know any PC routine able to calculate the bitmap of the frames of a simple 3D rotating solid? I attempted to reuse my little rotating logo patterns but they do not work for non-CBM apps. Say a 16*16 or 25*25 figure. Thank U!
|
|
| |
Copyright © Plus/4 World Team, 2001-2024. Support Plus/4 World on Patreon |