c program to draw 3d objects

,

Introduction

We have already applied textures to objects in the  following commodity.

  • 3D Planetary Organisation In OpenGL

Here, we will only describe some scene using QUADS. First, configure Visual Studio for glut. Read the following article to configure Visual Studio for glut and to get started with OpenGL.

  • Getting Started with OpenGL In Visual C++

For applying textures, we need textures image (256*256) 24 fleck bitmap files.

Here'south the scene graph epitome that I have drawn.

Coding

I accept created the following files in the project.

  • 3D_GameScene_OpenGL.cpp
  • DisplayScene.h
  • DisplayScene.cpp
  • LoadImageFile.h
  • LoadImageFile.cpp
  • DrawScene.h
  • DrawScene.cpp

3D_GameScene_OpenGL.cpp

This is the master source file where I have defined a master() office.

DisplayScene.cpp

In this file, I have used a switch case statement to depict scenes by providing different texture prototype files equally arguments to information technology. I have alleged class and data in DisplayScene.h header file.

LoadImageFile.cpp

This file contains a function that applies the texture to the drawn objects.

DrawScene.cpp

In this file, I have drawn a scene or defined the function which are alleged in DrawScene.h header file.

See the code defined in the above files.

DisplayScene.h

  1. #ifndef _DISPLAYSCENE_H
  2. #ascertain _DISPLAYSCENE_H
  3. enum  MyTextures
  4. {
  5.     DEFAULT = 0x01,
  6.     Animation=0x02,
  7.     BUILDINGS=0x03,
  8.     HORROR=0x04,
  9.     GREENY=0x05,
  10.     Woods=0x06,
  11.     ROCKS=0x07,
  12.     Circuit=0x08
  13. };
  14. course  DisplayGameScene
  15. {
  16. public :
  17. static void  DisplayTexturedGameScene( int , int , BOOL );
  18. };

0 Response to "c program to draw 3d objects"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel