Vojta's picture

Every k-th polygon missing

Project:The Open Toolkit library
Version:1.x-dev
Component:Code
Category:support request
Priority:minor
Assigned:Vojta
Status:closed
Description

Hi
I have a mysterious problem with GLcontrol. If you have any idea, please help:
I use GLcontrol with Windows Forms (C++/CLI) to visualize a large 2D grid of cells of possibly different colors. If there are few thousands of rectangles, there appears some regular series of them (the period differs each run of the program) which are not drawn on the screen. When the GLcontrol is redrawn, then the set of missing rectangles differs, but the interval remains.
My redrawing procedure:

void paint()
{
     GL::Clear(ClearBufferMask::ColorBufferBit | ClearBufferMask::DepthBufferBit);
     GL::ClearColor(Color::White);
     for (...)
          for (...)
          {
               GL::Color3(*actualColor)
               GL::Begin(BeginMode::Polygon);
               GL::Vertex2(... , ...);
               GL::Vertex2(... , ...);
               GL::Vertex2(... , ...);
               GL::Vertex2(... , ...);	
               GL::End();
          }
     glControl->SwapBuffers();
}

I know nothing about insides of GL-stuff.
Please, help!
Vojta

PS: On the screenshot you can see an example of "missing line" of rectangles (they are four, small and white):
missing rectangles


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Inertia's picture

#1

Category:task» support request
Priority:normal» minor

Do the polygons still disappear if you Disable(CullFace)?

Vojta's picture

#2

They don't! Thank you very much, you are the best :)

Inertia's picture

#3

For completeness: Those few missing quads are drawn clockwise, while the everything else is drawn counter-clockwise. They are there, but backface culling has removed them because it assumes the quads show away from the camera. Disabling backface culling just hid the problem, it's not gone.

Vojta's picture

#4

Oh, no! The problem is still there.
Yesterday it was just few of runs, in which it didn't happen (it seems to have bad hours and good hours).
I add the GL::Disable(EnableCap::CullFace); on various places, but now it is all the same.

Thanks for any other ideas
(i am sure that all my rectangles are drawn clockwise)
Vojta

Inertia's picture

#5

There's an excessive amount of draw calls, does this change anything?

GL::Begin(BeginMode::Polygon);
for (...)
          for (...)
          {
               GL::Color3(*actualColor)            
               GL::Vertex2(... , ...);
               GL::Vertex2(... , ...);
               GL::Vertex2(... , ...);
               GL::Vertex2(... , ...);	           
          }
GL::End();

Also: what OS and Gfx card/driver do you use? ^^

Vojta's picture

#6

Yes, it does.. Did you really mean that? If there is just one Begin() and one End() for whole paint, there are no rectangles, just nonsense triangles. I think it is like there is just one big self-crossing polygon.

I use a laptop.. Is this what you want to know?:
Mobile Intel GM965 Express Chipset with integrated 3D graphics,
featuring Intel Graphics Media Accelerator (GMA) X3100 with up to 358/3845 MB of Intel Dynamic Video Memory Technology 4.0 (8 MB of dedicated system memory, up to 350/3765 MB of shared system memory), supporting Microsoft DirectX 9

Thank you,
Vojta

Inertia's picture

#7

...that's what you get for copy&paste code ;) Use BeginMode::Quads

Vojta's picture

#8

I is still there.. maybe slightly less often, but it is there. I made also an experiment with QuadStrip, and noticed:
- just a part of a strip was missing (not necessary on it's begin or end)
- the regularity is independent on GL::Clear. Whenever there were 100 horizontal strips (each consists of 99 quads), on every 37-th paint the beginning of 56-th strip was corrupt.

So it behaves very independently and regularly.. like it was very low-level issue.. am I right?

Thank you very much
Vojta

Inertia's picture

#9

Please run the Examples.exe and paste the log from OpenGL Diagnostics. Old Intel OpenGL drivers are known to be horrible, but the diagnostics may list some other useful max. values too.

Vojta's picture

#10

I think I found how to go through it! When there are no quads crossing the visible area (no negative or too big coordinates), the problem disappears.
(...)
EDIT: Hmm.. Now it seems I was wrong again. I experimented with just one amount of cells, and for this specific amount it is OK.. but for less of them (!) it is bad. I will look on examples.