wx.wxmax2D missing file?
BlitzMax Forums/OpenGL Module/wx.wxmax2D missing file?
| ||
I testing the "C:\BlitzMax\mod\wx.mod\samples\glmax2d.bmx" I change the code to use: Type MyCanvas Extends wxWindow and Not: Type MyCanvas Extends wxGLCanvas I have no file contain wxGLCanvas 'drawClock() SuperStrict Framework wx.wxApp Import wx.wxFrame Import brl.Blitz Import wx.wxmax2D Import wx.wxTimer Import wx.wxPanel New MyApp.run() Type MyApp Extends wxApp Field Max2D:TWello Field panel:wxPanel Field canvas:MyCanvas Method onInit:Int() Max2D = TWello(New TWello.Create(, 1, "Max2D", 100, 100, 800, 600, wxSYSTEM_MENU | wxRESIZE_BORDER | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxCLOSE_BOX | wxCAPTION)) panel = New wxPanel.Create(Max2D, 2, 10, 10, 500, 500) SetTopWindow(Max2D) canvas = MyCanvas(New MyCanvas.CreateWin(panel, 3, 20, 20, 460, 460)) Return True End Method End Type ' --------------------------------------------------------------------------------[TWello]--- Type TWello Extends wxFrame Method OnInit:Int() Self.show(True) End Method End Type ' ------------------------------------------------------------------------------------------- ' ------------------------------------------------------------------------------------------- ' ------------------------------------------------------------------------------------------- Type MyCanvas Extends wxWindow Field timer:wxTimer Method OnInit:Int() SetBackgroundStyle(wxBG_STYLE_CUSTOM) timer = New wxTimer.Create(Self) ConnectAny(wxEVT_PAINT, OnPaint) ConnectAny(wxEVT_TIMER, OnTick) timer.Start(30) End Method Function OnPaint(event:wxEvent) Local canvas:MyCanvas = MyCanvas(event.parent) SetGraphics wxGraphics(canvas) SetLineWidth(2) ' SetClsColor(255, 0, 0) Cls SetColor(255, 0, 255) DrawRect(100,10, 10, 10) DrawLine(100, 30, 200, 30) SetColor(255, 0, 0) DrawRect(120,10, 10, 10) DrawLine(100, 40, 200, 40) SetColor(0, 255, 0) DrawRect(140,10, 10, 10) DrawLine(100, 50, 200, 50) SetColor(255, 0, 255) DrawRect(160,10, 10, 10) DrawLine(100, 60, 200, 60) SetColor(255, 0, 0) DrawText("Red", 10, 30) SetColor(0, 255, 0) DrawText("Green", 10, 50) SetColor(0, 0, 255) DrawText("Blue", 10, 70) Flip End Function Function OnTick(event:wxEvent) wxWindow(event.parent).Refresh() End Function End TypeThis setup the surface SetColor is working for DrawLine and DrawText DrawRect wait a interation before change color SetClsColor don't work at all Cls set white background always I probably get those error/problem when using: Type MyCanvas Extends wxWindow This is the original:"C:\BlitzMax\mod\wx.mod\samples\glmax2d.bmx" I get this Error message: Compile Error: Identifier 'CanvasGraphics2D' not found Build Error: failed to compile (-1) C:/BlitzMax/mod/wx.mod/samples/glmax2d.bmx on line: 76 SetGraphics(CanvasGraphics2D(Self)) SuperStrict Framework wx.wxApp Import wx.wxFrame Import brl.Blitz Import brl.glmax2d Import wx.wxmax2D Import wx.wxGLCanvas Import wx.wxTimer Import wx.wxPanel SetGraphicsDriver GLMax2DDriver() New MyApp.run() Type MyApp Extends wxApp Field frame:MyFrame Method OnInit:Int() ' Create the main application windowType MyFrame Extends wxFrame frame = MyFrame(New MyFrame.Create(,,"", , , 640, 480)) ' Show it and tell the application that it's our main window frame.show(True) SetTopWindow(frame) Return True End Method End Type Type MyFrame Extends wxFrame Field canvas:MyCanvas Method OnInit() canvas = MyCanvas(New MyCanvas.Create(Self, -1, GRAPHICS_BACKBUFFER|GRAPHICS_DEPTHBUFFER)) ConnectAny(wxEVT_CLOSE, OnClose) End Method Function OnClose(event:wxEvent) MyFrame(event.parent).canvas.timer.Stop() ' we really need to stop the timer on Mac... event.Skip() End Function End Type Type MyCanvas Extends wxGLCanvas Field timer:wxTimer Method OnInit() SetBackgroundStyle(wxBG_STYLE_CUSTOM) timer = New wxTimer.Create(Self) ConnectAny(wxEVT_TIMER, OnTick) timer.Start(100) End Method Method OnPaint(event:wxPaintEvent) Render() End Method Method Render() SetGraphics(CanvasGraphics2D(Self)) ' <-------------------------- :: CanvasGraphics2D is Missing for me! SetClsColor(255, 0, 0) SetColor(0, 0, 0) Cls drawClock() Flip End Method Function OnTick(event:wxEvent) wxWindow(event.parent).Refresh() End Function Method drawClock() SetLineWidth(2) Local x:Int = 200, y:Int = 200 Local radius:Int = 100 ' clock ticks For Local i:Int = 0 Until 12 Local inset:Double = 0 If i Mod 3 = 0 Then SetLineWidth(2) inset = 0.2 * radius Else inset = 0.1 * radius SetLineWidth(1) End If DrawLine x + (radius - inset) * Cos(i * 30), y + (radius - inset) * Sin(i * 30), .. x + radius * Cos(i * 30), y + radius * Sin (i * 30) ' draw numbers inset = 0.3 * radius Local t:Int = (i + 2) Mod 12 + 1 DrawText romanNumerals(t), x + (radius - inset) * Cos(i * 30) - 7, y + (radius - inset) * Sin(i * 30) - 6 Next ' clock hands Local hours:Int = CurrentTime()[0..2].toInt() Mod 12 Local minutes:Int = CurrentTime()[3..5].toInt() Local seconds:Int = CurrentTime()[6..8].toInt() ' hour hand: ' the hour hand is rotated 30 degrees per hour + 1/2 a degree per minute ' SetLineWidth(4) DrawLine x, y, x + radius / 2 * Sin(30 * hours + minutes / 2.0), .. y + radius / 2 * -Cos(30 * hours + minutes / 2.0) ' minute hand: ' the minute hand is rotated 6 degrees per minute + 1/10 a degree per second ' SetLineWidth(2) DrawLine x, y, x + radius * 0.75 * Sin(6 * minutes + seconds / 10.0), .. y + radius * 0.75 * -Cos(6 * minutes + seconds / 10.0) ' seconds hand: ' the second hand is rotated 6 degrees per second ' SetColor(255, 0, 0) DrawLine x, y, x + radius * 0.7 * Sin(6 * seconds), .. y + radius * 0.7 * -Cos(6 * seconds) End Method Method romanNumerals:String(value:Int) Local rn:String = "" While value > 9 rn:+ "X" value:- 10 Wend If value > 8 Then rn:+ "IX" value:- 9 End If If value > 4 Then rn:+ "V" value:- 5 End If If value > 3 Then rn:+ "IV" value:- 4 End If While value > 0 rn:+ "I" value:- 1 Wend Return rn End Method End TypeSomeone have a Import wx.wxmax2D Import wx.wxGLCanvas Example for me that is working? What file I need to update to get: CanvasGraphics2D |
| ||
Hi, you need to comment out 'Import brl.glmax2d'' and add 'Import wx.wxglmax2D' on top. -Henri |
| ||
Thank thee Henri with all my heart! I don't have wx.wxglmax2D So I download: https://github.com/maxmods/wx.mod wx.wxglmax2D is still Not included wx.mod only include: wxglcanvas.mod wxmax2d.mod Any idea, where I can download wx.wxglmax2D? I suppose wx.wxMax2D and wx.wxglmax2D is different? When I build the drawClock() example: "C:\BlitzMax\mod\wx.mod\samples\glmax2d.bmx" Compile Error: Identifier 'GLMax2DDriver' not found Build Error: failed to compile (-1) C:/BlitzMax/MOBii/Test/a29 Henri.bmx Code at the Error: Framework wx.wxApp Import wx.wxFrame Import brl.Blitz 'Import brl.glmax2d 'Import wx.wxglmax2D Import wx.wxMax2D 'Import brl.Graphics Import wx.wxGLCanvas Import wx.wxTimer Import wx.wxPanel SetGraphicsDriver(GLMax2DDriver()) New MyApp.run()GLMax2DDriver() and CanvasGraphics2D is probably in wx.wxglmax2D I got Munch example that look very interesting: "Okay, I adapted my previous example for your code. It still uses the same rendering "engine" from minib3d but now draws in 2d perspective. Needs spark.png." -Munch http://www.blitzbasic.com/Community/posts.php?topic=103695 But I am not sure hes example can be implemented on a wxWindow surface? |
| ||
I didn't remember that wxglmax2d was removed from repo in newer revisions. I'm guessing you should be using brl.glmax2d instead. See this thread for info -Henri |
| ||
http://www.blitzmax.com/Community/posts.php?topic=105601#1293241 I get this Error from Brucey's code: C:/BlitzMax/mod/wx.mod/wx.mod/../lib/win32/libwxmsw31u_gl.a(gllib_glcanvas.o):glcanvas.cpp:(.text+0x7aa): undefined reference to `_imp__wglGetCurrentDC@0' C:/BlitzMax/mod/wx.mod/wx.mod/../lib/win32/libwxmsw31u_gl.a(gllib_glcmn.o):glcmn.cpp:(.text+0x43c): undefined reference to `_imp__glVertex3f@12' C:/BlitzMax/mod/wx.mod/wx.mod/../lib/win32/libwxmsw31u_gl.a(gllib_glcmn.o):glcmn.cpp:(.text+0x46c): undefined reference to `_imp__glNormal3f@12' C:/BlitzMax/mod/wx.mod/wx.mod/../lib/win32/libwxmsw31u_gl.a(gllib_glcmn.o):glcmn.cpp:(.text+0x4a4): undefined reference to `_imp__glColor4f@16' C:/BlitzMax/mod/wx.mod/wx.mod/../lib/win32/libwxmsw31u_gl.a(gllib_glcmn.o):glcmn.cpp:(.text+0x4cc): undefined reference to `_imp__glColor3f@12' C:/BlitzMax/mod/wx.mod/wx.mod/../lib/win32/libwxmsw31u_gl.a(gllib_glcmn.o):glcmn.cpp:(.text+0x593): undefined reference to `_imp__glGetBooleanv@8' C:/BlitzMax/mod/wx.mod/wx.mod/../lib/win32/libwxmsw31u_gl.a(gllib_glcmn.o):glcmn.cpp:(.text+0xdb4): undefined reference to `_imp__glColor3f@12' C:/BlitzMax/mod/wx.mod/wx.mod/../lib/win32/libwxmsw31u_gl.a(gllib_glcmn.o):glcmn.cpp:(.text+0xfbf): undefined reference to `_imp__glIndexi@4' Build Error: Failed to link C:/BlitzMax/MOBii/Test/a33.debug.exeis those .o files made when I build the modules? Derron "Try the following:" SuperStrict Framework wx.wxApp Import wx.wxFrame Import wx.wxmax2D Import wx.wxTimer Import wx.wxPanel Import wx.wxRadioBox New MyApp.run() Type MyApp Extends wxApp Field frame:MyFrame Method OnInit:Int() ' Create the main application windowType MyFrame Extends wxFrame frame = MyFrame(New MyFrame.Create(,,"", , , 640, 480)) ' Show it and tell the application that it's our main window frame.show(True) SetTopWindow(frame) Return True End Method End Type Type MyFrame Extends wxFrame Field canvas:MyCanvas Method OnInit:Int() Local mainSizer:wxBoxSizer = New wxBoxSizer.Create(wxVERTICAL) SetSizer(mainSizer) canvas = MyCanvas(New MyCanvas.CreateWin(Self)) Local panel:wxPanel = New wxPanel.Create(Self, - 1) Local effecttypes:String[] = ["Point", "Area", "Line", "Ellipse"] Local ep_effect_type:wxRadioBox = New wxRadioBox.Create(panel, wxID_HIGHEST + 1, "Effect Type",,, ,, effecttypes) mainSizer.Add(canvas,1, wxALL | wxEXPAND) mainSizer.Add(panel,0,wxAll | wxExpand) ConnectAny(wxEVT_CLOSE, OnClose) End Method Function OnClose(event:wxEvent) MyFrame(event.parent).canvas.timer.Stop() ' we really need to stop the timer on Mac... 'not in your code 'wxWindow(event.parent).Destroy() ' remove the frame event.Skip() End Function End Type Type MyCanvas Extends wxWindow Field timer:wxTimer Field cw:Int Field ch:Int Method OnInit:Int() SetBackgroundStyle(wxBG_STYLE_CUSTOM) timer = New wxTimer.Create(Self) ConnectAny(wxEVT_PAINT, OnPaint) ConnectAny(wxEVT_TIMER, OnTick) connectany(wxEVT_SIZE, OnSize) timer.Start(1) End Method Function OnPaint(event:wxEvent) Local canvas:MyCanvas = MyCanvas(event.parent) canvas.Paint() End Function Method Paint() Render() Render() Render() End Method Function OnSize(Event:wxEvent) Local w:Int, h:Int MyCanvas(event.parent).GetSize(w, h) MyCanvas(event.parent).cw = w MyCanvas(event.parent).ch = h MyCanvas(event.parent).Refresh() End Function Method Render() SetGraphics wxGraphics(self) SetVirtualResolution(cw, ch) SetViewport(0, 0, cw, ch) SetClsColor(0, 0, 255) ' Background colod should be Blue Cls SetColor(0, 0, 255) ' all this rect is red? DrawRect(50,50, 10, 10) SetColor(0, 255, 0) DrawRect(70,50, 10, 10) SetColor(255, 0, 0) DrawRect(90,50, 10, 10) SetColor(255, 0, 255) DrawRect(110,50, 10, 10) drawClock() Flip End Method Function OnTick(event:wxEvent) wxWindow(event.parent).Refresh() End Function Method drawClock() SetLineWidth(2) Local x:Int = 200, y:Int = 200 Local radius:Int = 100 ' clock ticks For Local i:Int = 0 Until 12 Local inset:Double = 0 If i Mod 3 = 0 Then SetLineWidth(2) inset = 0.2 * radius Else inset = 0.1 * radius SetLineWidth(1) End If DrawLine x + (radius - inset) * Cos(i * 30), y + (radius - inset) * Sin(i * 30), .. x + radius * Cos(i * 30), y + radius * Sin (i * 30) ' draw numbers inset = 0.3 * radius Local t:Int = (i + 2) Mod 12 + 1 DrawText romanNumerals(t), x + (radius - inset) * Cos(i * 30) - 7, y + (radius - inset) * Sin(i * 30) - 6 Next ' clock hands Local hours:Int = CurrentTime()[0..2].toInt() Mod 12 Local minutes:Int = CurrentTime()[3..5].toInt() Local seconds:Int = CurrentTime()[6..8].toInt() ' hour hand: ' the hour hand is rotated 30 degrees per hour + 1/2 a degree per minute ' SetLineWidth(4) DrawLine x, y, x + radius / 2 * Sin(30 * hours + minutes / 2.0), .. y + radius / 2 * -Cos(30 * hours + minutes / 2.0) ' minute hand: ' the minute hand is rotated 6 degrees per minute + 1/10 a degree per second ' SetLineWidth(2) DrawLine x, y, x + radius * 0.75 * Sin(6 * minutes + seconds / 10.0), .. y + radius * 0.75 * -Cos(6 * minutes + seconds / 10.0) ' seconds hand: ' the second hand is rotated 6 degrees per second ' SetColor(255, 0, 0) DrawLine x, y, x + radius * 0.7 * Sin(6 * seconds), .. y + radius * 0.7 * -Cos(6 * seconds) End Method Method romanNumerals:String(value:Int) Local rn:String = "" While value > 9 rn:+ "X" value:- 10 Wend If value > 8 Then rn:+ "IX" value:- 9 End If If value > 4 Then rn:+ "V" value:- 5 End If If value > 3 Then rn:+ "IV" value:- 4 End If While value > 0 rn:+ "I" value:- 1 Wend Return rn End Method End TypeThis has the same Error as test original bmx: all the rect I added become red And I set SetClsColor(0, 0, 255) to blue, but the background still is white! if someone build this does background get blue and the squares get different background color? Or is the background White with red boxes? |