Skip to content

NodGL Index

NtinosTheGamer2324 edited this page Mar 7, 2026 · 1 revision

NodGL Documentation

NodGL is ModuOS's powerful graphics library for creating games and graphical applications!

📚 Documentation

For Beginners

Start here if you're new to graphics programming:

  1. Getting Started - Your first NodGL program
  2. Drawing Shapes - Rectangles, circles, lines, and more
  3. Using Textures - Images, sprites, and backbuffers
  4. Handling Input - Mouse and keyboard controls
  5. Simple Examples - Complete programs to learn from

Game Development

Want to make games? Check out Blit Engine - a complete game framework built on NodGL!

Blit Engine is located in EXTERNAL/Blit/ and includes:

  • Complete 2D game framework
  • Entity/sprite management
  • BlitStudio visual editor
  • Example games

Advanced Topics

For experienced developers:

🎮 What Can You Make?

  • Games - Platformers, shooters, puzzle games
  • Graphics demos - Fractals, animations, visualizations
  • GUI applications - Calculators, paint programs, file browsers
  • Educational programs - Interactive tutorials, simulations

🚀 Quick Start

#include "NodGL.h"
#include "libc.h"

int md_main(long argc, char **argv) {
    // Create graphics device
    NodGL_Device device;
    NodGL_Context ctx;
    NodGL_CreateDevice(NodGL_FEATURE_LEVEL_1_0, &device, &ctx, NULL);
    
    // Clear screen to blue
    NodGL_ClearContext(ctx, NodGL_CLEAR_COLOR, 0xFF0000FF, 1.0f, 0);
    
    // Draw a red square
    NodGL_FillRectContext(ctx, 100, 100, 200, 200, 0xFFFF0000);
    
    // Show it
    NodGL_PresentContext(ctx, 1);
    
    // Wait
    for (volatile int i = 0; i < 5000000; i++);
    
    // Cleanup
    NodGL_ReleaseDevice(device);
    return 0;
}

💡 Key Concepts

Device & Context

  • Device - Represents your graphics hardware
  • Context - Where you issue drawing commands

Colors

Colors use ARGB format: 0xAARRGGBB

  • 0xFFFF0000 = Red
  • 0xFF00FF00 = Green
  • 0xFF0000FF = Blue

Frame Loop

Most programs follow this pattern:

while (running) {
    // 1. Handle input
    // 2. Update game logic
    // 3. Clear screen
    // 4. Draw everything
    // 5. Present frame
}

🎯 Learning Path

Absolute Beginner (no graphics experience):

  1. Read Getting Started
  2. Type out Example 1 from Simple Examples
  3. Modify the colors and positions
  4. Try Drawing Shapes

Some C Experience:

  1. Skim Getting Started
  2. Read Handling Input
  3. Build the Pong game from Simple Examples
  4. Start with the Game Engine

Experienced Programmer:

  1. Check NodGL API Reference
  2. Look at Game Engine source code
  3. Read Performance Tips
  4. Build something awesome!

📖 Additional Resources

  • Source Code - All examples are in /userland/ directory
  • Header File - NodGL.h has all function signatures
  • Library - lib_NodGL.c contains the implementation

🤝 Community

Share your NodGL creations! Check out what others have made:

  • Snake game (snakegfx.c)
  • Minesweeper (minesgfx.c)
  • Calculator (calcgfx.c)
  • Paint program (paintgfx.c)

⚡ Features

  • Hardware Acceleration - Uses GPU when available
  • Simple API - Easy to learn, hard to mess up
  • Fast - Optimized for performance
  • Flexible - From simple shapes to complex 3D
  • Well Documented - Lots of examples and guides

Start your journey: Getting Started →

Clone this wiki locally