Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How do I make the battleship in open gl look like an acutally battleship and how do i make the ocean look even? / *

How do I make the battleship in open gl look like an acutally battleship and how do i make the ocean look even?
/*ANSWER*/GLfloat ship_vertices[]={
2.5f,-0.5f,0.0f,//0
-1.5f,-0.5f,0.5f,//1
-0.5f,0.5f,0.0f,//2
0.5f,0.5f,0.0f,//3
1.5f,-0.5f,0.5f,//4
2.5f,-0.5f,0.0f,//5
0.0f,-0.5f,2.5f //6(center)
};
// Note: you can keep these ship_colors if you want...
GLfloat ocean_surface_colors[]={
0.0f,0.0f,0.7f,1.0f,// Dark Blue
0.0f,0.0f,0.7f,1.0f,// Dark Blue
0.0f,0.0f,1.0f,1.0f,// Light Blue
0.0f,0.0f,1.0f,1.0f // Light Blue
};
/*ANSWER*/GLfloat ship_colors[]={// this is the new array of ship_colors, simply truncated
0.1f,0.1f,0.1f,1.0f,// Dark gray
0.1f,0.1f,0.1f,1.0f,
0.2f,0.2f,0.2f,1.0f,// Slightly lighter gray
0.2f,0.2f,0.2f,1.0f,
0.1f,0.1f,0.1f,1.0f,
0.1f,0.1f,0.1f,1.0f,
0.3f,0.3f,0.3f,1.0f // Light gray for the center part
};
//2) Create an array of ship_indices of triangles. This should have 9 numbers (think about why)
/*ANSWER*/GLuint ship_indices[]={
0,1,2,
2,3,4,
1,5,4,
1,0,6,
2,4,3,
0,2,6,
3,5,4,
0,1,6,
1,5,6,
2,3,6,
3,4,6
};

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Statistical And Scientific Database Management International Working Conference Ssdbm Rome Italy June 21 23 1988 Proceedings Lncs 339

Authors: Maurizio Rafanelli ,John C. Klensin ,Per Svensson

1st Edition

354050575X, 978-3540505754

More Books

Students also viewed these Databases questions

Question

5-8 What are the advantages and disadvantages of the BYOD movement?

Answered: 1 week ago