Original post address: http://www.cevx.com/bbs/viewthread.php? Tid = 11343 & Highlight = OpenGL
Construct an OpenGL programming environment in VxWorks
I. Preface
The famous OpenGL API mainly serves to draw the specified elements to the Frame Buffer Based on the camera settings.
Mesa is a specific implementation of OpenGL. The current version is 7.0.2.
DRI is a direct render infrustructure ). Sub-projects with graphics cards such as ATI r300
Mesa was originally designed for UNIX/X11. Mesa's implementation of OpenGL is purely software without hardware acceleration, so the frame rate is low when running 3D graphics.
DRI provides a secure interface for Mesa (and other OpenGL implementations) to securely use the hardware acceleration feature provided by the video card.
Wind River's support for Mesa seems to have stopped updating in 5.0. Currently, the code for running 3D in windml in mesa7.0.2 is still n years ago.
However, it is sufficient for beginners such as OpenGL, learning space, projection transformation, illumination, texture, and display list.
So I wrote this post to let everyone know how to start entering the OpenGL world under VxWorks and learn the basic concepts of OpenGL.
To really develop applications, you must use DRI, which is out of the scope of this article.
2. Preparations
My development environment is
Tornado 2.2.
VX 3, 5.5
Windml 3.0
Mesa 4.0 (download later)
3. Compile the Mesa for windml 3D graphics library
Download Mesa 4.0 and decompress it to C:/tornado 2.2/target/src.
Directory structure
In tornado, create a downloadable project based on simntgnu
Add all the following source files to your project.
#### GL #####
(Main Graphics Library)
Gl_sources =/
Api_arrayelt.c/(under C:/tornado2.2/target/src/MESA/src)
Api_loopback.c/
Api_noop.c/
Api_validate.c/
Accum. c/
Attrib. c/
Blend. c/
Buffers. c/
Clip. c/
Colortab. c/
Config. c/
Context. c/
Convolve. c/
Debug. c/
Depth. c/
Dispatch. c/
Dlist. c/
Drawpix. c/
Enable. c/
Enums. c/
Eval. c/
Extensions. c/
Feedback. c/
Fog. c/
Get. c/
Glapi. c/
Glthread. c/
Hash. c/
Hint. c/
Histogram. c/
Image. c/
Imports. c/
Light. c/
Lines. c/
Matrix. c/
Mem. c/
Mmath. c/
Pixel. c/
Points. c/
Polygon. c/
Rastpos. c/
State. c/
Stencel. c/
Texformat. c/
Teximage. c/
Texobj. c/
Texstate. c/
Texstore. c/
Texutil. c/
Varray. c/
Vtxfmt. c/
X86/x86.c/(C:/tornado2.2/target/src/MESA/src/x86)
X86/common_x86.c/
X86/3dnow. c/
X86/SSE. c/
Math/m_debug_clip.c/(C:/tornado2.2/target/src/MESA/src/math)
Math/m_debug_norm.c/
Math/m_debug_vertex.c/
Math/m_debug_xform.c/
Math/m_eval.c/
Math/m_matrix.c/
Math/m_translate.c/
Math/m_vector.c/
Math/m_vertices.c/
Math/m_xform.c/
Array_cache/ac_context.c/(C:/tornado2.2/target/src/MESA/src/array_cache)
Array_cache/ac_import.c/
Swrast/s_aaline.c/(C:/tornado2.2/target/src/MESA/src/swrast)
Swrast/s_aatriangle.c/
Swrast/s_accum.c/
Swrast/s_alpha.c/
Swrast/s_alphabuf.c/
Swrast/s_bitmap.c/
Swrast/s_blend.c/
Swrast/s_buffers.c/
Swrast/s_copypix.c/
Swrast/s_context.c/
Swrast/s_depth.c/
Swrast/s_drawpix.c/
Swrast/s_feedback.c/
Swrast/s_fog.c/
Swrast/s_histogram.c/
Swrast/s_imaging.c/
Swrast/s_lines.c/
Swrast/s_logic.c/
Swrast/s_masking.c/
Swrast/s_pb.c/
Swrast/s_pixeltex.c/
Swrast/s_points.c/
Swrast/s_readpix.c/
Swrast/s_scissor.c/
Swrast/s_span.c/
Swrast/s_stencil.c/
Swrast/s_texture.c/
Swrast/s_texstore.c/
Swrast/s_triangle.c/
Swrast/s_zoom.c/
Swrast_setup/ss_context.c/
Swrast_setup/ss_triangle.c/
Swrast_setup/ss_vb.c/
Tnl/t_array_api.c/(C:/tornado2.2/target/src/MESA/src/tnl)
Tnl/t_array_import.c/
Tnl/t_context.c/
Tnl/t_eval_api.c/
Tnl/t_imm_alloc.c/
Tnl/t_imm_api.c/
Tnl/t_imm_debug.c/
Tnl/t_imm_dlist.c/
Tnl/t_imm_elt.c/
Tnl/t_imm_eval.c/
Tnl/t_imm_exec.c/
Tnl/t_imm_fixup.c/
Tnl/t_pipeline.c/
Tnl/t_vb_fog.c/
Tnl/t_vb_light.c/
Tnl/t_vb_normals.c/
Tnl/t_vb_points.c/
Tnl/t_vb_render.c/
Tnl/t_vb_texgen.c/
Tnl/t_vb_texmat.c/
Tnl/t_vb_vertex.c
##### Ugl #####
Ugl_sources =/
Windml/ugl_api.c/(C:/tornado2.2/target/src/MESA/src/windml)
Windml/ugl_dd.c/
Windml/ugl_span.c/
Windml/ugl_line.c/
Windml/ugl_tri.c/
Windml/tornado/tormesauglinit. C (C:/tornado2.2/target/src/MESA/src/windml/tornado)
##### OS #####
OS _sources =/
Osmesa/osmesa. C/(C:/tornado2.2/target/src/MESA/src/osmesa)
Windml/tornado/tormesaosinit. C (C:/tornado2.2/target/src/MESA/src/windml/tornado)
##### Fig #####
Glushapes_sources =/
Windml/ugl_glushapes.c/(C:/tornado2.2/target/src/MESA/src/windml)
Windml/tornado/torglushapesinit. C (C:/tornado2.2/target/src/MESA/src/windml/tornado)
##### Glu #####
Glu_sources =/
Glu. C/(under C:/tornado2.2/target/src/MESA/src-Glu)
Mipmap. c/
OpenGL. c/
Nurbscrv. c/
Nurbssrf. c/
Nurbsutl. c/
Polytest. c/
Project. c/
Quadric. c/
Tess. c/
Tesselat. c/
../Src/windml/tornado/tormesagluinit. C (under C:/tornado2.2/target/src/MESA/src/windml/tornado)
Create a GL folder under C:/tornado2.2/target/h to store the OpenGL header file)
Run the following command under C:/tornado2.2/target/src/MESA/include /:
Copy Gl. H, glext. H, Glu. H, osmesa. H, uglglushapes. H, and uglmesa. H to the created GL folder.
After completing the above work
Change the C/C ++ compiler option in the tornado project builds tab and add include path...
Add the following path
C:/tornado2.2/target/src/MESA/include
C:/tornado2.2/target/src/MESA/src
Change the Rules tab to archive to generate the. A file.
Then you can compile it. After the compilation is successful, it will generate. A in your project directory.
4. Build a VxWorks Project
Create a VxWorks project based on the simpc BSP
The Complete 2D graphics library of windml and simulator host devices and simulator graphics components are included in VxWorks.
Compile your VxWorks
If you do not know this step, you can search for the installation and compilation of windml in the Forum.
5. Run the demo program
Create a downloadable project based on the simntgnu tool chain
Taking uglteapot as an Example
Add uglteapot. C under C:/tornado2.2/target/src/MESA/windmldemos to the Project
Modify ugl_false in taskspawn to ugl_true, as shown below:
Void uglteapot (void)
{
Taskspawn ("tteapot", 210, vx_fp_task, 100000, (funcptr) windmlteapot,
Ugl_true, 1, 2, 3, 4, 5, 6, 7, 8, 9 );
}
Change the Marcos option on the tornado project builds Tab
Add the generated. A Path to prj_libs.
My options are C:/tornado2.2/target/proj/mesalib/simntgnu/mesalib..
Then compile the project and generate. Out
Run the generated VxWorks
Start a shell
Download. Out
Run the uglteapot command in shell.
The following are the running results:
You can press the left and right keys to rotate the teapot, and press the K key to turn off the light 1, etc.
Press ESC to exit
Post a few more running demos
Vi. Summary
You can also test your demo in VxWorks under VMware.
However, due to the lack of double easing, there is a problem with graphic display.
The display in simpc is normal, but the speed is very slow.
The environment has been set up.
You can refer to the process in the demo to write your own demo to learn OpenGL.
Go to Tony embedded Forum, http://www.cevx.com/bbs/thread-11343-1-1.html