Native OpenGL code inside Ogre
-
- Gnoblar
- Posts: 14
- Joined: Wed Dec 10, 2003 10:37 am
- Location: Taiwan
- Contact:
- Assaf Raman
- OGRE Team Member
- Posts: 3092
- Joined: Tue Apr 11, 2006 3:58 pm
- Location: TLV, Israel
- x 76
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.Jian wrote:Hi Assaf Raman.
I think your native OpenGL demo need glEnable (GL_BLEND); somewhere in the code.
regards,
jian
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.
-
- Gnoblar
- Posts: 9
- Joined: Fri Jul 25, 2008 11:53 am
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:
Giuseppe
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();
}
}
-
- Gnoblar
- Posts: 4
- Joined: Sun May 22, 2011 2:55 pm
Re: Native OpenGL code inside Ogre
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?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
- Assaf Raman
- OGRE Team Member
- Posts: 3092
- Joined: Tue Apr 11, 2006 3:58 pm
- Location: TLV, Israel
- x 76
Re: Native OpenGL code inside Ogre
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.
-
- Gnoblar
- Posts: 4
- Joined: Sun May 22, 2011 2:55 pm
Re: Native OpenGL code inside Ogre
this is really a complicated thing,i think i will know how to solve it when knowing the Ogre Inner more.Assaf Raman wrote:It is complicated to mix shadows with this sample, you really need to know what you are doing.
but i need put D3D with shader into Ogre now,it meets many problems,do you know where i can find some demo code?
-
- Gnoblar
- Posts: 4
- Joined: Sun May 22, 2011 2:55 pm
Re: Native OpenGL code inside Ogre
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!
-
- Gnoblar
- Posts: 5
- Joined: Tue Apr 08, 2014 11:12 am
- Location: Sheffield, UK
Re: Native OpenGL code inside Ogre
-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.
- Assaf Raman
- OGRE Team Member
- Posts: 3092
- Joined: Tue Apr 11, 2006 3:58 pm
- Location: TLV, Israel
- x 76
-
- Gnoblar
- Posts: 5
- Joined: Tue Apr 08, 2014 11:12 am
- Location: Sheffield, UK
Re: Native OpenGL code inside Ogre
-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.
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.
Last edited by Robadob on Sat Apr 19, 2014 12:26 am, edited 1 time in total.
- Assaf Raman
- OGRE Team Member
- Posts: 3092
- Joined: Tue Apr 11, 2006 3:58 pm
- Location: TLV, Israel
- x 76
-
- Gnoblar
- Posts: 5
- Joined: Wed Oct 15, 2014 3:47 am
- x 1
Re: Native OpenGL code inside Ogre
Wow, this is exactly what I've been looking for, thanks Assaf!
-
- Gnoblar
- Posts: 16
- Joined: Wed Nov 04, 2015 7:55 am
Re: Native OpenGL code inside Ogre
VERY NICE!
I have been looking this for several days!.
I have been looking this for several days!.
- 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
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#
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
https://github.com/cookgreen/OpenMB
- Zonder
- Ogre Magi
- Posts: 1168
- Joined: Mon Aug 04, 2008 7:51 pm
- Location: Manchester - England
- x 73
Re: Native OpenGL code inside Ogre
This is probably the safest way and most performant.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#
There are 10 types of people in the world: Those who understand binary, and those who don't...