Horde3D
http://www.horde3d.org/forums/

Raw OpenGL with Horde3D
http://www.horde3d.org/forums/viewtopic.php?f=1&t=978
Page 1 of 1

Author:  Orm [ 13.10.2009, 03:31 ]
Post subject:  Raw OpenGL with Horde3D

Possible?

Author:  DarkAngel [ 13.10.2009, 03:45 ]
Post subject:  Re: Raw OpenGL with Horde3D

Yep.

Some other members have posted on here saying they've used it to draw their own debug geometry, or have used OpenGL GUI libraries successfully with Horde.

Author:  Orm [ 13.10.2009, 03:48 ]
Post subject:  Re: Raw OpenGL with Horde3D

You have me intrigued with said GUI libraries. Please, do tell as I was searching for that very thing. o.0

And I would assume that after calling hordes init function i can begin to call OpenGL functions like normal right?

Author:  DarkAngel [ 13.10.2009, 04:54 ]
Post subject:  Re: Raw OpenGL with Horde3D

I haven't done this myself in any of the newer versions of Horde, but I think you can add your own GL calls in your main loop AFTER the call to h3dFinalizeFrame.
Something like:
Code:
init
while(!exit)
{
  render
  finalize

  custom GL Stuff
 
  swapBuffers
}
release


Here is another thread where people are discussing different GUI libraries to use with Horde:
http://www.horde3d.org/forums/viewtopic.php?f=2&t=169

Author:  Orm [ 13.10.2009, 05:00 ]
Post subject:  Re: Raw OpenGL with Horde3D

Thank you.

Author:  Orm [ 13.10.2009, 18:13 ]
Post subject:  Re: Raw OpenGL with Horde3D

I guess I should ask if there any examples of people using raw OpenGL with H3D. I have a project due at the end of the semester and I was hoping... nah forget it. I'll use raw OpenGL with GLFW and worry about Horde when I can.

Author:  Volker [ 13.10.2009, 19:42 ]
Post subject:  Re: Raw OpenGL with Horde3D

I use raw OpenGL in the editor. All you have to do is calling your OpenGL instructions AFTER calling h3dFinalizeFrame. And if you going to change OpenGL states, it might be a good idea to save some OpenGL attributes using
Code:
glPushAttrib(GL_COLOR_BUFFER_BIT | GL_CURRENT_BIT | GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT | GL_HINT_BIT | GL_LIGHTING_BIT);

and restore them after your GL calls with
Code:
glPopAttrib()

Author:  zoombapup [ 17.10.2009, 11:05 ]
Post subject:  Re: Raw OpenGL with Horde3D

Yeah, I draw my UI and debug geometry with raw GL calls. Most of the libs I use are happy with simple line/tri drawing functions for debug so it just works.

Author:  Orm [ 24.10.2009, 01:50 ]
Post subject:  oops i double posted

<snippity doo dah>

Author:  Orm [ 24.10.2009, 01:53 ]
Post subject:  Re: Raw OpenGL with Horde3D

Alright, so what about swapping buffers after doing all the drawing? Is that handled by Horde?

This is nice because I am working on a 2D engine to start and will be migrating to 3D after the semester is over while further expanding on it. I guess I won't have to scrap my 2D drawing classes after all. :lol: It's my math classes that are going to be a pain. :x

Author:  swiftcoder [ 24.10.2009, 01:55 ]
Post subject:  Re: Raw OpenGL with Horde3D

Orm wrote:
Alright, so what about swapping buffers after doing all the drawing? Is that handled by Horde?
Take a look at the samples - that sort of thing is always handled by the client application. Horde doesn't take over your runloop.

Author:  Orm [ 24.10.2009, 05:41 ]
Post subject:  Re: Raw OpenGL with Horde3D

swiftcoder wrote:
Horde doesn't take over your runloop.

Excellent. That answers pretty much every single question I could ever have about this engine. :twisted:

If I may make a suggestion, you may want to explicitly state that in the documentation. If I missed such a statement, please let me know, but I'm pretty sure it's not said there.

Author:  Mirytabel [ 16.11.2009, 13:19 ]
Post subject:  Re: Raw OpenGL with Horde3D

I tried to insert this code:


// Finish rendering of frame
h3dFinalizeFrame();


glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

glPushMatrix();
glTranslatef(0.5,0.5,-0.2);
glutSolidSphere(0.2,50,50);
glPopMatrix();
glFlush();


// Remove all overlays
h3dClearOverlays();


I can see a sphere, but it seems to "follow the camera": even if I move the camera position, the sphere remains in the same area of the screen. I'd like to place it on the grass plane, is it possible?

Attachments:
screen2.jpg
screen2.jpg [ 264.86 KiB | Viewed 20077 times ]
screen1.jpg
screen1.jpg [ 232.04 KiB | Viewed 20077 times ]

Author:  Volker [ 16.11.2009, 13:30 ]
Post subject:  Re: Raw OpenGL with Horde3D

Have a look at the GLWidget of the Editor:

in the renderEditorInfo method you can find
Code:
   
   const float* camera = 0;
   // Retrieve camera position...      
   h3dGetNodeTransMats(m_activeCameraID, 0, &camera);   

   // In case of an invalid camera (e.g. pipeline not set) return   
   if ( !camera ) return;   

   // ... and projection matrix
   float projMat[16];
   h3dGetCameraProjMat( m_activeCameraID, projMat );

   // ...
 
   // Set projection matrix
   glMatrixMode( GL_PROJECTION );
   glLoadMatrixf( projMat );
   // apply camera transformation
   glMatrixMode( GL_MODELVIEW );
   QMatrix4f transMat( camera );
   glLoadMatrixf( transMat.inverted().x );

   // then later in e.g. drawGizmo

   glPushMatrix();
   glMultMatrixf(nodeTransform);   // Load scene node matrix

   // ... draw code

   glPopMatrix();

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/