# OpenGL Quake 3 BSP rendering problem

This topic is 1514 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey guys & girls,

I am using an interesting code from http://www.paulsprojects.net/opengl/q3bsp/q3bsp.html ( great one ).

The problem is: when I try to use the complicated maps I get something like this ( a lot of triangles not shown ). But interesting thing is that some MORE complicated maps are rendering fine ( but anyways, you can see small missing triangles ). Problem is not in "Bezier" patches and tesselations. If I use original application file with map file I get the same problem, - missing triangles.

( Rendering on iOS, same problem everywhere ):

Maybe someone already got fixed it? I just can't find the proper problem.. I tried changing GL_TRIANGLES to different combinations, still nope.

Edited by NekoCode

##### Share on other sites

You're not using triangle strips, are you?  If so, that's part of your problem.  I've ran into this before, and fixed it by using GL_TRIANGLES appropriately.  I can't remember exactly what I did, but it's more complicated than just switching to GL_TRIANGLES.  It's best to use indexed vertices and triangle lists for most things, except patches; you should use strips for those.  Sadly, most Q3 BSP renderers don't do this correctly, and this is a fairly common problem.

I have one that I wrote years ago, but it uses Direct3D, not OpenGL.  I can dig that up if it helps.

Shogun.

##### Share on other sites

You're not using triangle strips, are you?  If so, that's part of your problem.  I've ran into this before, and fixed it by using GL_TRIANGLES appropriately.  I can't remember exactly what I did, but it's more complicated than just switching to GL_TRIANGLES.  It's best to use indexed vertices and triangle lists for most things, except patches; you should use strips for those.  Sadly, most Q3 BSP renderers don't do this correctly, and this is a fairly common problem.

I have one that I wrote years ago, but it uses Direct3D, not OpenGL.  I can dig that up if it helps.

Shogun.

I tried GL_TRIANGLE_STRIP, same result.

Could you show vertex/face generation and rendering code please?

##### Share on other sites

I'm sorry, I meant to ask if you were using GL_TRIANGLE_FAN, because there are lots of tutorials that use this, which doesn't work on many of the modern and more advanced maps.

Interestingly enough, I googled "quake3 bsp Direct3D" and I dug up a thread where I helped someone with the exact same issue.  I posted my code there, and the entire thread is worth reading.  Link: http://www.gamedev.net/topic/638950-problem-rendering-quake-3-bsp-files/

Let me know if this helps.

Shogun.

##### Share on other sites

As I said in first post, - I've tried all gl_triangle combinations.

Uh and also seems like I found my problem: there are MESHES and VERTICES. I am using OpenGL 3 which requires Vertex array generation. But meshes wasn't using this.

EDIT: Woot, that's strange... I got everything working on iOS ( Open GL ES 3.0, allows render without glVertexArrays ). And still missing triangles on desktop OpenGL 3.0 which REQUIRES glVertexArrays. Tried to glBindBuffer/glBindVertexArray in drawing loop on desktop opengl, - still nothing. Damn!

Almost solved.

Edited by NekoCode

##### Share on other sites

Well, I wasn't saying that switching to GL_TRIANGLE_WHATEVER would automatically fix it.  It's dependent on how your vertex data is stored/ordered after reading it from the .bsp.  Also, since I haven't seen your code, I can only guess as to what your problem is based on what others have had before.

Can you elaborate on why OpenGL ES 3.0 "allows" rendering without glVertexArrays and core OpenGL 3.x DOES require glVertexArrays?  As I suggested before, I recommend using indexed vertices if you haven't already.  That saved me tremedous headache.

Shogun.

##### Share on other sites

Fixed it by making another loadface method without categorizing, like how it's made:

enum {
polygon=0,
mesh,
patch,
billboard
};


And what I did is just fread face data and use it.

blueshogun96, I was wrong. glDrawElements is a problem, I was needed to bind GL_ELEMENT_ARRAY_BUFFER with data. Actually glVertexArray wasn't generated while I was using it on OpenGL ES 3.0, but still it was rendering meshes, but nothing on OpenGL 3.0 Core.

Thanks for the help!

Edited by NekoCode

##### Share on other sites

so you are telling that what? you load only face data (not mesh data) and draw it unindexed with good results)?

1. 1
2. 2
3. 3
Rutin
14
4. 4
khawk
11
5. 5

• 9
• 9
• 11
• 11
• 23
• ### Forum Statistics

• Total Topics
633671
• Total Posts
3013268
×