Create 3D objects insite Cocos2d-x

27
Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References SEMINAR Create 3D objects inside Cocos2D-x Name: Phùng Hoàng B›c Hà Nºi, ngày 17 tháng 08 năm 2013 Phùng Hoàng B›c (Framgia Vi»t Nam) Create 3D objects inside Cocos2D-x Hà Nºi , 17/08/2013 1 / 13

description

 

Transcript of Create 3D objects insite Cocos2d-x

Page 1: Create 3D objects insite Cocos2d-x

Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References

SEMINAR

Create 3D objects inside Cocos2D-x

Name: Phùng Hoàng Bắc

Hà Nội, ngày 17 tháng 08 năm 2013

Phùng Hoàng Bắc (Framgia Việt Nam) Create 3D objects inside Cocos2D-x Hà Nội , 17/08/2013 1 / 13

Page 2: Create 3D objects insite Cocos2d-x

Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References

Contents

Introduction 3D objects

Create 3D objects inside Cocos2D-x

Demo

Conclusion

References

Phùng Hoàng Bắc (Framgia Việt Nam) Create 3D objects inside Cocos2D-x Hà Nội , 17/08/2013 2 / 13

Page 3: Create 3D objects insite Cocos2d-x

Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References

Contents

Introduction 3D objects

Create 3D objects inside Cocos2D-x

Demo

Conclusion

References

Phùng Hoàng Bắc (Framgia Việt Nam) Create 3D objects inside Cocos2D-x Hà Nội , 17/08/2013 2 / 13

Page 4: Create 3D objects insite Cocos2d-x

Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References

Contents

Introduction 3D objects

Create 3D objects inside Cocos2D-x

Demo

Conclusion

References

Phùng Hoàng Bắc (Framgia Việt Nam) Create 3D objects inside Cocos2D-x Hà Nội , 17/08/2013 2 / 13

Page 5: Create 3D objects insite Cocos2d-x

Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References

Contents

Introduction 3D objects

Create 3D objects inside Cocos2D-x

Demo

Conclusion

References

Phùng Hoàng Bắc (Framgia Việt Nam) Create 3D objects inside Cocos2D-x Hà Nội , 17/08/2013 2 / 13

Page 6: Create 3D objects insite Cocos2d-x

Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References

Contents

Introduction 3D objects

Create 3D objects inside Cocos2D-x

Demo

Conclusion

References

Phùng Hoàng Bắc (Framgia Việt Nam) Create 3D objects inside Cocos2D-x Hà Nội , 17/08/2013 2 / 13

Page 7: Create 3D objects insite Cocos2d-x

Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References

Contents

1 Introduction 3D objects

2 Create 3D objects inside Cocos2D-x

3 Demo

4 Conclusion

5 References

Phùng Hoàng Bắc (Framgia Việt Nam) Create 3D objects inside Cocos2D-x Hà Nội , 17/08/2013 3 / 13

Page 8: Create 3D objects insite Cocos2d-x

Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References

Introduction 3D objects

Define 1. 3D objects

3D objects are objects that occurs on a three-axis Cartesian coordinate system.

Cocos2D-x is, as you might infer from its name, a 2d gaming library. But, as it usesOpenGL internally to draw its stuff, we might leverage it to create some 3D objects onthe mix.

Phùng Hoàng Bắc (Framgia Việt Nam) Create 3D objects inside Cocos2D-x Hà Nội , 17/08/2013 4 / 13

Page 9: Create 3D objects insite Cocos2d-x

Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References

Introduction 3D objects

Define 1. 3D objects

3D objects are objects that occurs on a three-axis Cartesian coordinate system.

Cocos2D-x is, as you might infer from its name, a 2d gaming library. But, as it usesOpenGL internally to draw its stuff, we might leverage it to create some 3D objects onthe mix.

Phùng Hoàng Bắc (Framgia Việt Nam) Create 3D objects inside Cocos2D-x Hà Nội , 17/08/2013 4 / 13

Page 10: Create 3D objects insite Cocos2d-x

Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References

Introduction 3D objects

Define 1. 3D objects

3D objects are objects that occurs on a three-axis Cartesian coordinate system.

Cocos2D-x is, as you might infer from its name, a 2d gaming library. But, as it usesOpenGL internally to draw its stuff, we might leverage it to create some 3D objects onthe mix.

Phùng Hoàng Bắc (Framgia Việt Nam) Create 3D objects inside Cocos2D-x Hà Nội , 17/08/2013 4 / 13

Page 11: Create 3D objects insite Cocos2d-x

Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References

Introduction 3D objects

Define 1. 3D objects

3D objects are objects that occurs on a three-axis Cartesian coordinate system.

Cocos2D-x is, as you might infer from its name, a 2d gaming library. But, as it usesOpenGL internally to draw its stuff, we might leverage it to create some 3D objects onthe mix.

Phùng Hoàng Bắc (Framgia Việt Nam) Create 3D objects inside Cocos2D-x Hà Nội , 17/08/2013 4 / 13

Page 12: Create 3D objects insite Cocos2d-x

Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References

Contents

1 Introduction 3D objects

2 Create 3D objects inside Cocos2D-x

3 Demo

4 Conclusion

5 References

Phùng Hoàng Bắc (Framgia Việt Nam) Create 3D objects inside Cocos2D-x Hà Nội , 17/08/2013 5 / 13

Page 13: Create 3D objects insite Cocos2d-x

Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References

Create 3D objects inside Cocos2D-x

Cocos2D-x use vector 2D but with C++ we can define vector 3D.

Define 2. Vector3D

Typedef struct {GLfloat x ;GLfloat y ;GLfloat z ;} Vector3D ;

But it has some issues like :

1 Doesn’t allow you to draw sprites on top of the boxes.

2 The gluLookAt call shouldn’t be inside the Box class draw method.

3 The color shading is hardcoded.

4 And so on, so on...

Phùng Hoàng Bắc (Framgia Việt Nam) Create 3D objects inside Cocos2D-x Hà Nội , 17/08/2013 6 / 13

Page 14: Create 3D objects insite Cocos2d-x

Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References

Create 3D objects inside Cocos2D-x

Cocos2D-x use vector 2D but with C++ we can define vector 3D.

Define 2. Vector3D

Typedef struct {GLfloat x ;GLfloat y ;GLfloat z ;} Vector3D ;

But it has some issues like :

1 Doesn’t allow you to draw sprites on top of the boxes.

2 The gluLookAt call shouldn’t be inside the Box class draw method.

3 The color shading is hardcoded.

4 And so on, so on...

Phùng Hoàng Bắc (Framgia Việt Nam) Create 3D objects inside Cocos2D-x Hà Nội , 17/08/2013 6 / 13

Page 15: Create 3D objects insite Cocos2d-x

Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References

Create 3D objects inside Cocos2D-x

Cocos2D-x use vector 2D but with C++ we can define vector 3D.

Define 2. Vector3D

Typedef struct {GLfloat x ;GLfloat y ;GLfloat z ;} Vector3D ;

But it has some issues like :

1 Doesn’t allow you to draw sprites on top of the boxes.

2 The gluLookAt call shouldn’t be inside the Box class draw method.

3 The color shading is hardcoded.

4 And so on, so on...

Phùng Hoàng Bắc (Framgia Việt Nam) Create 3D objects inside Cocos2D-x Hà Nội , 17/08/2013 6 / 13

Page 16: Create 3D objects insite Cocos2d-x

Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References

Create 3D objects inside Cocos2D-x

Cocos2D-x use vector 2D but with C++ we can define vector 3D.

Define 2. Vector3D

Typedef struct {GLfloat x ;GLfloat y ;GLfloat z ;} Vector3D ;

But it has some issues like :

1 Doesn’t allow you to draw sprites on top of the boxes.

2 The gluLookAt call shouldn’t be inside the Box class draw method.

3 The color shading is hardcoded.

4 And so on, so on...

Phùng Hoàng Bắc (Framgia Việt Nam) Create 3D objects inside Cocos2D-x Hà Nội , 17/08/2013 6 / 13

Page 17: Create 3D objects insite Cocos2d-x

Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References

Create 3D objects inside Cocos2D-x

Cocos2D-x use vector 2D but with C++ we can define vector 3D.

Define 2. Vector3D

Typedef struct {GLfloat x ;GLfloat y ;GLfloat z ;} Vector3D ;

But it has some issues like :

1 Doesn’t allow you to draw sprites on top of the boxes.

2 The gluLookAt call shouldn’t be inside the Box class draw method.

3 The color shading is hardcoded.

4 And so on, so on...

Phùng Hoàng Bắc (Framgia Việt Nam) Create 3D objects inside Cocos2D-x Hà Nội , 17/08/2013 6 / 13

Page 18: Create 3D objects insite Cocos2d-x

Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References

Create 3D objects inside Cocos2D-x

Cocos2D-x use vector 2D but with C++ we can define vector 3D.

Define 2. Vector3D

Typedef struct {GLfloat x ;GLfloat y ;GLfloat z ;} Vector3D ;

But it has some issues like :

1 Doesn’t allow you to draw sprites on top of the boxes.

2 The gluLookAt call shouldn’t be inside the Box class draw method.

3 The color shading is hardcoded.

4 And so on, so on...

Phùng Hoàng Bắc (Framgia Việt Nam) Create 3D objects inside Cocos2D-x Hà Nội , 17/08/2013 6 / 13

Page 19: Create 3D objects insite Cocos2d-x

Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References

Create 3D objects inside Cocos2D-x

Cocos2D-x use vector 2D but with C++ we can define vector 3D.

Define 2. Vector3D

Typedef struct {GLfloat x ;GLfloat y ;GLfloat z ;} Vector3D ;

But it has some issues like :

1 Doesn’t allow you to draw sprites on top of the boxes.

2 The gluLookAt call shouldn’t be inside the Box class draw method.

3 The color shading is hardcoded.

4 And so on, so on...

Phùng Hoàng Bắc (Framgia Việt Nam) Create 3D objects inside Cocos2D-x Hà Nội , 17/08/2013 6 / 13

Page 20: Create 3D objects insite Cocos2d-x

Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References

Create 3D objects inside Cocos2D-x

Cocos2D-x use vector 2D but with C++ we can define vector 3D.

Define 2. Vector3D

Typedef struct {GLfloat x ;GLfloat y ;GLfloat z ;} Vector3D ;

But it has some issues like :

1 Doesn’t allow you to draw sprites on top of the boxes.

2 The gluLookAt call shouldn’t be inside the Box class draw method.

3 The color shading is hardcoded.

4 And so on, so on...

Phùng Hoàng Bắc (Framgia Việt Nam) Create 3D objects inside Cocos2D-x Hà Nội , 17/08/2013 6 / 13

Page 21: Create 3D objects insite Cocos2d-x

Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References

Contents

1 Introduction 3D objects

2 Create 3D objects inside Cocos2D-x

3 Demo

4 Conclusion

5 References

Phùng Hoàng Bắc (Framgia Việt Nam) Create 3D objects inside Cocos2D-x Hà Nội , 17/08/2013 7 / 13

Page 22: Create 3D objects insite Cocos2d-x

Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References

Demo

Phùng Hoàng Bắc (Framgia Việt Nam) Create 3D objects inside Cocos2D-x Hà Nội , 17/08/2013 8 / 13

Page 23: Create 3D objects insite Cocos2d-x

Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References

Contents

1 Introduction 3D objects

2 Create 3D objects inside Cocos2D-x

3 Demo

4 Conclusion

5 References

Phùng Hoàng Bắc (Framgia Việt Nam) Create 3D objects inside Cocos2D-x Hà Nội , 17/08/2013 9 / 13

Page 24: Create 3D objects insite Cocos2d-x

Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References

Although I don’t recommend using Cocos2D-x for making a complete3D game, adding some 3D objects might bring some interestingeffects.

Phùng Hoàng Bắc (Framgia Việt Nam) Create 3D objects inside Cocos2D-x Hà Nội , 17/08/2013 10 / 13

Page 25: Create 3D objects insite Cocos2d-x

Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References

Contents

1 Introduction 3D objects

2 Create 3D objects inside Cocos2D-x

3 Demo

4 Conclusion

5 References

Phùng Hoàng Bắc (Framgia Việt Nam) Create 3D objects inside Cocos2D-x Hà Nội , 17/08/2013 11 / 13

Page 26: Create 3D objects insite Cocos2d-x

Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References

References

[1] http ://build-failed.blogspot.com/2012/05/create-3d-objects-inside-cocos2d-x.html[2] http ://jameshui.tumblr.com/post/29459200037/rendering-simple-3d-objects-and-md2-models-with[3] http ://www.cocos2d-x.org/news/67

Phùng Hoàng Bắc (Framgia Việt Nam) Create 3D objects inside Cocos2D-x Hà Nội , 17/08/2013 12 / 13

Page 27: Create 3D objects insite Cocos2d-x

Introduction 3D objects Create 3D objects inside Cocos2D-x Demo Conclusion References

Thanks for listening.

Phùng Hoàng Bắc (Framgia Việt Nam) Create 3D objects inside Cocos2D-x Hà Nội , 17/08/2013 13 / 13