| View previous topic :: View next topic |
| Author |
Message |
LarryTM
Joined: 04 Jul 2006 Posts: 30
|
Posted: Wed Jul 05, 2006 1:02 am Post subject: PSPGL and DepthTesting problem. |
|
|
Hi,
I've enabled gl_depth_test, gl_cull_face, disabled blending, and when i try to display few objects placed one after another i have no depth testing at all. Here is the screenshot :
Why? Here is my code :
| Code: |
glEnable(GL_LIGHTING);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glShadeModel(GL_FLAT);
glColor4f(1,1,1,1);
glDepthFunc(GL_LESS);
glDisable(GL_BLEND);
glBindTexture(GL_TEXTURE_2D,mojetekstury[4]);
glPushMatrix();
glRotatef(ile,0,0,1);
glColor4f(1,1,1,1);
glPushMatrix();
glTranslatef(0,2,0);
glRotatef(-ile*4,1,0,0);
for (float a=0;a<10;a++)
{
glPushMatrix();
glRotatef(360.0 * float(a) / 10.f,1,0,0);
glTranslatef(0,2,0);
Tube01();
glPopMatrix();
}
glPopMatrix();
glPopMatrix();
|
Tube01() is just a object drawing rutine (object converted with polytrans to opengl code).
Can anyone knows why i dont have eny depth testing?
/lar |
|
| Back to top |
|
 |
ffelagund
Joined: 16 Mar 2006 Posts: 14
|
Posted: Wed Jul 05, 2006 2:59 am Post subject: |
|
|
Hello,
Have you cleared the depth buffer at the beginning of each frame?
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); _________________ I dont know... flight casual! |
|
| Back to top |
|
 |
LarryTM
Joined: 04 Jul 2006 Posts: 30
|
Posted: Wed Jul 05, 2006 3:12 am Post subject: |
|
|
Yes, and i've noticed another strange problem :
When i display an object - everything looks fine, but when i rotate this object (about 180 degrees) it looks very messy - like when the gl_cull_face is disabled.
/lar |
|
| Back to top |
|
 |
memon
Joined: 03 Oct 2005 Posts: 63
|
Posted: Wed Jul 05, 2006 3:37 am Post subject: |
|
|
| Do you set glDepthMask? Try setting it to GL_TRUE. |
|
| Back to top |
|
 |
LarryTM
Joined: 04 Jul 2006 Posts: 30
|
Posted: Wed Jul 05, 2006 4:31 am Post subject: |
|
|
yes, that did nothing. :(
/lar |
|
| Back to top |
|
 |
ffelagund
Joined: 16 Mar 2006 Posts: 14
|
Posted: Wed Jul 05, 2006 5:22 am Post subject: |
|
|
I dont know if this is implemented in PSPGL, but try: glGetIntegerv(GL_DEPTH_BITS,&a); to see if you truly have a depth buffer. _________________ I dont know... flight casual! |
|
| Back to top |
|
 |
LarryTM
Joined: 04 Jul 2006 Posts: 30
|
Posted: Wed Jul 05, 2006 5:51 am Post subject: |
|
|
glGetIntegerv(GL_DEPTH_BITS,&a) returns 16;
edit: I've rotated all the objects (in 180 degrees) and now it looks good - with depth testing, but thats doesnt solve the problem with cullfacing. :/ maybe its something with normals? but on PC (radeon 9800 pro) those objects looks fine.
/lar |
|
| Back to top |
|
 |
Jim

Joined: 02 Jul 2005 Posts: 487 Location: Sydney
|
Posted: Wed Jul 05, 2006 7:54 am Post subject: |
|
|
Is Tube01() using GL_QUADS with more than one quad between glBegin and glEnd? GL_QUADS isn't supported properly.
Jim _________________ http://www.dbfinteractive.com |
|
| Back to top |
|
 |
LarryTM
Joined: 04 Jul 2006 Posts: 30
|
Posted: Wed Jul 05, 2006 9:17 am Post subject: |
|
|
No, its uses olny GL_TRIANGLES.
/lar |
|
| Back to top |
|
 |
ffelagund
Joined: 16 Mar 2006 Posts: 14
|
Posted: Wed Jul 05, 2006 5:41 pm Post subject: |
|
|
I think that the error should be in the Tube01 function, because the rest seems to be ok. Could you paste here that func? (it is not neccesary to paste the data arrays) _________________ I dont know... flight casual! |
|
| Back to top |
|
 |
LarryTM
Joined: 04 Jul 2006 Posts: 30
|
Posted: Thu Jul 06, 2006 12:29 am Post subject: |
|
|
Ok, here is test source file with one rotating object - compiled & src. Its the same error with cull facing.
http://www.temporary.art.pl/test.zip
/lar |
|
| Back to top |
|
 |
LarryTM
Joined: 04 Jul 2006 Posts: 30
|
Posted: Thu Jul 06, 2006 11:46 pm Post subject: |
|
|
Anyone? Please - its very important to me.
/lar |
|
| Back to top |
|
 |
ffelagund
Joined: 16 Mar 2006 Posts: 14
|
Posted: Fri Jul 07, 2006 3:30 am Post subject: |
|
|
Sorry LarryTM, currently I lost my RHEL4 partition (viva linux!) due a filesystem corruption error, so I cant test your app. Now I'm installing cygwin and the pspsdk (again). As soon as I have the dev environment running, I'll check your sources. _________________ I dont know... flight casual! |
|
| Back to top |
|
 |
LarryTM
Joined: 04 Jul 2006 Posts: 30
|
Posted: Fri Jul 07, 2006 3:34 am Post subject: |
|
|
I will be very thankful to you.
edit: I think i solved the problem.
I have bad gluPerspective definition :
gluPerspective(45.0f,(GLfloat)Width/(GLfloat)Height,0.0f,100.0f);
the correct one is
gluPerspective(45.0f,(GLfloat)Width/(GLfloat)Height,0.1f,100.0f);
Anyway - thanks for your support and help.
/lar |
|
| Back to top |
|
 |
dot_blank

Joined: 28 Sep 2005 Posts: 498 Location: Brasil
|
Posted: Sat Jul 08, 2006 11:19 am Post subject: |
|
|
also note you have 1000000 constants
for your tube _________________ 10011011 00101010 11010111 10001001 10111010 |
|
| Back to top |
|
 |
|