views:

46

answers:

2
+1  Q: 

OpenGL in my HWND

Right now, I'm trying to port a Direct3D renderer from my engine. I'm and OpenGL begginer so i dont have much knowlegde about OpenGL, as now i can create windows and do my render via glut, but i can't use glut for my project, because the HWND is created in my code and then sent to the renderer DLL

// Where pWindow is already a valid HWND target of the renderer 
//(Currently Direct3D9 and Direct3D10
pRenderer = pCreateGraphics(800, 600, false, pWindow);

My question is: Is there library similar to GLUT that has a similar behaviour as GLUT, but allowing my to use my own window handle?

Note: I prefer using a lib instead of reinventing the wheel, but i will do if there is not a library that can help me

+1  A: 

Well you can have a look at GLFW's source code or NeHe tutorials and grab the OpenGL init code.

Gregory Pakosz
I'll have a look at GLFW's, about NeHe, i forgot to add that to my post, but I prefer using a lib instead of reinventing the wheel, thanks
Fladur
ok, well GLFW doesn't allow you to pass your own HWND in fact, but having your own opengl context init code isn't much code
Gregory Pakosz
Maybe not, but what i try to achieve is gonna be hard tough xD thanks
Fladur
A: 

SDL lets you get the window handle. I don't know if the used pixel format can be assumed to be DirectX compatible though.

ponce