Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Need some advice for OpenGL

  1. #1

    Need some advice for OpenGL

    Hi, I recently thought about doing a 2D game engine in OpenGL. Now, before I even started, I ran into some problems. Since I am very limited in my C/C++ knowledge I searched for other languages which utilizes OpenGL and had a closer look at the article here: http://games.freebasic.net/BASICGaming/Issue3/LachieLesson2/GL2D/gL2D_tut_1.html

    Now I learned that almost all of that stuff is now deprecated (All the math stuff (glPushMatrix, glTranslate, glRotate ...) and all immediate rendering (glBegin, glVertex) etc. Now here's my question: is there a tutorial (best for Object Pascal) for building an OpenGL 2D engine which does not use deprecated stuff?
    My second problem is what library I'll use for windowing, input etc.? Should I use SDL, so I can reuse some stuff of my SDL based engine, (Free)Glut, or something totally different? (Yes, I got that OpenGL superbible in an older (used) issue, but as said it's C/C++ and mainly about 3D programming).

    Maybe a tutorial articles series here on PGD would be helpful. Something like that SDL tutorial (Artillery Game) by Jason but ported to OpenGL ...
    Best regards,
    Cybermonkey

  2. #2
    Quote Originally Posted by Cybermonkey View Post
    Now here's my question: is there a tutorial (best for Object Pascal) for building an OpenGL 2D engine which does not use deprecated stuff?
    Yes. Clicky.

  3. #3
    Actually, using OpenGL to draw 2D is exactly the same than doing 3D stuff but using only two axis (you know, use glVertex2f instead of glVertex3f). To make things easer you should use orthographic projection instead (glOrtho instead fo glFrustum).

    Quote Originally Posted by Cybermonkey View Post
    Now I learned that almost all of that stuff is now deprecated (All the math stuff (glPushMatrix, glTranslate, glRotate ...) and all immediate rendering (glBegin, glVertex) etc. (...)
    Is it? Did I miss something?

    Recently I recycled myself about OpenGL for my 2nd PGD Challenge entry and I didn't find nothing about obsolescence...
    No signature provided yet.

  4. #4
    Quote Originally Posted by Lifepower View Post
    Yes. Clicky.
    Okay, I will have a look into that. Is there a GLEW.pas available??
    Best regards,
    Cybermonkey

  5. #5
    I heard that a lot of functions will be deprecated in OpenGL 4.x, BUT most of the hardware still do not support OpenGL 4.

    I recommend you to use FreeGLUT, it will give you a good cross-platform support. I'm using it on my game engine.

  6. #6
    If you want to learn OpenGL well, I would recommend staying away from GLUT, SDL and other rudimentary helper libraries - you will have to write few lines of code extra, but you will know exactly what you are doing and will learn more. Besides, there is deprecated functionality too, for example gluBuild2DMipmaps, which you should replace in favor of glGenerateMipmap.

    Quote Originally Posted by Ñuño Martínez View Post
    Is it? Did I miss something?

    Recently I recycled myself about OpenGL for my 2nd PGD Challenge entry and I didn't find nothing about obsolescence...
    Check this thread #1 and this thread #2, where it was discussed recently. Direct link to brief deprecated list.
    Last edited by LP; 17-08-2012 at 07:29 PM. Reason: added direct link to deprecated list

  7. #7
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    What platform? If your going to do as LifePower says your going to need to either talk to X or WINAPI for window handling (no idea what mac uses) and it can be quite specific... For my OpenGL - X11 code I used this page: http://content.gpwiki.org/index.php/..._OpenGL_on_X11 and friends-of-fpc have a good tutorial on writing for WINAPI if I recall. The gpwiki link will need some understanding of C/C++ but is actually really good for cerating a context, and once you have that done its all standard opengl.

    Good luck
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  8. #8
    Oh, best for all platforms: Linux, Windows, MacOS X.
    Best regards,
    Cybermonkey

  9. #9
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    In that case youd either have to use glut or sdl for easy window handling. However if the objective is pure opengl from the ground up you'll unfortunately have to write code for each of those platforms. Good luck - some of the code you have to interface with can be a little archaic at times....
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  10. #10
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25
    If those are your main or only platforms then SDL is probably your easiest and friendliest solution. I'm not partial to GLUT myself and it doesn't do everything that SDL is going to do for you. (controller/gamepad input, audio/music mixer, some texture loading routines)

    Once you have a decent SDL base to work with the rest can be all OpenGL for your graphics. The NeHe tutorials can help you get started, but I'm not sure if they cover using SDL with OpenGL. SDL is in fact designed to use OpenGL instead for graphics, that's why they bundle it together.
    Jason McMillen
    Pascal Game Development
    Co-Founder





Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •