Jump to content


c0mputer-fr0d

Member Since 28 Jul 2012
Offline Last Active Apr 10 2013 04:24 AM
-----

Posts I've Made

In Topic: can anyone explain these errors, please

04 April 2013 - 02:21 AM

ok it's all fixed I had to set the #defome GlEW_STATIC in the compiler options not the actual c file. All the best!

In Topic: can anyone explain these errors, please

04 April 2013 - 01:22 AM

I got it narrowed down to these errors I can't figure out what to do.
I put the glew32.dll in system32
I put the .lib in my mingw/lib folder
and I put the header in the mingw/includes folder
added the header to my project and
put this in linker options
glew32s
opengl32
-lglfw
but I still get these.
C:/Users/Jack/Desktop/graphical/demographics/engine.c:40: undefined reference to `_imp__glewExperimental'
C:/Users/Jack/Desktop/graphical/demographics/engine.c:41: undefined reference to `_imp__glewInit@0'
C:/Users/Jack/Desktop/graphical/demographics/engine.c:56: undefined reference to `_imp____glewGenVertexArrays'
C:/Users/Jack/Desktop/graphical/demographics/engine.c:57: undefined reference to `_imp____glewBindVertexArray'
C:/Users/Jack/Desktop/graphical/demographics/engine.c:66: undefined reference to `_imp____glewGenBuffers'
C:/Users/Jack/Desktop/graphical/demographics/engine.c:67: undefined reference to `_imp____glewBindBuffer'
C:/Users/Jack/Desktop/graphical/demographics/engine.c:68: undefined reference to `_imp____glewBufferData'
C:/Users/Jack/Desktop/graphical/demographics/engine.c:70: undefined reference to `_imp____glewEnableVertexAttribArray'
C:/Users/Jack/Desktop/graphical/demographics/engine.c:71: undefined reference to `_imp____glewBindBuffer'
C:/Users/Jack/Desktop/graphical/demographics/engine.c:73: undefined reference to `_imp____glewEnableVertexAttribArray'
C:/Users/Jack/Desktop/graphical/demographics/engine.c:74: undefined reference to `_imp____glewBindBuffer'
C:/Users/Jack/Desktop/graphical/demographics/engine.c:75: undefined reference to `_imp____glewVertexAttribPointer'
C:/Users/Jack/Desktop/graphical/demographics/engine.c:86: undefined reference to `_imp____glewDisableVertexAttribArray'
my code
#include <stdio.h>
#include <stdlib.h>
#include <GL/glew.h>
#include <GL/glfw.h>

#define GLEW_STATIC

//#include <glm/glm.hpp>

//using namespace glm;

#define true 1
#define false 0


int main(void){

if( !glfwInit() )
{
    fprintf( stderr, "Failed to initialize GLFW\n" );
    return -1;
}



glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 4); // 4x antialiasing
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3); // We want OpenGL 3.3
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 3);
glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); //We don't want the old OpenGL

// Open a window and create its OpenGL context
if( !glfwOpenWindow( 1024, 768, 0,0,0,0, 32,0, GLFW_WINDOW ) )
{
    fprintf( stderr, "Failed to open GLFW window\n" );
    glfwTerminate();
    return -1;
}

// Initialize GLEW
glewExperimental = true; // Needed in core profile
if (glewInit() != GLEW_OK) {
    fprintf(stderr, "Failed to initialize GLEW\n");
    return -1;
}

glfwSetWindowTitle( "THIEVERY2" );

// Ensure we can capture the escape key being pressed below
glfwEnable( GLFW_STICKY_KEYS );

do{
    // Draw nothing, see you in tutorial 2 !

    // Swap buffers
	 GLuint VertexArrayID;
	 glGenVertexArrays(1, &VertexArrayID);
	 glBindVertexArray(VertexArrayID);

	 static const GLfloat g_vertex_buffer_data[] = { // floating point vertex array for the vertices of the triangle
   -1.0f, -1.0f, 0.0f,
   1.0f, -1.0f, 0.0f,
   0.0f,  1.0f, 0.0f,
};

GLuint vertexbuffer; // hand it to our hardware driver opengl
glGenBuffers(1, &vertexbuffer);
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(g_vertex_buffer_data), g_vertex_buffer_data, GL_STATIC_DRAW);

glEnableVertexAttribArray(0);
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);

glEnableVertexAttribArray(0);
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
glVertexAttribPointer(
   0,				  // attribute 0. No particular reason for 0, but must match the layout in the shader.
   3,				  // size
   GL_FLOAT,		   // type
   GL_FALSE,		   // normalized?
   0,				  // stride
   (void*)0		    // array buffer offset
); // set all this shit

glDrawArrays(GL_TRIANGLES, 0, 3); // Starting from vertex 0; 3 vertices total -> 1 triangle

glDisableVertexAttribArray(0); // draw that bitch swag
    glfwSwapBuffers();

} // Check if the ESC key was pressed or the window was closed
while( glfwGetKey( GLFW_KEY_ESC ) != GLFW_PRESS &&
glfwGetWindowParam( GLFW_OPENED ) );
}


In Topic: can anyone explain these errors, please

03 April 2013 - 11:16 PM

ok thank's very much your the only one that ever answers me :D

In Topic: can anyone explain these errors, please

03 April 2013 - 10:53 PM

what about codeblocks?

In Topic: can anyone explain these errors, please

03 April 2013 - 10:13 PM

You're right about using the project already made but I wanted to learn how to set this up for myself. The only thing I need now is to link opengl32.lib I don't know how to link it won't let me link the opengl32.dll that's in my system32 folder what do I do?