Search found 19 matches

by Rob190
Tue Sep 26, 2023 5:29 pm
Forum: C++ Development
Topic: Drawing text and then direct pixel manipulation of wxBitmap
Replies: 10
Views: 4001

Re: Drawing text and then direct pixel manipulation of wxBitmap

It's part of a bitmap font library for OpenGL. On startup, it draws each character into a bitmap, converts it to an image (not sure that's necessary but it was the only way I could get it to work when I wrote the original code 20+ years ago) and then uses it as a texture atlas. OpenGL texture knows...
by Rob190
Mon Sep 25, 2023 6:14 pm
Forum: C++ Development
Topic: Drawing text and then direct pixel manipulation of wxBitmap
Replies: 10
Views: 4001

Re: Drawing text and then direct pixel manipulation of wxBitmap

Thanks for the replies. Looking through my original code, it does actually test for the presence of alpha and I commented it to the effect that the behaviour was different in windows and OSX (OSX has alpha, windows does not). Looks to me like something is going wrong, or at least the documentation i...
by Rob190
Mon Sep 25, 2023 10:29 am
Forum: C++ Development
Topic: Drawing text and then direct pixel manipulation of wxBitmap
Replies: 10
Views: 4001

Re: Drawing text and then direct pixel manipulation of wxBitmap

Update: Just tried your example and it's not working on my system. It shows the same as my example. The red pixel is drawn but there's no text. How exactly do you test this? Can you save the result bitmap as PNG and post it here? And which wxWidgets version are you using? Version 3.2.2.1 PNG attach...
by Rob190
Mon Sep 25, 2023 8:34 am
Forum: C++ Development
Topic: Drawing text and then direct pixel manipulation of wxBitmap
Replies: 10
Views: 4001

Re: Drawing text and then direct pixel manipulation of wxBitmap

::wxInitAllImageHandlers(); wxBitmap bitmap(256, 256, 32); wxMemoryDC mem_dc(bitmap); mem_dc.SetBackground(*wxWHITE); mem_dc.Clear(); mem_dc.DrawText("ABC", 5, 5); mem_dc.SelectObject(wxNullBitmap); { // new block so that pixel_data gets destroyed when we're done here // single red pixel ...
by Rob190
Mon Sep 25, 2023 8:27 am
Forum: C++ Development
Topic: Drawing text and then direct pixel manipulation of wxBitmap
Replies: 10
Views: 4001

Re: Drawing text and then direct pixel manipulation of wxBitmap

Does the bitmap actually has alpha? Is (pixel_data) true? What platform? For example, on Windows, wxDC does not generally support alpha. Yes (pixel_data) is true. The actual code does: const Char_Pos& char_pos = char_positions [char_to_test]; wxAlphaPixelData pixel_data (bit_map); if (pixel_dat...
by Rob190
Sun Sep 24, 2023 10:12 pm
Forum: C++ Development
Topic: Drawing text and then direct pixel manipulation of wxBitmap
Replies: 10
Views: 4001

Drawing text and then direct pixel manipulation of wxBitmap

Hi, I have an app which renders text to a wxBitmap and then directly modifies the bitmap using a wxAlphaPixelData object. The problem is that I can do either one or the other but not both. It appears that creating the wxAlphaPixelData clears the bitmap, which is not what I want. The outine of the co...
by Rob190
Thu Aug 24, 2023 1:44 pm
Forum: C++ Development
Topic: Vertical sizer not expanding to full width
Replies: 3
Views: 487

Re: Vertical sizer not expanding to full width

sizer_panel_left_v->Add (sizer_panel_xxx_v, wxSizerFlags ().Border (wxTOP, 4)); // Want to expand sizer_panel_xxx_v horizontally to the width of sizer_panel_left_v Add .Expand() to the chain. Surprise ;) https://neume.sourceforge.net/sizerdemo/ Ah thanks! So I'd assumed Expand() only applied in the...
by Rob190
Thu Aug 24, 2023 11:49 am
Forum: C++ Development
Topic: Vertical sizer not expanding to full width
Replies: 3
Views: 487

Vertical sizer not expanding to full width

I have a problem where a vertical sizer is not being expanded horizontally to the width of the parent sizer (also a vertical sizer). The result is that the wxTextCtrl, on the RHS below, is not being expanded to the full width of the parent wxPanel. Capture.JPG The relevant code is below. The (x,y) v...
by Rob190
Sat Dec 31, 2022 1:49 pm
Forum: C++ Development
Topic: IPC works with DDE but hangs using TCP
Replies: 1
Views: 290

IPC works with DDE but hangs using TCP

I have an app that uses the IPC classes (wxConnection, wxClient, wxServer). It works fine with DDE but if I set #define wxUSE_DDE_FOR_IPC 0 then on Windows it hangs. However, if I step through both the client app and server app (using separate instances of MSVC), it works fine. It also runs OK on Ub...
by Rob190
Sun Nov 13, 2022 9:51 pm
Forum: Platform Related Issues
Topic: wxGLCanvas: Fails to create surface on Ubuntu
Replies: 4
Views: 2922

Re: wxGLCanvas: Fails to create surface on Ubuntu

Finally got it to work by installing the latest NVidia driver from the NV website. (Had to boot to the command line otherwise it just refused to install.) I was able to get some of the samples to run with the original driver but e.g. the penguin sample didn't actually show the penguin. I was running...
by Rob190
Sun Nov 13, 2022 10:20 am
Forum: Platform Related Issues
Topic: wxGLCanvas: Fails to create surface on Ubuntu
Replies: 4
Views: 2922

Re: wxGLCanvas: Fails to create surface on Ubuntu

Hi, Are you using wayland? What video card do you have? Are you building/testing under vm? Can you build and run any of the OpenGL samples? I also presume you are using latest release of wxWidgets... Thank you. Currently using X11. GPU is an NVidia GT610. (Old I know but it supports GL 4.2) Not a V...
by Rob190
Sat Nov 12, 2022 11:51 pm
Forum: Platform Related Issues
Topic: wxGLCanvas: Fails to create surface on Ubuntu
Replies: 4
Views: 2922

wxGLCanvas: Fails to create surface on Ubuntu

Hi, I'm attempting to port a number of windows apps to Ubuntu. They all compile and run under MSVC and also msys2 (gcc) in Windows but I've been unable to get any of them to run on Ubuntu. The error is always the same: ../src/unix/glegl.cpp(516): assert ""Assert failure"" failed ...
by Rob190
Tue Nov 09, 2021 2:58 pm
Forum: C++ Development
Topic: Customised menu item
Replies: 3
Views: 1411

Customised menu item

I have a pop-up menu for selecting fill patterns (+ a few other options). It works and I can set the bitmap to display the actual pattern in the menu items but the problem is that there are a lot of patterns so having a single list is awkward to use. What I'd like to do is to be able to replace the ...
by Rob190
Fri Apr 16, 2021 1:36 pm
Forum: C++ Development
Topic: wxGLCanvas/wxGLContext: How to query pixel format?
Replies: 5
Views: 1388

Re: wxGLCanvas/wxGLContext: How to query pixel format?

I found that OpenGL actually provides this functionality. There's a bit of complexity if you need it to work with both windows and FBOs but all the queries are there e.g. glGetNamedFramebufferAttachmentParameteriv (0, GL_FRONT_LEFT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &result); // Check this ...
by Rob190
Mon Mar 29, 2021 10:34 am
Forum: C++ Development
Topic: wxGLCanvas/wxGLContext: How to query pixel format?
Replies: 5
Views: 1388

Re: wxGLCanvas/wxGLContext: How to query pixel format?

No, wxWidgets doesn't provide a function for retrieving the pixel format (PF). Normally, this PF is the same the app asked for (the wxGLCanvas attributes). But you can can use MSW specific function GetPixelFormat , and use it with the HDC returned by wxGLCanvas::GetHDC() In my case, the app uses th...