An intuitive Android app for 3D room visualization with advanced OpenGL rendering, interactive robot placement, and wall annotations.
|
|
- 🎬 Animated UI – Smooth transitions and visual feedback
- 🤖 Interactive Robot – Place, drag, resize in real-time
- 📍 Smart Annotations – Ray-casting for precise wall placement
- 💡 Studio Lighting – Professional 3-point lighting system
- 💾 Persistent Storage – Everything auto-saves instantly
- 🎓 Beginner Friendly – Welcome guide on first launch
-
🌐 Browser Demo: Open on Appetize.io
- Opens instantly in your browser
- No downloads required
-
📱 Download APK:
- Download openGL_V2.apk
- Click "View raw" or "Download" button
- Install on Android 7.0+ device
-
🎥 Watch Demo:
- Latest Demo (V2) - 60 seconds
- Full Demo (V1) - Complete walkthrough
| Gesture | Action |
|---|---|
| One finger drag | Rotate camera around room |
| Two finger drag | Pan (move view) |
| Pinch | Zoom in/out |
- Tap "Place Robot" button
- Tap anywhere on the floor to place
- Drag the robot to reposition it
- Use +/- buttons to adjust size
- Tap "Clear" to remove
- Tap "Add Annotation"
- Select type: WARNING / INFO / ERROR
- Tap on any wall to place marker
- View all in "Notes (X)" list
- Tap ✕ to delete any annotation
- Mesh Mode – Larger point cloud (default)
- Wire Mode – Smaller points, wireframe look
Built with Clean Architecture + MVVM pattern for maintainability and scalability.
┌─────────────────────────────────────────────────────────────┐
│ UI Layer (Compose) │
│ RoomViewerFragment ──▶ RoomViewerViewModel ──▶ StateFlow │
└────────────────────────────┬────────────────────────────────┘
│
┌────────────────────────────▼────────────────────────────────┐
│ Domain Layer (Logic) │
│ AnnotationRepo ◀──▶ RobotRepo ◀──▶ Room DB │
└────────────────────────────┬────────────────────────────────┘
│
┌────────────────────────────▼────────────────────────────────┐
│ Rendering Layer (OpenGL ES 2.0) │
│ RoomRenderer ──▶ Camera ──▶ PLYModel ──▶ RobotCube │
│ │ │
│ └──▶ AnnotationOverlay ──▶ TextRenderer │
└─────────────────────────────────────────────────────────────┘
| Layer | Components | Responsibility |
|---|---|---|
| UI | RoomViewerFragment + Compose |
User interface, touch handling |
| ViewModel | RoomViewerViewModel |
State management, business logic |
| Repository | AnnotationRepo, RobotRepo |
Data operations, CRUD |
| Database | Room DB | Persistent storage (SQLite) |
| Rendering | OpenGL ES components | 3D graphics, shaders, lighting |
App Launch
↓
┌────────────────┐
│ Initialize │
│ - Database │
│ - OpenGL │
│ - Load Data │
└────────┬───────┘
↓
┌────────────────┐
│ Render 3D │
│ Room Scene │
└────────┬───────┘
↓
┌────────────────┴────────────────┐
│ User Actions │
└─┬──────┬────────┬──────┬───────┘
│ │ │ │
Rotate Place Add Toggle
Camera Robot Note View Mode
│ │ │ │
└──────┴────────┴──────┘
↓
┌─────────┐
│ Save │
│ to │
│ DB │
└─────────┘
app/src/main/java/com/example/a10x_assign/
│
├── 📊 data/ # Data Layer
│ ├── AnnotationEntity.kt # Annotation model
│ ├── Annotations.kt # Annotation DAO
│ ├── RobotEntity.kt # Robot model
│ ├── Robot.kt # Robot DAO
│ └── AppDatabase.kt # Room database
│
├── 💉 di/ # Dependency Injection
│ └── AppModule.kt # Hilt modules & providers
│
├── 🎨 opengl/ # 3D Rendering Engine
│ ├── Camera.kt # 🎥 Camera system with orbit controls
│ ├── PLYModel.kt # 🏠 3D room model with lighting
│ ├── PLYLoader.kt # 📥 Binary PLY file parser
│ ├── RobotCube.kt # 🤖 Robot 3D model
│ ├── AnnotationOverlay.kt # 📍 Wall annotations renderer
│ ├── TextRenderer.kt # 📝 3D text labels
│ ├── RoomRenderer.kt # 🎬 Main OpenGL coordinator
│ ├── RoomSurfaceView.kt # 👆 Touch input handler
│ └── RayCaster.kt # 🎯 3D ray-casting utility
│
├── 🗂️ repository/ # Business Logic
│ ├── AnnotationRepo.kt # Annotation operations
│ └── RobotRepo.kt # Robot operations
│
└── 🖥️ ui/roomviewer/ # User Interface
├── RoomViewerFragment.kt # Main UI (Compose + OpenGL)
└── RoomViewerViewModel.kt # State management & logic
|
Core Technologies
|
UI Framework
|
Architecture
|
Data & Storage
|
Implemented a 3-point studio lighting setup for realistic rendering:
- Key Light (Main): Camera-following bright white light
- Fill Light (Secondary): Soft cool-toned light reduces shadows
- Rim Light (Accent): Blue-tinted back light for depth
Advanced Shader Features:
• Phong specular highlights for realistic surfaces
• Reinhard tone mapping for HDR-like results
• Gamma correction (sRGB) for accurate colors
• Multi-light diffuse and ambient calculationsConverts 2D screen touches to 3D world coordinates:
Screen Touch (x, y)
→ Normalized Device Coords
→ View Space
→ World Space Ray
→ Floor Intersection (3D position)
This enables accurate robot placement and wall annotation positioning.
All UI transitions use Material Motion principles:
- Camera indicator: Animated color transitions (300ms)
- Pulsing dot: Infinite scale animation (1s cycle)
- Mode switches: Expand/collapse with fade effects
- State changes: Smooth interpolation for all properties
- Main Thread: UI updates, user input, database operations
- GL Thread: All OpenGL rendering, shader operations
- Synchronization: Volatile flags for safe cross-thread communication
Applied 90° rotation during PLY loading to fix orientation:
// Transform from top-view to front-view
X → X (stays same)
Y → -Z (old height becomes depth)
Z → Y (old depth becomes height)This ensures natural camera perspective and intuitive controls.
| Element | Color | Purpose |
|---|---|---|
| WARNING | 🔴 Red | Critical annotations |
| INFO | 🔵 Blue | Information markers |
| ERROR | 🟠 Orange | Error indicators |
| Inside Room | 🟢 Green | Camera position indicator |
| Outside Room | 🔴 Red | Camera position indicator |
| Mesh Mode | 🟣 Purple | Active render mode |
| Wire Mode | 🔵 Cyan | Active render mode |
- Dark Theme: Reduces eye strain, modern aesthetic
- High Contrast: Clear visibility of all elements
- Consistent Spacing: 8dp grid system (Material Design)
- Smooth Transitions: No jarring state changes
- Clear Hierarchy: Important actions prominently placed
| Metric | Value | Notes |
|---|---|---|
| Frame Rate | 60 FPS | Consistent on mid-range devices |
| Load Time | < 2s | PLY file parsing & initialization |
| Memory | ~80 MB | Efficient vertex buffer management |
| APK Size | ~15 MB | Optimized with ProGuard |
| Min Android | 7.0 (API 24) | Compatible with 95%+ devices |
Built this app? Here are the concepts demonstrated:
- ✅ OpenGL ES 2.0 rendering pipeline
- ✅ Vertex & fragment shader programming (GLSL)
- ✅ 3D transformations (Model-View-Projection matrices)
- ✅ Lighting models (Phong shading)
- ✅ Texture mapping & color interpolation
- ✅ Jetpack Compose modern UI
- ✅ MVVM architecture pattern
- ✅ Dependency injection with Hilt
- ✅ Room database for persistence
- ✅ Coroutines & Flow for async operations
- ✅ Ray-casting for 3D picking
- ✅ Binary file parsing (PLY format)
- ✅ Touch gesture handling
- ✅ Thread synchronization
- ✅ Custom animations
| Issue | Status | Workaround |
|---|---|---|
| No mesh triangulation | Planned | Point cloud rendering only |
| Robot is simple cube | Planned | Full URDF model in development |
| Annotations can't be edited | Planned | Delete & recreate for now |
| No undo/redo | Planned | - |
| No shadow mapping | Future | Basic lighting only |
- Triangulated mesh rendering for solid surfaces
- Annotation editing (move, resize)
- Undo/redo system for all actions
- Export/import room configurations (JSON)
- Full UR10e robot model with articulated joints
- Path planning visualization for robot movement
- AR mode using ARCore for real-world overlay
- Multi-room support with different layouts
- Shadow mapping for realistic depth
- Collaborative mode (multi-user editing)
• Android Studio Hedgehog or newer
• JDK 17+
• Android SDK 34
• Gradle 8.13-
Clone the repository
git clone https://github.com/adit9852/OpenGL_Final.git cd OpenGL_Final -
Open in Android Studio
- File → Open → Select project folder
- Wait for Gradle sync
-
Build APK
./gradlew clean ./gradlew assembleDebug
APK location:
app/build/outputs/apk/debug/app-debug.apk -
Install on device
./gradlew installDebug
Build fails?
./gradlew clean build --refresh-dependenciesOpenGL not rendering?
- Check device supports OpenGL ES 2.0
- Verify Android version ≥ 7.0
Performance issues?
- Enable GPU profiling: Developer Options → GPU rendering
- Check frame rate:
adb shell dumpsys gfxinfo <package>
This project was created as part of an Android development internship assignment.
License: MIT (Open Source)
Feel free to use this code for learning, but please provide attribution.
- OpenGL ES: Graphics rendering
- Jetpack Compose: Modern Android UI
- Material Design 3: Design system
- Room Database: Data persistence
- Dagger Hilt: Dependency injection
Developer: Aditya
- 📧 Email: [your-email@example.com]
- 💼 LinkedIn: [Your LinkedIn]
- 🐙 GitHub: @adit9852