BRL.Max2D - SetDrawMode
BlitzMax Forums/BlitzMax Module Tweaks/BRL.Max2D - SetDrawMode
| ||
Suggestion: Add SetDrawMode to the Max2D mod. See code for more info ... ' BRL.Max2D *suggested addition* ' ' SetDrawMode drawmode Global state_drawmode Const LINEMODE=GL_LINE Const DOTTEDMODE=GL_POINT Const FILLMODE=GL_FILL Rem bbdoc: Set current draw mode about: SetDrawMode controls how ovals and rectangles are drawn to the backbuffer.<p> @drawmode should be one of: <table> <tr><th>Draw mode</th><th>Effect</th> <tr><td>FILLMODE</td><td>Ovals and rectangles are drawn solid</td> <tr><td>LINEMODE</td><td>Ovals and rectangles are drawn unfilled</td> <tr><td>DOTTEDMODE</td><td>Ovals are drawn in dotted mode</td> </table> End Rem Function SetDrawMode(drawmode) If state_drawmode=drawmode Return state_drawmode=drawmode Select drawmode Case LINEMODE glPolygonMode(GL_FRONT, GL_LINE) Case DOTTEDMODE glPolygonMode(GL_FRONT, GL_POINT) Default glPolygonMode(GL_FRONT, GL_FILL) End Select End Function ' ********************************************** ' example Graphics 640,480,0 ' outlined SetDrawMode LINEMODE SetColor 200,0,0 DrawOval 80,60,70,110 ' dotted SetDrawMode DOTTEDMODE glPolygonMode(GL_FRONT, GL_POINT) SetColor 0,0,200 DrawOval 160,180,140,80 ' filled SetDrawMode FILLMODE SetColor 0,200,0 DrawOval 230,90,70,80 SetColor $ff,$ff,$ff DrawText "Example of filled, outlined, and dotted drawmodes" ,5,5 Flip WaitKey End Are there other drawmodes out there in OpenGL-Land though? (AND, OR, XOR etc .. ?) I only know of the three above. Or, maybe stick them in SetBlendMode ? |
| ||
GL_BACK - not FRONT? |
| ||
I've found you have to use GL_FRONT_AND_BACK if you want it to work with all the draw commands (for Win32 at least). Oh...Don't forget it's companion... Function GetDrawMode() Local params[2] glGetIntegerv(GL_POLYGON_MODE, params) Return params[0] End Function |