draw 3d objects in opengl
,

Introduction
We have already applied textures to objects in the post-obit article.
- 3D Planetary System In OpenGL
Here, we will but describe some scene using QUADS. Starting time, configure Visual Studio for glut. Read the following article to configure Visual Studio for overabundance and to go started with OpenGL.
- Getting Started with OpenGL In Visual C++
For applying textures, we need textures image (256*256) 24 bit bitmap files.
Here's the scene graph paradigm that I have drawn.

Coding
I have created the post-obit 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 main source file where I have defined a principal() function.
DisplayScene.cpp
In this file, I have used a switch example statement to draw scenes by providing unlike texture image files as arguments to it. I have declared course 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 declared in DrawScene.h header file.
Come across the code divers in the in a higher place files.
DisplayScene.h
- #ifndef _DISPLAYSCENE_H
- #define _DISPLAYSCENE_H
- enum MyTextures
- {
- DEFAULT = 0x01,
- ANIMATION=0x02,
- BUILDINGS=0x03,
- HORROR=0x04,
- GREENY=0x05,
- WOODS=0x06,
- ROCKS=0x07,
- CIRCUIT=0x08
- };
- class DisplayGameScene
- {
- public :
- static void DisplayTexturedGameScene( int , int , BOOL );
- };
0 Response to "draw 3d objects in opengl"
Post a Comment