Results 1 to 7 of 7

Thread: gdi opengl

  1. #1

    gdi opengl

    After a long time back to programming.
    I have a few questions, to which I cannot find an answer.
    (maybe because there is an incredible amount of information on the internet (and this forum) I am not able to find the right answers).
    I hope I can get some here...

    1) GDI:
    On my 3 year old windows 7 machine I tested a fullscreen (1600 x 1050) framerate on the canvas of a borderless maximized delphi vcl form.
    I used the GDI function StretchDIBits with 32bits colors.
    To my surprise (maybe I did it wrong a few years ago) I managed do the below things about 400-600 times a second, which is an impressive framerate in my opinion.
    a) clear my offscreen memory 'bitmap' (array of 32bits integers)
    b) draw something on it
    c) draw that bitmap to the form's canvas
    Is it worth the trouble, when doing only 2D bitmap animations, using OpenGL?

    2) OpenGL:
    What is the best/newest headerfile for OpenGL? (Delphi XE2).
    I like the 'direct approach' so I'd rather not use 3d party tools right now. And I like to understand what is going on behind the scenes.

    3) Simple Example OpenGL
    I am completely new to OpenGL, although I did read some things.
    I didn't program one line of code with it.
    So what I would like to have is an example of the following simple 'skeleton'

    - initialize an opengl 'surface' to draw to, on a maximized delphi form (as above)
    - clear the surface
    - draw a piece of memory on it (some type of bgra array of colors 'bitmap')
    - repeat this 500 times
    - destructing the opengl surface and returning to the normal world.

    That's all I need for now.
    Thanks in advance
    Eric

  2. #2
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25
    Well first, if you want to do some true OpenGL graphics programming, you don't need the VCL, GDI or any other GUI stuff in your way. If you wish to work in windowed mode all you need is a library that will handle the window management for you.

    Also if you want to do 2D graphics with OpenGL or even Direct3D you'll definately benefit from the hardware acceleration should you want to rotate, scale or use alpha blending in any of your sprites. These are the 3 most common functions that will be used in just about any 2D special effect in your games so OpenGL will use your graphics card's hardware instead of going it along in software and having it run much slower. This is the same as how 3D graphics run so far and smooth, by using the graphics card hardware.

    If you are just starting out with modern graphics programming I'd recommend using JEDI-SDL which is a modernization of the SDL library headers which also include OpenGL headers. These headers can easily be replaced by any others you find that are a little more up to date.

    Further SDL offers to help you with more than just graphics as you can use it for your game input, window management, audio mixing and texture loading. Something that isn't overly easy for a beginner who doesn't already know how to load various texture formats that you'd need to take advantage of what OpenGL can do with them.

    Starting from the beginning means there is a lot of stuff you need to know first so here are some links that might help you in your search...
    - NeHe (a lot of the code is in C, but the majority of it are OpenGL commands so it translates very, very well!)
    - JEDI-SDL
    - Free Pascal Meets SDL (Tutotirals for using SDL, but Mathias has also written some introduction lessons on OpenGL there too)

    I'd look into those to get yourself started. If you want to work in 2D then your looking at "Ortho" mode, which I use myself for many of my games. 3D is a huge leap from 2D graphics so like I tell everyone who is tarting out, start small and slowly work your way up from there.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  3. #3
    Thanks and thanks for the "ortho" tip.
    I finally find some good starting stuff on http://wiki.delphigl.com.
    In the future I will probably use SDL or something like that, but for now I want to use raw OpenGL, because I want to really understand the basics.
    And rendering a simple bitmap/texture cannot be difficult, I presume.
    I know I do not need any of the VCL stuff, but it's an easier start for testing/learning.
    I'll probably come back here to ask further questions

  4. #4
    hey. I've started learning opengl recently and found that most tutorials on the web are for old fixed pipeline, not something you'd like to learn when starting from scratch. I'm using headers from delphigl.com myself but tutorials there are obsolete. Here is some more usefull stuff I've found (usually in c++ but opengl parts still apply):
    http://ogldev.atspace.co.uk/index.html
    http://www.arcsynthesis.org/gltut/index.html
    http://antongerdelan.net/opengl/inde...itle=Main_Page
    you also might want to check glscene project. it's for pascal/delphi and lot of useful code there

  5. #5
    You better get dglOpenGl.pas from http://wiki.delphigl.com/index.php/dglOpenGL.pas/en
    Or use nxPascal which does lot's of things for you. I don't see any point on reinventing the wheel.
    If you want to learn that way then that's another story.

  6. #6
    nxPascal still uses some depreciated opengl functionality from what I've seen

  7. #7
    That's true, but as far as i know, that functionality will exist for years to come. Work on shaders is already started though, it's just not on top of things. Also i intended nxPascal to be a community effort, not a solo project. So if anyone is able to assist with it, more hands/brains (*insert zombie noise...*) are welcome.

    I mean there is already a demo made with GLSL.

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
  •