3Dlib (tdlib) 🦆
A lightweight, hardware-accelerated 3D rendering library for Python built on ModernGL and Pygame.
Features
- Fast Rendering: Uses ModernGL for low-level GPU access.
- Universal Loading: Support for
.obj,.stl,.glb, and more viatrimesh. - Lighting: Built-in Phong shading (Ambient + Diffuse).
- Textures: Easy PNG/JPG texture mapping.
- Simple API: Designed to get you rendering in under 50 lines of code.
Code be like: import tdlib from pyrr import Matrix44 import pygame
1. Initialize the Engine
engine = tdlib.Renderer(width=800, height=600)
2. Load a 3D Model
Supports .obj, .glb, .stl
model = tdlib.load_resource(engine, "assets/duck.obj", texture_path="assets/duck_diffuse.png")
3. Main Render Loop
angle = 0 while True: engine.clear() # Clears the screen angle += 0.01
# Define Camera and Transformation
model_matrix = Matrix44.from_y_rotation(angle)
view_matrix = Matrix44.look_at((3, 3, 3), (0, 0, 0), (0, 1, 0))
proj_matrix = Matrix44.perspective_projection(45.0, 800/600, 0.1, 100.0)
mvp = proj_matrix * view_matrix * model_matrix
# Draw the object
engine.render_object(model, mvp, model_matrix, light_pos=[5, 5, 5])
pygame.display.flip()
Metadata
Release files for tdlib3d 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tdlib3d-1.0.0.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tdlib3d-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.9 kB
Release files / tdlib3d-1.0.0.tar.gz
| Download URL | tdlib3d-1.0.0.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e89e1c71897b08e334bf645d316b1f82aed544c808ec9b794f22a7bd453a32de
|
|
BLAKE2b-256 checksum How to use checksums |
ef1ba20c4f34b677e02e49fc830171cdf62b89d13e153b305288f2923571a9f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.5
|
Release files / tdlib3d-1.0.0-py3-none-any.whl
| Download URL | tdlib3d-1.0.0-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e9cd27c46ecb2b950f4d7aca26aa344f55f6a4eaf469e6d9e5ef9e607cf2b6cd
|
|
BLAKE2b-256 checksum How to use checksums |
f6c79a5f767fae1cbc7b4df59119439c760e2cc0f3f046e7f78aad53f9b5ea3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.5
|