PDA

View Full Version : Possible Bug: Canvas::draw_point method is not drawing the point at (0,0)



Renann Prado
02-13-2014, 06:55 PM
Hi.

I was testing the ClanLib 3.0.1 from this package: ClanLib-VC11Precompiled-static-mt-Win32-3.0.1.zip

When I try to draw the pixel at (0,0) with the draw_point of the canvas, the pixel is not shown on screen.
On the screenshot below I've drawn a pixel at (0,1) (please zoom the imagem at top left corner), but if I draw the pixel at (0,0), I can't see the pixel on screen.
Is this a bug of the ClanLib or am I doing something wrong?

Canvas class: https://github.com/renannprado/ClanLib/blob/master/Sources/Display/2D/canvas.cpp?source=cc
My TicTacToe (Hello World) project: https://github.com/renannprado/tictactoegame/blob/master/Sources/basic2d.cpp (please take a look at line 65)


26744

Thanks

rombust
02-17-2014, 09:41 PM
You probably won't get any responses, mainly because nobody uses this function.

In theory, draw_point(x,y) should draw to (x,y) in clanD3D, clanGL (legacy or opengl 3.2+) and clanSWRender.

I am not sure why it doesn't. (I haven't got time to explore why).

All the RenderBatchers (points, lines and triangles) use similar code. I'm not sure why it breaks for just points.

Sources\Display\2D\render_batch_*.cpp contains the batchers

The reason nobody uses the function is because, by nature it's slow when drawing numerous points. If drawing over 1000 points (of a pixel in size) it's better to use a custom shader and use gc.draw_primitives(type_points, ....)
If drawing points larger than a pixel, point sprites are an option ( Examples\Display_Render\PointSprite\Sources\app.cp p is an example, although that example could be written better )