Horde3D

Next-Generation Graphics Engine
It is currently 28.03.2024, 11:01

All times are UTC + 1 hour




Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: Raw OpenGL with Horde3D
PostPosted: 13.10.2009, 03:31 
Offline

Joined: 09.09.2009, 18:58
Posts: 107
Possible?


Top
 Profile  
Reply with quote  
PostPosted: 13.10.2009, 03:45 
Offline

Joined: 08.11.2006, 03:10
Posts: 384
Location: Australia
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.


Top
 Profile  
Reply with quote  
PostPosted: 13.10.2009, 03:48 
Offline

Joined: 09.09.2009, 18:58
Posts: 107
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?


Top
 Profile  
Reply with quote  
PostPosted: 13.10.2009, 04:54 
Offline

Joined: 08.11.2006, 03:10
Posts: 384
Location: Australia
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


Top
 Profile  
Reply with quote  
PostPosted: 13.10.2009, 05:00 
Offline

Joined: 09.09.2009, 18:58
Posts: 107
Thank you.


Top
 Profile  
Reply with quote  
PostPosted: 13.10.2009, 18:13 
Offline

Joined: 09.09.2009, 18:58
Posts: 107
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.


Top
 Profile  
Reply with quote  
PostPosted: 13.10.2009, 19:42 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
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()


Top
 Profile  
Reply with quote  
PostPosted: 17.10.2009, 11:05 
Offline

Joined: 16.05.2009, 12:43
Posts: 207
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.


Top
 Profile  
Reply with quote  
 Post subject: oops i double posted
PostPosted: 24.10.2009, 01:50 
Offline

Joined: 09.09.2009, 18:58
Posts: 107
<snippity doo dah>


Last edited by Orm on 24.10.2009, 01:55, edited 2 times in total.

Top
 Profile  
Reply with quote  
PostPosted: 24.10.2009, 01:53 
Offline

Joined: 09.09.2009, 18:58
Posts: 107
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


Top
 Profile  
Reply with quote  
PostPosted: 24.10.2009, 01:55 
Offline

Joined: 22.11.2007, 17:05
Posts: 707
Location: Boston, MA
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.

_________________
Tristam MacDonald - [swiftcoding]


Top
 Profile  
Reply with quote  
PostPosted: 24.10.2009, 05:41 
Offline

Joined: 09.09.2009, 18:58
Posts: 107
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.


Top
 Profile  
Reply with quote  
PostPosted: 16.11.2009, 13:19 
Offline

Joined: 12.07.2009, 23:47
Posts: 8
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 20046 times ]
screen1.jpg
screen1.jpg [ 232.04 KiB | Viewed 20046 times ]
Top
 Profile  
Reply with quote  
PostPosted: 16.11.2009, 13:30 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
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();


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 30 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group