URL
https://opencores.org/ocsvn/orsoc_graphics_accelerator/orsoc_graphics_accelerator/trunk
Subversion Repositories orsoc_graphics_accelerator
Compare Revisions
- This comparison shows the changes necessary to convert path
/orsoc_graphics_accelerator/trunk/sw
- from Rev 9 to Rev 8
- ↔ Reverse comparison
Rev 9 → Rev 8
/examples/bare/man.obj.h
File deleted
/examples/bare/uv.png.h
File deleted
/examples/bare/ocgfxmesh.c
1,57 → 1,113
#include "orgfx_plus.h" |
#include "orgfx_3d.h" |
#include "orgfx.h" |
#include "orgfx_bitmap_font.h" |
#include "orgfx_vector_font.h" |
#include <math.h> |
|
#include "man.obj.h" |
#include "uv.png.h" |
#include "cube.obj.h" |
#include "humanoid_tri.obj.h" |
#include "Bahamut_cc.png.h" |
#include "interptest.bmp.h" |
|
#include "franklin_font.h" |
#include "test_font.h" |
|
//#include "stdio.h" |
|
int main(void) |
{ |
int i,j; |
|
int text[] = {65, 228, 0}; |
|
// Initialize screen, no double buffering |
int screen = orgfxplus_init(640, 480, 16, 1, 1); |
int screen = orgfxplus_init(640, 480, 16, 1, 0); |
|
// Set up texture and mesh |
int uv_sprite = init_uv_sprite(); |
orgfx_mesh man_mesh = init_man_mesh(); |
orgfx3d_mesh_texture_size(&man_mesh, 128, 128); |
int bahamut_sprite = orgfxplus_init_surface(186, 248, Bahamut_cc); |
int interp_sprite = orgfxplus_init_surface(10, 10, interptest); |
|
// Bind the texture |
orgfxplus_bind_tex0(uv_sprite); |
int franklin_surface = orgfxplus_init_surface(512, 512, franklin_img); |
orgfx_tileset franklin_ts = orgfx_make_tileset(franklin_surface, franklin_glyphs, 256); |
orgfx_bitmap_font franklin_font = orgfx_make_bitmap_font(&franklin_ts, 5, 16); |
|
// orgfx_mesh mesh = orgfx3d_make_mesh(cube_faces, cube_nfaces, cube_verts, cube_nverts); |
// orgfx_mesh mesh = orgfx3d_make_mesh(humanoid_tri_faces, humanoid_tri_nfaces, humanoid_tri_verts, humanoid_tri_nverts); |
|
float rad = 0; |
int i; |
int t = 0; |
|
orgfxplus_colorkey(0xf81f, 1); |
|
orgfx_point3 offset = {350, 300, 0}; |
orgfx_point3 scale = {10.0, 10.0, 10.0}; |
|
// orgfxplus_clip(50,50,100,100, 0); |
// orgfx_enable_cliprect(1); |
|
|
// vector fonts |
orgfx_vector_font font = init_test_font(); |
|
while(1) |
{ |
orgfx_point3 translation = {200, 300, 0}; |
orgfx_point3 rotation = {M_PI,rad,0}; |
orgfx_point3 scale = {100.0, 100.0, 100.0}; |
/* |
orgfx_point3 rot = {2*rad,rad,3*rad}; |
|
mesh.scale = scale; |
mesh.translation = offset; |
mesh.rotation = rot; |
*/ |
// Clear screen |
orgfxplus_fill(0,0,640*FIXEDW,480*FIXEDW,0xffff); |
|
for(i = 0; i < 5000000; ++i); |
/* |
orgfx3d_draw_mesh(&mesh, 1, 1); |
|
// Clear the depth buffer |
orgfx_clear_zbuffer(); |
orgfx_enable_zbuffer(1); |
orgfxplus_fill(0,0,100*FIXEDW,100*FIXEDW,0x0000); |
|
// Draw wireframe |
orgfx3d_draw_mesh(&man_mesh, translation, rotation, scale, 0, 0); |
translation.x += 150; |
orgfx_enable_tex0(1); |
orgfxplus_bind_tex0(bahamut_sprite); |
orgfx_uv(0,0,180,0,90,100); |
orgfx_triangle(0,0,100*FIXEDW,0,50*FIXEDW,100*FIXEDW, 1); |
orgfx_enable_tex0(0); |
|
// Draw filled |
orgfx3d_draw_mesh(&man_mesh, translation, rotation, scale, 1, 0); |
translation.x += 150; |
orgfx_set_colors(0xf800, 0x07c0, 0x003f); |
orgfx_triangle(0,100*FIXEDW,100*FIXEDW,100*FIXEDW,50*FIXEDW,200*FIXEDW, 1); |
// orgfx_enable_tex0(0); |
orgfx_triangle(100*FIXEDW,0,200*FIXEDW,0,150*FIXEDW,100*FIXEDW, 0); |
|
// Draw textured |
orgfx3d_draw_mesh(&man_mesh, translation, rotation, scale, 1, 1); |
orgfx_enable_zbuffer(0); |
orgfx_curve(200*FIXEDW,0,300*FIXEDW,0,250*FIXEDW,100*FIXEDW, |
0, 1); |
|
// Rotate meshes |
orgfx_curve(300*FIXEDW,0,400*FIXEDW,0,350*FIXEDW,100*FIXEDW, |
0, 0); |
|
orgfxplus_alpha(0x80, 1); |
orgfxplus_draw_surface(100*FIXEDW, 100*FIXEDW, bahamut_sprite); |
orgfxplus_alpha(0xff, 0); |
// orgfx_enable_tex0(0); |
|
orgfx_put_text(&font, 10*FIXEDW, 200*FIXEDW, "some EXAMPLE text"); |
*/ |
|
orgfx_put_bitmap_text(&franklin_font, 10*FIXEDW, 200*FIXEDW, L"some ÅXÖMBLÄ text"); |
|
orgfx_vf_write(&font , L"some ÅXÖMBLÄ text", 10, 250, 0x0000); |
// draw interp-test |
orgfx_enable_tex0(1); |
orgfxplus_bind_tex0(interp_sprite); |
orgfx_uv(0,0,10,0,0,10); |
orgfx_triangle(0,0,200*FIXEDW,0,0*FIXEDW,200*FIXEDW, 1); |
orgfx_uv(10,0,10,10,0,10); |
orgfx_triangle(200*FIXEDW,0*FIXEDW,200*FIXEDW,200*FIXEDW,0*FIXEDW,200*FIXEDW, 1); |
orgfx_enable_tex0(0); |
|
orgfx_set_color(0xf800); |
//orgfx_line(0,0,200*FIXEDW,200*FIXEDW); |
|
t += 5; |
rad += 0.01; |
if(rad >= M_PI*2) rad -= M_PI*2; |
|
/examples/bare/demo.c
197,21 → 197,25
} |
case STATE_3D: |
{ |
orgfx_point3 translation = {200, 500, 0}; |
orgfx_point3 rotation = {-1.5,0,rad}; |
orgfx_point3 offset = {200, 500, 0}; |
orgfx_point3 scale = {25.0, 25.0, 25.0}; |
orgfx_point3 rot = {-1.5,0,rad}; |
|
orgfx3d_draw_mesh(&mesh, translation, rotation, scale, 0, 0); |
mesh.scale = scale; |
mesh.translation = offset; |
mesh.rotation = rot; |
|
orgfx3d_draw_mesh(&mesh, 0, 0); |
|
orgfx_clear_zbuffer(); |
for(i = 0; i < 1500000; ++i); |
|
orgfx_enable_zbuffer(1); |
|
translation.x += 300; |
rotation.z = -rad; |
mesh.translation.x += 300; |
mesh.rotation.z = -rad; |
|
orgfx3d_draw_mesh(&mesh, translation, rotation, scale, 1, 0); |
orgfx3d_draw_mesh(&mesh, 1, 0); |
|
orgfx_enable_zbuffer(0); |
break; |
/examples/bare/Makefile
22,13 → 22,13
or32-elf-gcc -o vgatest vgatest.c |
or32-elf-objcopy -O binary vgatest |
bin2binsizeword vgatest vgatest.bin |
mv vgatest.bin ../../../../../../ORGFXSoC/orpsocv2/boards/xilinx/atlys/backend/par/run/ |
mv vgatest.bin ../../../../orpsocv2/boards/xilinx/atlys/backend/par/run/ |
|
drivertest.bin: |
or32-elf-gcc -o drivertest drivertest.c $(INCLUDE) $(HW_SRC) |
or32-elf-objcopy -O binary drivertest |
bin2binsizeword drivertest drivertest.bin |
mv drivertest.bin ../../../../../../ORGFXSoC/orpsocv2/boards/xilinx/atlys/backend/par/run/ |
mv drivertest.bin ../../../../orpsocv2/boards/xilinx/atlys/backend/par/run/ |
|
drivertest: |
gcc -o drivertest drivertest.c $(INCLUDE) $(SW_SRC) $(SDL) |
37,7 → 37,7
or32-elf-gcc -o plustest plustest.c $(INCLUDE) $(HW_SRC) |
or32-elf-objcopy -O binary plustest |
bin2binsizeword plustest plustest.bin |
mv plustest.bin ../../../../../../ORGFXSoC/orpsocv2/boards/xilinx/atlys/backend/par/run/ |
mv plustest.bin ../../../../orpsocv2/boards/xilinx/atlys/backend/par/run/ |
|
plustest: |
gcc -o plustest plustest.c $(INCLUDE) $(SW_SRC) $(SDL) |
51,8 → 51,8
ocgfxmesh.bin: |
or32-elf-gcc -o ocgfxmesh ocgfxmesh.c $(INCLUDE) $(HW_SRC) $(3D_SRC) $(TILE_SRC) $(FONT_SRC) $(VFONT_SRC) -lm |
or32-elf-objcopy -O binary ocgfxmesh |
./bin2binsizeword ocgfxmesh ocgfxmesh.bin |
mv ocgfxmesh.bin ../../../../../../ORGFXSoC/orpsocv2/boards/xilinx/atlys/backend/par/run/ |
bin2binsizeword ocgfxmesh ocgfxmesh.bin |
mv ocgfxmesh.bin ../../../../orpsocv2/boards/xilinx/atlys/backend/par/run/ |
|
ocgfxmesh: |
gcc -o ocgfxmesh ocgfxmesh.c $(INCLUDE) $(SW_SRC) $(3D_SRC) $(TILE_SRC) $(FONT_SRC) $(VFONT_SRC) $(SDL) |
61,7 → 61,7
or32-elf-gcc -o demo demo.c $(INCLUDE) $(HW_SRC) $(3D_SRC) $(TILE_SRC) $(FONT_SRC) -lm |
or32-elf-objcopy -O binary demo |
bin2binsizeword demo demo.bin |
mv demo.bin ../../../../../../ORGFXSoC/orpsocv2/boards/xilinx/atlys/backend/par/run/ |
mv demo.bin ../../../../orpsocv2/boards/xilinx/atlys/backend/par/run/ |
|
demo: |
gcc -o demo demo.c $(INCLUDE) $(SW_SRC) $(3D_SRC) $(TILE_SRC) $(FONT_SRC) $(SDL) |