c++ opengl library instalation
$8-15 USD / hour
$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: 4601805
프로젝트 정보
2 제안서
원격근무 프로젝트
활동 중 11년 전
돈을 좀 벌 생각이십니까?
프리랜서 입찰의 이점
무료로 프로젝트에 신청하고 입찰할 수 있습니다
2 이 프로젝트에 프리랜서들의 평균 입찰은 $12 USD입니다./시간
Cheers, I can help you with that. I also used to do opengl code in dev-cpp
$16 USD 1일에
4.6 (1 건의 리뷰)