Jump to content

  • Log In with Google      Sign In   
  • Create Account

Prognatus

Member Since 20 May 2013
Offline Last Active Feb 07 2014 07:06 PM

Topics I've Started

app crashes when binding buffers and call draw function

12 July 2013 - 12:29 PM

code seems to crash when i call my make_buffer function or my render function.


void Graphics::make_buffer(GLenum object, GLenum type)
{
int offset = object * numperobj;
glGenBuffers(1, buf.buffer);
glBindBuffer(GL_ARRAY_BUFFER, buf.buffer[Vertices+ offset]);
glBufferData(GL_ARRAY_BUFFER, sizeof(floorverts), floorverts, GL_STATIC_DRAW);
glVertexPointer(3, GL_FLOAT, 0, BUFFER_OFFSET(0));
glEnableClientState(GL_VERTEX_ARRAY);

glGenBuffers(1, buf.buffer);
glBindBuffer(GL_ARRAY_BUFFER, buf.buffer[Colors + offset]);
glBufferData(GL_ARRAY_BUFFER, sizeof(floorcol), floorcol, GL_STATIC_DRAW);
glVertexPointer(3, GL_FLOAT, 0, BUFFER_OFFSET(0));
glEnableClientState(GL_COLOR_ARRAY);

glGenBuffers(1, buf.buffer);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buf.buffer[Elements + offset]);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(floorinds), floorinds, GL_STATIC_DRAW);

glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);

buf.PrimType[object] = type;
buf.NumElems[object] = sizeof(floorinds);
}


void Graphics::render(GLuint object)
{
int offset = object * numperobj;
glBindBuffer(GL_ARRAY_BUFFER, buf.buffer[Vertices + offset]);
glVertexPointer(3, GL_FLOAT, 0, BUFFER_OFFSET(0));
glEnableClientState(GL_VERTEX_ARRAY);

glBindBuffer(GL_ARRAY_BUFFER, buf.buffer[Colors + offset]);

glVertexPointer(3, GL_FLOAT, 0, BUFFER_OFFSET(0));
glEnableClientState(GL_COLOR_ARRAY);

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buf.buffer[Elements + offset]);

glDrawElements(buf.PrimType[object], buf.NumElems[object], GL_UNSIGNED_INT, BUFFER_OFFSET(0));

}

Need help Setting up GLFW for VS2010

04 July 2013 - 07:55 PM

I get this error every time i debug this code. I downloaded the new version of glfw from www.glfw.org. I have linked both the library's  glfw3.lib and glfw3dll.lib to the linker  input and general.
 
#define GLFW_DLL
#include <GLFW/glfw3.h>


int main(void)
{
    GLFWwindow* window;

    /* Initialize the library */
    if (!glfwInit())
        return -1;

    /* Create a windowed mode window and its OpenGL context */
    window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
    if (!window)
    {
        glfwTerminate();
        return -1;
    }

    /* Make the window's context current */
    glfwMakeContextCurrent(window);

    /* Loop until the user closes the window */
    while (!glfwWindowShouldClose(window))
    {
        /* Render here */

        /* Swap front and back buffers */
        glfwSwapBuffers(window);

        /* Poll for and process events */
        glfwPollEvents();
    }

    glfwTerminate();
    return 0;
}




1>main.obj : error LNK2019: unresolved external symbol __imp__glfwPollEvents referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glfwSwapBuffers referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glfwWindowShouldClose referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glfwMakeContextCurrent referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glfwTerminate referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glfwCreateWindow referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glfwInit referenced in function _main
1>c:\users\william\documents\visual studio 2010\Projects\test 1\Debug\test 1.exe : fatal error LNK1120: 7 unresolved externals

What to do from Now?

20 May 2013 - 06:31 PM

I have taken classes in c++ and java, I know these langauges but i dont know how to make make a game from c++ or java. Can someone help point me the right way.


PARTNERS