Native OpenGL code inside Ogre

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Jian
Gnoblar
Posts: 14
Joined: Wed Dec 10, 2003 10:37 am
Location: Taiwan
Contact:

Post by Jian »

Hi Assaf Raman.

I think your native OpenGL demo need glEnable (GL_BLEND); somewhere in the code.

regards,
jian
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Post by Assaf Raman »

Jian wrote:Hi Assaf Raman.

I think your native OpenGL demo need glEnable (GL_BLEND); somewhere in the code.

regards,
jian
Well jian, this demo is only to give the general direction and intended for very advance users that know their way around OpenGL or d3d9, I am not going to work on making it prefect, you should consider the demo a quick and dirty code snippet.

If anyone wants to clean the demo code and re-post it – you are welcome and you will get my thanks.
Watch out for my OGRE related tweets here.
marinogiuse
Gnoblar
Posts: 9
Joined: Fri Jul 25, 2008 11:53 am

Post by marinogiuse »

I resolved the problem of the window focus. Hoping it can be useful I'm putting here my code. I've modified the ExampleApplication::go() function. Instead of the mRoot->startRendering function call, I've wrote this:

Code: Select all

while(1){
   Ogre::WindowEventUtilities::messagePump();
   if (mWindow->isActive())
      if(!mRoot->renderOneFrame()) break;
   else if (mWindow->isVisible()){ 
      mRoot->_fireFrameStarted();
      mRoot->_updateAllRenderTargets();
      mWindow->update(); 
      mRoot->_fireFrameEnded();
   } 
}
Giuseppe
zhipeng deng
Gnoblar
Posts: 4
Joined: Sun May 22, 2011 2:55 pm

Re: Native OpenGL code inside Ogre

Post by zhipeng deng »

Assaf Raman wrote:I was surprised to discover this much interest in a single demo, so I decided to extend it to also include native d3d9 code in the hope it will help someone in the future.

Here it is: NativeRenderGLAndD3d9.zip
Hello Assaf Raman,I put your method inside Ogre with D3d,but when i enable SHADOWTYPE_TEXTURE_MODULATIVE it will draw some strange shadow,do you meet the same problem?
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: Native OpenGL code inside Ogre

Post by Assaf Raman »

It is complicated to mix shadows with this sample, you really need to know what you are doing.
Watch out for my OGRE related tweets here.
zhipeng deng
Gnoblar
Posts: 4
Joined: Sun May 22, 2011 2:55 pm

Re: Native OpenGL code inside Ogre

Post by zhipeng deng »

Assaf Raman wrote:It is complicated to mix shadows with this sample, you really need to know what you are doing.
this is really a complicated thing,i think i will know how to solve it when knowing the Ogre Inner more.
but i need put D3D with shader into Ogre now,it meets many problems,do you know where i can find some demo code?
zhipeng deng
Gnoblar
Posts: 4
Joined: Sun May 22, 2011 2:55 pm

Re: Native OpenGL code inside Ogre

Post by zhipeng deng »

with your code,i had draw a scene inisde Ogre with D3D with shader(the z-coordinate needed to turn negative number for viewmatrix to calculate),thank you!
Robadob
Gnoblar
Posts: 5
Joined: Tue Apr 08, 2014 11:12 am
Location: Sheffield, UK

Re: Native OpenGL code inside Ogre

Post by Robadob »

-snip, issue was me passing null pointer to AddRenderQueueListener, it now works :) -
Last edited by Robadob on Thu Apr 17, 2014 1:14 pm, edited 1 time in total.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: Native OpenGL code inside Ogre

Post by Assaf Raman »

No clue.
Watch out for my OGRE related tweets here.
Robadob
Gnoblar
Posts: 5
Joined: Tue Apr 08, 2014 11:12 am
Location: Sheffield, UK

Re: Native OpenGL code inside Ogre

Post by Robadob »

-snip, invalid assumptions when debugging my issue-

Edit 3: It appears that the Ogre Access Violation 0x000.. may have been caused by me passing a null pointer to addRQListener, before I'd initialised my RQListener. It now runs fine :), Just can't see any of the 500 objects that I'm supposed to be rendering :/

Edit4: Was getting shader attributes passed in wrong order, it now works; :) :)
Edit5: Doesn't look too bad now I've setup a basic frag shader.
Image
Last edited by Robadob on Sat Apr 19, 2014 12:26 am, edited 1 time in total.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: Native OpenGL code inside Ogre

Post by Assaf Raman »

Good
Watch out for my OGRE related tweets here.
rybykvj
Gnoblar
Posts: 5
Joined: Wed Oct 15, 2014 3:47 am
x 1

Re: Native OpenGL code inside Ogre

Post by rybykvj »

Wow, this is exactly what I've been looking for, thanks Assaf!
ilotuo
Gnoblar
Posts: 16
Joined: Wed Nov 04, 2015 7:55 am

Re: Native OpenGL code inside Ogre

Post by ilotuo »

VERY NICE!
I have been looking this for several days!.
User avatar
randomcode
Halfling
Posts: 53
Joined: Wed Nov 11, 2015 11:31 am
Location: People's Republic of China
x 5
Contact:

Re: Native OpenGL code inside Ogre

Post by randomcode »

Is there any way to do such thing in MOGRE?

I have a idea:
1. Write Native C++ code for this thing and wrap it into a plugin
2. Use CLI to wrap the code into .Net
3. Call this in the C#
OpenMB(Open Source Mount&Blade Series)
https://github.com/cookgreen/OpenMB
User avatar
Zonder
Ogre Magi
Posts: 1168
Joined: Mon Aug 04, 2008 7:51 pm
Location: Manchester - England
x 73

Re: Native OpenGL code inside Ogre

Post by Zonder »

randomcode wrote: Sun May 03, 2020 12:20 pm Is there any way to do such thing in MOGRE?

I have a idea:
1. Write Native C++ code for this thing and wrap it into a plugin
2. Use CLI to wrap the code into .Net
3. Call this in the C#
This is probably the safest way and most performant.
There are 10 types of people in the world: Those who understand binary, and those who don't...
Post Reply