questio connected with "Lesson 26"
I have a plain and a few hundredes of items on it.
void MyPlane()
{
glBegin(GL_POLYGON);
glVertex3f(-1.5,0,-1.5);
glVertex3f(1.5,0,-1.5);
glVertex3f(1.5,0,1.5);
glVertex3f(-1.5,0,1.5);
glEnd();
}
void MyFigure(float ratio)
{
glPushMatrix();
glTranslated(0,ratio,0);
MyCylinder(ratio,ratio/2);
glTranslated(0,-ratio,0);
MyPrism(ratio,ratio,6);
glTranslated(0,-ratio/2,0);
MySp(ratio/3*2,ratio,0);
glPopMatrix();
}
void MyFigureS()
{
glTranslated(-1.5,0,-1.5);
for(int i=1;i<30;i++)
{
glTranslated(0.1,0,0);
for(int j=1;j<30;j++)
{
glTranslated(0,0,0.1);
MyFigure(0.04);
}
glTranslated(0,0,-2.9);
}
}
It's simple, but it's too slow :(. So I should use some cliping i think.
I found Lessons 26. I think i understood the main idea about mask of the "floor" & so on, but some ruses don't submit to me. Especially 2 times drowing the Object
Plz hlp...
PS If this theme was full discused at the forum...just give me link :)
PPS sorry 4 bad eng
There was some excellent code on frustum culling by a chap called Mark Morely but it appears to have vanished into the ether of bits. I'm in a rush just now but I shall try and dig it out when I get back home later and I shall stick it up for you. In the meantime, try Googling for "frustum culling" and that should help you somewhat.
Hope that helps!
Edit: Here we go, clicky. All praise the might of Google!
[Edited by - eSCHEn on February 21, 2006 11:44:28 AM]
Hope that helps!
Edit: Here we go, clicky. All praise the might of Google!
[Edited by - eSCHEn on February 21, 2006 11:44:28 AM]
--
Cheers,
Darren Clark
Cheers,
Darren Clark
As I know, Frustum culling allow us don't show object "outside the screen", but All my object is inside.
Or I'm not right?
Or I'm not right?
No you're quite right, frustum culling works by not rendering any object that is not part of the current viewing volume.
If all of your objects are on-screen at once then obviously frustum culling is not of much use. I would start by turning on back face culling, which will cause any triangle whose normal is facing a certain way to not be drawn. To do this you would use glEnable(GL_CULL_FACE); and you can choose which face is considered the 'back' by using glCullFace(GL_FRONT); and glCullFace(GL_BACK);. See if this helps you at all.
If back face culling doesn't help much then I would start to look into more complicated methods such as dynamic level of detail, where objects that are far from the camera are rendered using a lower amount of triangles. Another possibility would be occlusion rendering, where an object occludes everything that is behind it, presuming that you don't have transparency though.
I hope this helps you on your way mate. [smile]
If all of your objects are on-screen at once then obviously frustum culling is not of much use. I would start by turning on back face culling, which will cause any triangle whose normal is facing a certain way to not be drawn. To do this you would use glEnable(GL_CULL_FACE); and you can choose which face is considered the 'back' by using glCullFace(GL_FRONT); and glCullFace(GL_BACK);. See if this helps you at all.
If back face culling doesn't help much then I would start to look into more complicated methods such as dynamic level of detail, where objects that are far from the camera are rendered using a lower amount of triangles. Another possibility would be occlusion rendering, where an object occludes everything that is behind it, presuming that you don't have transparency though.
I hope this helps you on your way mate. [smile]
--
Cheers,
Darren Clark
Cheers,
Darren Clark
I don't know how much triangle functions like MySp() are trying to render, but it seems that this should run quite fast.
Is your program using software rendering for some reason, maybe?
On Linux, type: glxinfo | grep direct and see if it says "Direct rendering: yes".
On Windows: put
Hope this helps.
Is your program using software rendering for some reason, maybe?
On Linux, type: glxinfo | grep direct and see if it says "Direct rendering: yes".
On Windows: put
printf( "OpenGL vendor: %s\n", glGetString(GL_VENDOR) );
in your program. If it says something about Microsoft, try updating your video drivers.Hope this helps.
Quote: Original post by eSCHEn
To do this you would use glEnable(GL_CULL_FACE); and you can choose which face is considered the 'back' by using glCullFace(GL_FRONT); and glCullFace(GL_BACK);. See if this helps you at all.
[smile]
It doesn't help...
Quote: Original post by DaBono
On Windows: putin your program. If it says something about Microsoft, try updating your video drivers.printf( "OpenGL vendor: %s\n", glGetString(GL_VENDOR) );
Hope this helps.
OpenGL Vendor : (null)
I'm confused... :(
I would do some troubleshooting on the system now:
Hope that helps.
- What kind of video card do you have?
- Do you have drivers correctly installed for it?
- What results do you get from GLinfo? Something like "Microsoft Generic" would imply that your drivers are not installed correctly and you are running on the software renderer.
Hope that helps.
--
Cheers,
Darren Clark
Cheers,
Darren Clark
Quote: Original post by eSCHEn
I would do some troubleshooting on the system now:
- What kind of video card do you have?
- Do you have drivers correctly installed for it?
- What results do you get from GLinfo? Something like "Microsoft Generic" would imply that your drivers are not installed correctly and you are running on the software renderer.
Hope that helps.
I have normal video card & drivers (msi fx5700 256mb, 71.89 drivers)
I think problem is in code...I' m not home, I'll show all code tomorrow.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement