Results 1 to 9 of 9

Thread: How do I start using OpenGL 3.0/3.1

  1. #1
    Junior Member Newbie
    Join Date
    May 2011
    Posts
    4

    How do I start using OpenGL 3.0/3.1

    Hi folks,

    Just planning to start coding using Visual C++ 2008 for some graphics drawing on a small project, one of my hobbies actually. Got books about OpenGL programming guide, C++ programming and a few others.

    The hardware is Intel Q6600 and ATI Raedon 4870 1GB, know it's not a top end setup but i just need it to do some static graphics objects so should be okay.


    The OS is Vista, again know it's not the best OS out there but can't afford to upgrade at the moment so live with it.


    Got a bit rusty on VC++ and my first time to use OpenGL, where do I download OpenGL and how do I call the various commands?

    Appreciate for your help!

    Ray

  2. #2
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,675

    Re: How do I start using OpenGL 3.0/3.1

    You could try the tutorials in my signature. They use OpenGL 3.3, which your hardware should support with a driver update.

  3. #3
    Junior Member Newbie
    Join Date
    May 2011
    Posts
    4

    Re: How do I start using OpenGL 3.0/3.1

    Let me get this right, so you're saying the following code in your tutorial is already available without me doing any extra coding in my Main() function?

    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    glClear(GL_COLOR_BUFFER_BIT);

    glUseProgram(theProgram);

    glBindBuffer(GL_ARRAY_BUFFER, positionBufferObject);
    glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, 0);

    glDrawArrays(GL_TRIANGLES, 0, 3);

    glDisableVertexAttribArray(0);
    glUseProgram(0);

    glutSwapBuffers();

  4. #4
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,675

    Re: How do I start using OpenGL 3.0/3.1

    Let me get this right, so you're saying the following code in your tutorial is already available without me doing any extra coding in my Main() function?
    No. Unless you linked directly to this page without reading a word before that, I don't know how you got that impression. And even then that doesn't make since, because the text above that source clearly says that this is the "display" function, not "main."

    The page right before that page describes the layout of the tutorial, the interactions with FreeGLUT (which opens and manages the window), and where the actual "main" function is.

  5. #5
    Junior Member Newbie
    Join Date
    May 2011
    Posts
    4

    Re: How do I start using OpenGL 3.0/3.1

    Excuse me, I didn't express clearly about what I need.
    I don't know how OpenGL works in a Windows environment.
    Do I need to download anything so that I can use the OpenGL commands?
    If there are downloads, where do I need to place them into and do I need to make it when I build my C++ object code?

    You know...things like this I need to know in order to get my self up to speed.
    Thanks!!

  6. #6
    Senior Member Regular Contributor
    Join Date
    Sep 2003
    Location
    Ireland
    Posts
    135

    Re: How do I start using OpenGL 3.0/3.1

    Just a summary:

    Download the gl3.h header file from this website, not sure what else is required from memory, but you might need glext.h for the create context extension.

    1) Make a window

    2) Make a "standard" Windows OpenGL context
    - this is the one that the operating system supports automatically
    - automatically in this case means without you explicitly loading function pointers
    - this gets you OpenGL 1.1 + extensions, or possibly OpenGL 1.4 + extensions on Vista/Win 7, as far as I know...

    3) Load the function pointer that allows you to request an OpenGL 3 context
    - I think it's WGL_ARB_create_context

    4) Use that function to create a context of the required version

    5) Once that succeeds, load function pointers for the GL version 3.x functions

    6) Use them to draw stuff

  7. #7
    Junior Member Newbie
    Join Date
    May 2011
    Posts
    4

    Re: How do I start using OpenGL 3.0/3.1

    I see. So with just #include "glext.h" will do? You mean OpenGL libraries are built-in Windows, in my case Windows Vista?

  8. #8
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,675

    Re: How do I start using OpenGL 3.0/3.1

    There are two things you need (assuming you can create and manage windows in Win32): create an OpenGL context and load core and extension function pointers.

    Detailed instructions for creating an OpenGL context are available. There are also a number of cross-platform toolkits available that abstract away window and context creation.

    I would not suggest bothering with code for loading core/extension functions; there are plenty of extension loading libraries that you can use. They usually use their own headers, so you won't use glext.h, gl3.h, or gl.h; read the instructions for that library.

  9. #9
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: How do I start using OpenGL 3.0/3.1

    Wanted to add the "Getting started" page from the GL wiki :
    http://www.opengl.org/wiki/Getting_started

Similar Threads

  1. Where to start OpenGL?
    By anil92 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 12-12-2015, 02:10 PM
  2. How to start ? Using MFC and OpenGL
    By songeb in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 02-01-2002, 05:46 PM
  3. Where to start opengl?
    By in forum OpenGL: Basic Coding
    Replies: 7
    Last Post: 10-17-2001, 04:19 AM
  4. Where should I start with openGL
    By in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 08-22-2001, 10:36 AM
  5. how to start with opengl
    By chetanrao in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-14-2000, 05:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean