Windows Menu Bar in an OpenGL Application

  • Thread starter Thread starter Joshua1987
  • Start date Start date
J

Joshua1987

Guest
Hi, I am trying to get a windows menu bar inside a project I am doing in OpenGL which is hopefully to give me more control over the application I am wanting to develop through development stages.

The problem is that I have no idea how to go about this, I have found tutorials online as well as other code samples but when I put in the code myself I get errors, and to say the least I don’t know even if it is the correct way for how I need to be doing it in OpenGL, so I was hoping you guys could help guide me along this complicated path of enlightenment.

My Code:

// OGLWin32.cpp : Defines the entry point for the application.

//

#include "OGLWin32.h"

#include <stdio.h>

#include <io.h>

#include <fcntl.h>

#include <Windows.h>

#include <gl/GL.h>

#include <gl/GLU.h>

#include "OGLApplication.h"

#pragma comment (lib, "opengl32.lib")

#pragma comment (lib, "glu32.lib")

int APIENTRY _tWinMain(HINSTANCE hInstance,

HINSTANCE hPrevInstance,

LPTSTR lpCmdLine,

int nCmdShow)

{

int exitcode = 0;

//Allocate a console window

//so that messages can be redirected to stdout

AllocConsole();

HANDLE handle_out = GetStdHandle( STD_OUTPUT_HANDLE);

int hCrt = _open_osfhandle( (long) handle_out, _O_TEXT );

FILE* hf_out = _fdopen(hCrt, "w");

setvbuf(hf_out, NULL, _IONBF, 1);

*stdout = *hf_out;

//Create the application instance

OGLApplication* myapp = OGLApplication::CreateApplication(hInstance);



exitcode = myapp->Run();



myapp->DestroyApplication();

//Free the console window

FreeConsole();

ExitProcess(0);

return exitcode;

}

Here is another guy’s code which I felt may help me:

http://www.cplusplus.com/articles/LhvU7k9E/main.cpp

Here something within my code which I have been told will make my life a lot easier for the implementation:


http://postimg.org/image/eevu5jzkx/

http://postimg.org/image/lx7eih7a9/

Continue reading...
 
Back
Top