c++ opengl library instalation
$8-15 USD / hour
Dibuat hampir 11 tahun yang lalu
$8-15 USD / hour
I have a cpp file id like to compile and run on my windows client using dev-c++ ide
Im not sure which libraries I need or how to tell the compiler to use them here's the source code
I was able to compile it for linux
/////////////////////////////
///////////////////////////
//
// triangles
//
///////////////////////////
////////////////////////////
#include
using namespace std;
#include
#include
#include
#include
enum VAO_IDs { Triangles, NumVAOs };
enum Buffer_IDs { ArrayBuffer, NumBuffers };
enum Attrib_IDs { vposition = 0 };
GLuint VAOs[NumVAOs];
GLuint Buffers[NumBuffers];
const GLuint NumVertices = 6;
//---------------------------------------------
//init
//
void init( void){
glGenVertexArrays(NumVAOs, VAOs);
glBindVertexArray(VAOs[Triangles]);
GLfloat vertices[NumVertices][2] = {
{ -0.90, -0.90}, //triangle 1
{ 0.85, -0.90 },
{ -0.90, 0.85 },
{ 0.90, -0.85 }, //triangle 2
{ 0.90, 0.90 },
{ -0.85, 0.90 },
};
glGenBuffers(NumBuffers, Buffers);
glBindBuffer(GL_ARRAY_BUFFER, Buffers[ArrayBuffer]);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
ShaderInfo shaders[] = {
{ GL_VERTEX_SHADER, "[login to view URL]" },
{ GL_FRAGMENT_SHADER,"[login to view URL]" },
{ GL_NONE, NULL }};
GLuint program = LoadShaders(shaders);
glUseProgram(program);
glVertexAttribPointer(vposition, 2 , GL_FLOAT,
GL_FALSE, 0, BUFFER_OFFSET(0));
glEnableVertexAttribArray(vposition);
}
//----------------------
// display
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBindVertexArray(VAOs[Triangles]);
glDrawArrays(GL_TRIANGLES, 0, NumVertices);
glFlush();
}
//--------------------------------------
//main
//
int main (int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGBA);
glutInitWindowSize(512, 512);
glutInitContextVersion(4, 3);
glutInitContextProfile(GLUT_CORE_PROFILE);
glutCreateWindow(argv[0]);
if(glewInit()) {
cerr << "Unable to initialize GLEW ..... exiting" << endl;
exit(EXIT_FAILURE);
}
init();
glutDisplayFunc(display);
glutMainLoop();
}
ID Proyek: 4601805
Tentang proyek
2 proposal
Proyek remot
Aktif 11 tahun yang lalu
Ingin menghasilkan uang?
Keuntungan menawar di Freelancer
Tentukan anggaran dan garis waktu Anda
Dapatkan bayaran atas pekerjaan Anda
Gratis mendaftar dan menawar pekerjaan
2 freelancer menawar dengan rata-rata $12 USD/jam untuk pekerjaan ini
Cheers, I can help you with that. I also used to do opengl code in dev-cpp
$16 USD dalam 1 hari
4,6 (1 ulasan)