Jump to content
  • Advertisement

AirborneCheeseburger

Member
  • Content Count

    10
  • Joined

  • Last visited

Community Reputation

100 Neutral

About AirborneCheeseburger

  • Rank
    Member
  1. AirborneCheeseburger

    OpenGL 4.0 Matrix Confusion

    Okay, thank you for helping me all the way through my problem, and after quite I while, I have been pointed in the right direction with OpenGL. Thanks!
  2. AirborneCheeseburger

    OpenGL 4.0 Matrix Confusion

    Well I'll stick with 3.3, but, back to my original question, how does one set up a perspective projection now that the support for gluPerspective was removed? I can't seem to get GLM to work. And, furthermore, why if I include glu.h the compiler won't complain about undefined references to gluPerspective if I use it? For example, this code should give me an RGB triangle, but it gives me a black screen: #include <gl/gl.h> #include <gl/freeglut.h> #include <gl/glu.h> //g++ -o Test.exe main.cpp -mwindows -lmingw32 -lopengl32 -lglut -lglu32 void display(void) { glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glTranslatef(0.0,0.0,-1.0); glBegin(GL_TRIANGLES); glColor3f(1.0,0.0,0.0); glVertex3f(-1.0,-1.0,0.0); glColor3f(0.0,1.0,0.0); glVertex3f(0.0,1.0,0.0); glColor3f(0.0,0.0,1.0); glVertex3f(1.0,-1.0,0.0); glutSwapBuffers(); } int main(int argc,char *argv[]) { glutInit(&argc,argv); glutInitDisplayMode(GLUT_DEPTH|GLUT_DOUBLE|GLUT_RGBA); glutInitContextVersion(3,3); glutInitContextFlags(GLUT_CORE_PROFILE); glutInitWindowSize(640,480); glutCreateWindow("OpenGL 4.0"); glutDisplayFunc(display); glViewport(0,0,640,480); glClearColor(0.0,0.0,0.0,0.0); glClearDepth(1.0); glDepthFunc(GL_LESS); glEnable(GL_DEPTH_TEST); glShadeModel(GL_SMOOTH); gluPerspective(45.0,4.0/3.0,0.1,100.0); glutMainLoop(); return(0); }
  3. AirborneCheeseburger

    OpenGL 4.0 Matrix Confusion

    Is that really something you want to do? I mean, drop back a whole version or so? I guess it would be simpler.
  4. AirborneCheeseburger

    OpenGL 4.0 Matrix Confusion

    @Brother Bob: Apparently not... do you know where I could get the latest library? @apatriarca: I hope so, I have an NVidia GeForce 9800 GT.
  5. AirborneCheeseburger

    OpenGL 4.0 Matrix Confusion

    I've been wondering that - what is the simplest way to indicate an error? Print it to the console?BTW, yes, I checked the header files that come with MinGW and they say OpenGL 4.0 in the flowerbox. Edit: Okay, I managed to get a screenshot of the console window before the program ceases to exist - it says "unable to create OpenGL 4.0 context, closing application", which can't be because I don't have OpenGL 4.0: Inside the GL.h header file, the first thing seen is exactly this: /* * Mesa 3-D graphics library * Version: 4.0 * Edit dos: I tried all the possible versions, and the highest I can get to work is version 3.3. Which means I have the wrong libraries. I have looked for almost a year, and have never actually been able to find the latest OpenGL libraries (not even on their own site). Does anyone know where one may obtain these?
  6. AirborneCheeseburger

    OpenGL 4.0 Matrix Confusion

    Sorry, I didn't mean that it wasn't a problem, and yes, I did fix it and it remains broken. #include <gl/gl.h> #include <gl/freeglut.h> //g++ -o Test.exe main.cpp -mwindows -lmingw32 -lopengl32 -lglut void display(void) { glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glutSwapBuffers(); } int main(int argc,char *argv[]) { glutInit(&argc,argv); glutInitDisplayMode(GLUT_DEPTH|GLUT_DOUBLE|GLUT_RGBA); glutInitContextVersion(4,0); glutInitContextFlags(GLUT_CORE_PROFILE); glutInitWindowSize(640,480); glutCreateWindow("OpenGL 4.0"); glutDisplayFunc(display); glViewport(0,0,640,480); glClearColor(0.0,0.0,0.0,0.0); glClearDepth(1.0); glDepthFunc(GL_LESS); glEnable(GL_DEPTH_TEST); glShadeModel(GL_SMOOTH); glutMainLoop(); return(0); }
  7. AirborneCheeseburger

    OpenGL 4.0 Matrix Confusion

    Thanks for reminding me of that, but that's not it... it still doesn't do anything.
  8. AirborneCheeseburger

    OpenGL 4.0 Matrix Confusion

    Well, I just realized that the functions that were not declared actually weren't in the library. *facepalm* And also, the linker should say -lglut instead of -lfreeglut.The only problem is that when I run the program, nothing happens.Here is my code: #include <gl/gl.h> #include <gl/freeglut.h> //g++ -o Test.exe main.cpp -mwindows -lmingw32 -lSDLmain -lSDL -lopengl32 -lglut int main(int argc,char *argv[]){ glutInit(&argc, argv); glutInitDisplayMode(GLUT_DEPTH|GLUT_DOUBLE|GLUT_RGBA); glutInitContextVersion (4,0); glutInitContextFlags (GLUT_CORE_PROFILE); glutInitWindowSize(640,480); glutCreateWindow("OpenGL 4.0"); glViewport(0,0,640,480); glClearColor(0.0,0.0,0.0,0.0); glClearDepth(1.0); glDepthFunc(GL_LESS); glEnable(GL_DEPTH_TEST); glShadeModel(GL_SMOOTH); int done; while (!done) { glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glutSwapBuffers(); } return(0); } Literally nothing. My mouse turns into a hourglass for a second then goes back to normal.
  9. AirborneCheeseburger

    OpenGL 4.0 Matrix Confusion

    OK, well, just tried freeGLUT and it is behaving as though I have a linker error. It outputs a whole bunch of "not declared in this scope" 's. Is there something wrong with my linker setting?: g++ -o Test.exe main.cpp -mwindows -lmingw32 -lopengl32 -lfreeglut I made sure to #include <gl/freeglut.h> and put the .DLL in my project directory...
  10. AirborneCheeseburger

    OpenGL OpenGL 4.0 Matrix Confusion

    I am fairly new to OpenGL, but I've got the basics down and can make a basic game. But, recently, I've discovered that the compiler I was using only had OpenGL 2.1 or something old like that. I am now suffering the migration to 4.0 and it seems that they have removed useful functions such as gluPerspective() because they want to help out the more advanced users. :/ So, right now all I'm trying to do is calculate a simple perspective projection matrix, and I've been referred to a library called GLM (OpenGL Math) which contains a few functions that overwrite the deprecated functions with ones using the new conventions. It won't seem to work for me, because when I use "glm::mat4 Projection = glm::perspective(45.0f,4.0f/3.0f,0.1f,100.f);" the compiler tells me "no matching function call to 'perspective(float, double, double, double,'". I think I'm including the right headers (<glm/glm.hpp>,<glm/gtc/matrix_transform.hpp>) and including <glm/gtc/type_ptr.hpp> doesn't seem to make any difference... Can someone explain the usage of this library and how to create a perspetive projection? And it would really help if an example was provided because I cannot find a full, working OpenGL code with GLM to go on. Thanks! P.S.: Using MinGW command line compiler (SDL to create the context for OpenGL)
  11. AirborneCheeseburger

    Avatar

    My avatar(s)
  • 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!