You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would you like to volunteer to help with OpenGL support to xnec2c? Read on:
This first-pass implementation partially renders antenna patterns in OpenGL. Hurray! While the OpenGL work has been started, it needs some polish (ahem, quite a bit of polish)...plus, this is a feature that the original xnec2c author, Neoklis 5B4AZ, has always wanted.
-Eric, KJ7LNW
GOALS!
OpenGL for:
Radiation Pattern
E/H Field Pattern and animation
Physical Structure
Click to rotate the object
Mouse wheel to zoom
Middle click to pan
Shift+click to rotate light sources around the object
Transparency when clicking to rotate.
An optional transparent grid plane at (x,y)=0
Shaders
I'm open to any cool shader ideas you might have
It could be neat to have one or more light sources such that the light sources can rotate around the radiation pattern (or structure) with shift-click+drag.
Getting Started
git clone https://github.com/KJ7LNW/xnec2c.git
cd xnec2c
git checkout opengl
./autogen.sh
./configure
make
./src/xnec2c -j4 examples/airplane.nec
Once it loads:
Enable the "View->Radiation Pattern" checkbox and click "Gain Pattern" button on the "Radiation Patterns" window
When it loads there should be a small "GLArea Test" window. Resize the window to a reasonable size for your display.
The "GLArea Test" window will only update when "Radiation Patterns" is rotated.
To interact with the GLArea Test window, click and drag in the "Radiation Patterns" window (not the "GLArea Test" window) to change the OpenGL view.
To change the scale, use your mouse wheel to zoom over the "Radiation Patterns" window (not the "GLArea Test" window) and then rotate it so the GL window will redraw.
If you would prefer to start fresh then I'm okay with that, the opengl branch is here as a reference in case it is useful. Ultimately your new branch would replace this current opengl branch and ultimately get merged into master.
A new opengl.c and .h file should be created to store code for:
camera
arcball
vertex generation from NEC2 structures (from rad_pattern, see how rdpat_points or point_3d is created for colorization in Draw_Radiation_Pattern, but do it in a more "opengl-friendly way").
GTK UI hooks for pan/scale/rotate
other GL stuff
A function from opengl.c for generating radition pattern vertexes should be hooked into src/draw_radiation.c:Draw_Radiation_Pattern().
Currently that logic is hard-coded into Draw_Radiation_Pattern() but that was just a convenient place to put it while testing. See the commits to understand what changed.
Right now the OpenGL data vertex structure is updated every time it is redrawn. This is unnecessary for OpenGL because the video card will handle it. The structure should be regenerated only when the frequency data is recalculated (like when the select frequency is changed).
The current triangle creation logic isn't quite right and the radiation pattern isn't so clean. Note that theta is the azimuth and theta=0 is pointing in the direction of Z+! This is just how NEC2 was designed back in 1981...
The configure.ac file should detect OpenGL libraries and link them as necessary. Some of this has been done already.
CGLM should be a git submodule if it is not already
If you prefer a different vector/matrix math library vs CGLM then I'm open to it; it looked like CGLM was a good place to start since xnec2c is written in C, not in C++.
Maintain shader version 1.20 support for older distributions, right now we don't need anything fancy.
To the extent possible, widgets should be maintained as GTK Builder objects and expressed as XML in resources/xnec2c.glade. However, it might be easier to open-code as a first pass with gtk API calls and refactor into XML later.
Generally speaking, we want to support deployment on any system that is still supported under long-term support by the distribution vendor. For example Oracle Linux 8 is supported until 2029, and it runs GTK 3. That means we cannot cut over to GTK 4 without backwards compatibility support.
If there are GTK4 features that would be nice to add, then that would be great, however they need to be detected by Autoconf in configure.ac and appropriate #ifdef checks need to be placed in the code so that it will still compile on older distributions.
HELP WANTED
Would you like to volunteer to help with OpenGL support to xnec2c? Read on:
This first-pass implementation partially renders antenna patterns in OpenGL. Hurray! While the OpenGL work has been started, it needs some polish (ahem, quite a bit of polish)...plus, this is a feature that the original xnec2c author, Neoklis 5B4AZ, has always wanted.
-Eric, KJ7LNW
GOALS!
Getting Started
git clone https://github.com/KJ7LNW/xnec2c.git cd xnec2c git checkout opengl ./autogen.sh ./configure make ./src/xnec2c -j4 examples/airplane.nec
Once it loads:
Development Considerations
There is a work-in-progress branch for OpenGL support using CGLM which you can see in this commit comparison: master...opengl . The branch is here: https://github.com/KJ7LNW/xnec2c/tree/opengl
If you would prefer to start fresh then I'm okay with that, the opengl branch is here as a reference in case it is useful. Ultimately your new branch would replace this current
opengl
branch and ultimately get merged intomaster
.rad_pattern
, see howrdpat_points
orpoint_3d
is created for colorization in Draw_Radiation_Pattern, but do it in a more "opengl-friendly way").src/draw_radiation.c:Draw_Radiation_Pattern()
.Draw_Radiation_Pattern()
but that was just a convenient place to put it while testing. See the commits to understand what changed.configure.ac
file should detect OpenGL libraries and link them as necessary. Some of this has been done already.resources/xnec2c.glade
. However, it might be easier to open-code as a first pass with gtk API calls and refactor into XML later.References
The text was updated successfully, but these errors were encountered: