Jump to content
  • Advertisement

Syrinth

Member
  • Content Count

    31
  • Joined

  • Last visited

Everything posted by Syrinth

  1. So I've posted here before trying to get this tutorial to even compile and I've gotten that far. I had to take a break in attempting the infuriating mess that is OpenGL tutorials due to real life issues but I really want to dive back into this. I'm on step 2 *yay, eyeroll* and the code compiles and runs, but all I get is a dark blue colored screen and no triangles being drawn. This code is pretty much copied and pasted from the tutorial except for what I needed to remove in order to have it run on my system. Can anyone see the problem? // OpenGL.cpp : Defines the entry point for the console application. // #include <windows.h> #include <stdio.h> #include <stdlib.h> #include <GL/glew.h> #define GLFW_DLL #include <GL/glfw.h> int main() { // Initialise GLFW if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); return -1; } glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 4); glfwOpenWindowHint(GLFW_WINDOW_NO_RESIZE,GL_TRUE); // 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 if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); return -1; } glfwSetWindowTitle( "Playground" ); // Ensure we can capture the escape key being pressed below glfwEnable( GLFW_STICKY_KEYS ); // Dark blue background glClearColor(0.0f, 0.0f, 0.3f, 0.0f); // An array of 3 vectors which represents 3 vertices static const GLfloat g_vertex_buffer_data[] = { -1.0f, -1.0f, 0.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, }; // This will identify our vertex buffer GLuint vertexbuffer; // Generate 1 buffer, put the resulting identifier in vertexbuffer glGenBuffers(1, &vertexbuffer); // The following commands will talk about our 'vertexbuffer' buffer glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer); // Give our vertices to OpenGL. glBufferData(GL_ARRAY_BUFFER, sizeof(g_vertex_buffer_data), g_vertex_buffer_data, GL_STATIC_DRAW); do{ glClear( GL_COLOR_BUFFER_BIT ); // 1rst attribute buffer : vertices 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 ); // Draw the triangle ! glDrawArrays(GL_TRIANGLES, 0, 3); // From index 0 to 3 -> 1 triangle glDisableVertexAttribArray(0); // Swap buffers glfwSwapBuffers(); } // Check if the ESC key was pressed or the window was closed while( glfwGetKey( GLFW_KEY_ESC ) != GLFW_PRESS && glfwGetWindowParam( GLFW_OPENED ) ); // Close OpenGL window and terminate GLFW glfwTerminate(); return 0; }
  2. and this is why I really hate the openGL tutorials. They don't bother telling me I need to do this stuff. Ok, going to go look at that. Thanks a bunch Edit: Nope, nothing changed. Also, no I haven't removed any glu code. The only code I removed was a few lines of glOpenWindowHint that were causing the program to not run.
  3. Not doing any shaders right now since the triangle wouldn't draw when it said it was supposed to. Do I need to have shaders before I can even draw a blank white triangle? O.o
  4. Ok, so this has been a very frustrating experience going over the past few weeks and has reduced my morale to near zero. I've been attempting to start programming in OpenGL because my friend explained to me why it's better than DirectX and I can see his points and would like to do this. However, I cannot for the life of me get this wretched thing set up to work. I have been trying to follow tutorials but code doesn't compile, I get linker errors and the whole thing just makes me so frustrated I don't want to even bother coding anymore. So, I am looking to someone else who knows what they're doing and can hopefully set me on the right path for how to get started here. I have seen the NeonHelium webpage and honestly, the fact that the code is so old has me kind of nervous. I am running Visual Studio C++ 2010 Express on Windows 7. I have scrapped all previous attempts at getting this to work in the hopes that a new slate will help sort things out. I currently have, on my computer, SDL, glut, glfw and glm but I obviously have no idea what I'm doing with them. Can someone PLEASE help get me started with this? I really want the chance to prove that I'm not a complete idiot :/
  5. That did it! Thank you so much!
  6. Well that's completely depressing... I'm sure I updated my graphics drivers but will check again.
  7. Correction, no error messages aside from the ones that get triggered directly in the code Unable to create OpenGL Context Unable to recreate GLFW Window Failed to open GLFW window
  8. Still terminates at the same location and in the exact same way, No error messages.
  9. Hmmm, nope. Still failing O.o
  10. Thanks a lot for the help. I'm going to watch the video even though I know how to debug since I could use the brushup. I always wondered what the difference between the various projects was. *sigh* would it scare you to hear I actually graduated with a degree in Comp Sci and Video Game Design? Starting to think my school was a massive derp...
  11. Haha, I just ran off to take a shower myself. I know, although temporarily forgot and was trying to do some fileIO outputs to se wtf was going on. Trying now. Either way, I need to leave the house for a few hours and get some stuff done. Thank you so much for all the help and I'll probably be flailing at you when I get back :/ Just checked. This fails // 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; }
  12. Whew, so close. I run the program through cmd, nothing changes. It runs, and there's no output in the cmd window.
  13. Should reiterate, it opens and then immediately closes...
  14. Just added glfw.dll and glew32.dll to my windows/system 32 folder. It runs now. However, the window just opens and closes... doesn't do anything else and I'm reasonably certain it's supposed to...
  15. So I get the following: 1>mt.exe : general error c101008a: Failed to save the updated manifest to the file "Debug\OpenGL.exe.embed.manifest". The parameter is incorrect. then if I build it again it succeeds, but when I run it, it says I'm missing the glfw.dll O.o I just checked my folders... I have it...
  16. BTW, thank you so much for helping me with this. This has been a source of stress for lover a month. Ok... so now we're at... 1>Main.obj : error LNK2019: unresolved external symbol _glfwGetWindowParam referenced in function _WinMain@16 1>Main.obj : error LNK2019: unresolved external symbol _glfwGetKey referenced in function _WinMain@16 1>Main.obj : error LNK2019: unresolved external symbol _glfwSwapBuffers referenced in function _WinMain@16 1>Main.obj : error LNK2019: unresolved external symbol _glfwEnable referenced in function _WinMain@16 1>Main.obj : error LNK2019: unresolved external symbol _glfwSetWindowTitle referenced in function _WinMain@16 1>Main.obj : error LNK2019: unresolved external symbol _glfwTerminate referenced in function _WinMain@16 1>Main.obj : error LNK2019: unresolved external symbol _glfwOpenWindow referenced in function _WinMain@16 1>Main.obj : error LNK2019: unresolved external symbol _glfwOpenWindowHint referenced in function _WinMain@16 1>Main.obj : error LNK2019: unresolved external symbol _glfwInit referenced in function _WinMain@16 1>F:\My Documents\Coding\C++\OpenGL\Debug\OpenGL.exe : fatal error LNK1120: 9 unresolved externals
  17. I think I might have fixed the SDL problem... might... I have glew32.lib, no glew.lib... so I've added that to additional dependencies. I also have glew32mx, glew32mxs and glew32s to choose from... 1>------ Build started: Project: OpenGL, Configuration: Debug Win32 ------ 1> Main.cpp 1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library 1>GLFW.lib(enable.obj) : warning LNK4099: PDB 'vc100.pdb' was not found with 'GLFW.lib(enable.obj)' or at 'F:\My Documents\Coding\C++\OpenGL\Debug\vc100.pdb'; linking object as if no debug info 1>GLFW.lib(glext.obj) : warning LNK4099: PDB 'vc100.pdb' was not found with 'GLFW.lib(glext.obj)' or at 'F:\My Documents\Coding\C++\OpenGL\Debug\vc100.pdb'; linking object as if no debug info 1>GLFW.lib(init.obj) : warning LNK4099: PDB 'vc100.pdb' was not found with 'GLFW.lib(init.obj)' or at 'F:\My Documents\Coding\C++\OpenGL\Debug\vc100.pdb'; linking object as if no debug info 1>GLFW.lib(input.obj) : warning LNK4099: PDB 'vc100.pdb' was not found with 'GLFW.lib(input.obj)' or at 'F:\My Documents\Coding\C++\OpenGL\Debug\vc100.pdb'; linking object as if no debug info 1>GLFW.lib(win32_enable.obj) : warning LNK4099: PDB 'vc100.pdb' was not found with 'GLFW.lib(win32_enable.obj)' or at 'F:\My Documents\Coding\C++\OpenGL\Debug\vc100.pdb'; linking object as if no debug info 1>GLFW.lib(win32_fullscreen.obj) : warning LNK4099: PDB 'vc100.pdb' was not found with 'GLFW.lib(win32_fullscreen.obj)' or at 'F:\My Documents\Coding\C++\OpenGL\Debug\vc100.pdb'; linking object as if no debug info 1>GLFW.lib(win32_glext.obj) : warning LNK4099: PDB 'vc100.pdb' was not found with 'GLFW.lib(win32_glext.obj)' or at 'F:\My Documents\Coding\C++\OpenGL\Debug\vc100.pdb'; linking object as if no debug info 1>GLFW.lib(win32_init.obj) : warning LNK4099: PDB 'vc100.pdb' was not found with 'GLFW.lib(win32_init.obj)' or at 'F:\My Documents\Coding\C++\OpenGL\Debug\vc100.pdb'; linking object as if no debug info 1>GLFW.lib(win32_time.obj) : warning LNK4099: PDB 'vc100.pdb' was not found with 'GLFW.lib(win32_time.obj)' or at 'F:\My Documents\Coding\C++\OpenGL\Debug\vc100.pdb'; linking object as if no debug info 1>GLFW.lib(win32_window.obj) : warning LNK4099: PDB 'vc100.pdb' was not found with 'GLFW.lib(win32_window.obj)' or at 'F:\My Documents\Coding\C++\OpenGL\Debug\vc100.pdb'; linking object as if no debug info 1>GLFW.lib(window.obj) : warning LNK4099: PDB 'vc100.pdb' was not found with 'GLFW.lib(window.obj)' or at 'F:\My Documents\Coding\C++\OpenGL\Debug\vc100.pdb'; linking object as if no debug info 1> 1>mt.exe : general error c101008a: Failed to save the updated manifest to the file "Debug\OpenGL.exe.embed.manifest". The parameter is incorrect. 1>
  18. Ok, I think I do have those but I'll go redownload to be on the safe side. It just occurred to me that I needed to do that so I checked and added glew32.lib to my additional dependencies and then jumped when I saw it freak out at me.
  19. Yes I did. I'm apparently blind and stupid. Sorry >.<
  20. To be perfectly honest, I have no idea wth I'm doing anymore or even if I'm using SDL at all... I'm not seeing any such .lib file in my SDL folders. I only have a x64 and x86 version of SDL, SDLmain and SDL.dll :/
  21. Done, however the error is exactly the same. Have included windows.h because the program had no idea wtf WinAPI was. Here is what I currently have. #include <windows.h> #include <stdio.h> #include <stdlib.h> #include <GL/glew.h> #include <GL/glfw.h> int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){ // Initialise GLFW if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); return -1; } glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 4); glfwOpenWindowHint(GLFW_WINDOW_NO_RESIZE,GL_TRUE); glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3); glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 3); glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // 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 if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); return -1; } glfwSetWindowTitle( "Playground" ); // Ensure we can capture the escape key being pressed below glfwEnable( GLFW_STICKY_KEYS ); // Dark blue background glClearColor(0.0f, 0.0f, 0.3f, 0.0f); do{ // Draw nothing, see you in tutorial 2 ! // Swap buffers glfwSwapBuffers(); } // Check if the ESC key was pressed or the window was closed while( glfwGetKey( GLFW_KEY_ESC ) != GLFW_PRESS && glfwGetWindowParam( GLFW_OPENED ) ); // Close OpenGL window and terminate GLFW glfwTerminate(); return 0; }
  22. Well that was embarrassing. Have downloaded and added properly. Following error: LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library 1>Main.obj : error LNK2019: unresolved external symbol __imp__glewInit referenced in function _main 1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup 1>F:\My Documents\Coding\C++\OpenGL\Debug\OpenGL.exe : fatal error LNK1120: 2 unresolved externals I currently do not have any of the SDL libs in additional dependencies because the program will not build if I do. It says it cannot open them.
  23. Nope, It contains this http://dl.dropbox.com/u/14130150/Untitled.png
  24. I'm using main based off of the tutorial so it could be wrong? Will add the glfw.lib file and see what happens. Well, I can't seem to find any .lib file in my glfw folders so I'm confused... the lib folder contains a carbon, cocoa, win32 and x11 folder. There are no .lib files in it... I'm currently using glfw 2.7.3
  25. I just searched for and found additional dependencies. Here is what I have in it. SDL.lib SDLmain.lib SDL_image.lib OpenGL32.lib If I remove the SDL statements from the additional directories, I get the following: 1>Main.obj : error LNK2019: unresolved external symbol _glfwGetWindowParam referenced in function _main 1>Main.obj : error LNK2019: unresolved external symbol _glfwGetKey referenced in function _main 1>Main.obj : error LNK2019: unresolved external symbol _glfwSwapBuffers referenced in function _main 1>Main.obj : error LNK2019: unresolved external symbol _glfwEnable referenced in function _main 1>Main.obj : error LNK2019: unresolved external symbol _glfwSetWindowTitle referenced in function _main 1>Main.obj : error LNK2019: unresolved external symbol __imp__glewInit referenced in function _main 1>Main.obj : error LNK2019: unresolved external symbol _glfwTerminate referenced in function _main 1>Main.obj : error LNK2019: unresolved external symbol _glfwOpenWindow referenced in function _main 1>Main.obj : error LNK2019: unresolved external symbol _glfwOpenWindowHint referenced in function _main 1>Main.obj : error LNK2019: unresolved external symbol _glfwInit referenced in function _main 1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!