Legacy GM [CLOSED] Thin Gap Between Two Triangles Forming a Trapezoid

D

Default User

Guest
Graphical issue that isn't really a programming issue, but it doesn't really fit with the technical support questions either... so I thought it would be best to just put it here.

GameMaker does not have a built in function to draw a trapezoid, so what I did was I drew two triangles like this (pseudocode)...

draw_triangle(bottom-left point, top-left point, bottom-right point, not an outline);
draw_triangle(bottom-right point, top-right point, top-left point, not an outline);
// Points may be in slightly different order​

But sometimes the triangles (rarely and while their moving) have a very thin gap between them, and it happens even more when the trapezoid is on top of a color that it contrasts well with.

I am using AA and screen sync, but turning them off doesn't help. It happens no matter the screen size/mode.

Normal:

Gap problem:

Hard to see in this small picture, and it's not the worst case scenario.

Please tell me if you know anything I can enable/disable that would fix this issue, thanks!
 

Attachments

D

Default User

Guest
Use a triangle strip instead of two separate triangles.

See: 2D Primitives
I can't use a triangle strip (because I need the triangles to be able to separate), but a triangle list might work. I was originally doing it this way, but decided against it because of how much lines of code it added (there is already quite a bit of code).
Due to how much coding I've already done, switching to this method would require a lot of work, is there any way I can fix this issue without switching my drawing method?

Edit: Technically I don't need the triangles to be able to separate (in fact that was a straight up lie/excuse), I just really don't want to have to rewrite all of the code for drawing the triangles (which trust me, is a lot). This is a good solution, but I'd rather it be a last case scenario.
 
Last edited by a moderator:
D

Default User

Guest
Round your points for the triangles.
Finding and replacing most of the variables affecting the points with "round(variable)" causes the triangles to shake (round their points) very noticeably. The gap problem was still happening, but I didn't round everything (and I'm not going to, because even if it does fix the gap it isn't worth the shaking effect). Thanks anyways!
 

Roa

Member
You say it happens at any resolution? And you're sure you disabled AA ? Maybe try changing the vertex mode to be more compatible under the graphic options?

You sure you dont have default driver forced AA on your card or something?? You weren't messing around in catalyst or Nvidia control panal recently with another game?
 
D

Default User

Guest
You say it happens at any resolution? And you're sure you disabled AA ? Maybe try changing the vertex mode to be more compatible under the graphic options?

You sure you dont have default driver forced AA on your card or something?? You weren't messing around in catalyst or Nvidia control panal recently with another game?
Yes, the game (ALL of the game) is being drawn to the GUI and is setup so you can play it in windowed mode and drag the window size (which also affects the GUI size) to any resolution you want (below your maximum display size obviously). I have tried it with and without AA, and I haven't been messing around with the Nvidia control panel (I checked it too, and no AA is being forced). I'm not using vertex processing, and turning it on using all the methods didn't fix the issue. (I've tried different synchronization settings as well, and that didn't fix it.)
 

Roa

Member
I honestly just assume they are drawn with vertex under the table. That would be the efficient thing for yoyo to implement.

Do you have interpolation on? That would cause it if its drawn in a way like a texture or sprite page. This happens with tiles and stuff too because of interpolation grabbing transparency from neighboring pixels.I literally cant imagine it being anything else at that point.

you can disable it in windows global setting under graphics or call texture_set_interpolation(false)
 
D

Default User

Guest
I honestly just assume they are drawn with vertex under the table. That would be the efficient thing for yoyo to implement.

Do you have interpolation on? That would cause it if its drawn in a way like a texture or sprite page. This happens with tiles and stuff too because of interpolation grabbing transparency from neighboring pixels.I literally cant imagine it being anything else at that point.

you can disable it in windows global setting under graphics or call texture_set_interpolation(false)
I forgot to put in my first post that I have interpolation on, but have already turned it off and on to check if it was the problem. Also, all of the game is made up of drawn shapes (no sprites).
 

Roa

Member
Ok, well then its a scaling issue somehow. Its probably not staying pixel for pixel ratio when its being scaled and it borrows inccorect space. Someone wrote in better detail why this happens.

I would just go with @FrostyCat 's suggestion. (still not use to that new user name) in using vertex data.
 
D

Default User

Guest
Ok, well then its a scaling issue somehow. Its probably not staying pixel for pixel ratio when its being scaled and it borrows inccorect space. Someone wrote in better detail why this happens.

I would just go with @FrostyCat 's suggestion. (still not use to that new user name) in using vertex data.
I've had the scaling issue many times in the past... many... many dark times... but I don't think it's the issue now, based on the way I'm drawing the game.
I'm going to try and see what I can do, and will update this thread when I finish.

Thanks for the replies!
 
D

Default User

Guest
Thanks for your replies, sorry for not updating this thread. I tried using triangle strips but had the same issue, so instead I did a messy fix and drew a line across the gaps.
 
Top