Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.0...3.9)
CMAKE_MINIMUM_REQUIRED(VERSION 3.9...3.31)
PROJECT(PHIGS)

if (APPLE)
Expand All @@ -9,6 +9,8 @@ if (APPLE)
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-ld_classic,-dead_strip")
endif()

set(OPENGL_GL_PREFERENCE "GLVND")

# Choose between Epoxy or GLEW
if (USE_GLEW)
set(USE_GLEW ON)
Expand Down
4 changes: 2 additions & 2 deletions src/libphigs/ws/wstx_ini.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ int init_devices(
idt->strokes[i].record.pets.pet_r1.unused = 0;
idt->strokes[i].record.buffer_size = 100;
idt->strokes[i].record.init_pos = 1;
idt->strokes[i].type = WST_LOC_TYPE_POINTER_BUTTON_1;
idt->strokes[i].type = WST_STROKE_TYPE_POINTER_BUTTON_1;
}
/* Default pick */
idt->num_devs.pick = WST_MAX_NUM_PICK_DEVS;
Expand All @@ -328,7 +328,7 @@ int init_devices(
idt->picks[i].num_pets = 1;
idt->picks[i].pets[0] = 1;
idt->picks[i].record.pets.pet_r1.unused = 0;
idt->picks[i].type = WST_LOC_TYPE_POINTER_BUTTON_1;
idt->picks[i].type = WST_PICK_TYPE_POINTER_BUTTON_1;
}
/* Default valuator */
idt->num_devs.val = WST_MAX_NUM_VALUATOR_DEVS;
Expand Down
2 changes: 1 addition & 1 deletion src/libphigs/ws/wsx.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ int phg_wsx_setup_tool_nodisp(
background.val.general.y = (float) green / 65535.0;
background.val.general.z = (float) blue / 65535.0;

glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &(ws->fbuf));
glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, (GLint *)&(ws->fbuf));

if (!wsgl_init(ws, &background, NUM_SELECTABLE_STRUCTS)) {
ERR_BUF(ws->erh, ERR900);
Expand Down
87 changes: 44 additions & 43 deletions src/libphigs/wsgl/wsgl.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ short int wsgl_use_shaders = 1;
/*******************************************************************************
* wsgl_init
*
* DESCR: Initialize renderer
* RETURNS: Non zero or zero on error
* DESCR: Initialize renderer
* RETURNS: Non zero or zero on error
*/

int wsgl_init(
Expand Down Expand Up @@ -118,8 +118,8 @@ int wsgl_init(
/*******************************************************************************
* wsgl_close
*
* DESCR: Close
* RETURNS: N/A
* DESCR: Close
* RETURNS: N/A
*/

void wsgl_close(
Expand All @@ -135,8 +135,8 @@ void wsgl_close(
/*******************************************************************************
* wsgl_set_window
*
* DESCR: Set render window coordinates
* RETURNS: N/A
* DESCR: Set render window coordinates
* RETURNS: N/A
*/
void wsgl_set_window(
Ws *ws,
Expand All @@ -152,8 +152,8 @@ void wsgl_set_window(
/*******************************************************************************
* wsgl_set_viewport
*
* DESCR: Set render window viewport
* RETURNS: N/A
* DESCR: Set render window viewport
* RETURNS: N/A
*/
void wsgl_set_viewport(
Ws *ws,
Expand All @@ -172,8 +172,8 @@ void wsgl_set_viewport(
/*******************************************************************************
* wsgl_set_hlhsr_mode
*
* DESCR: Set render depth mode
* RETURNS: N/A
* DESCR: Set render depth mode
* RETURNS: N/A
*/
void wsgl_set_hlhsr_mode(
Ws *ws,
Expand All @@ -189,8 +189,8 @@ void wsgl_set_hlhsr_mode(
/*******************************************************************************
* wsgl_clear
*
* DESCR: Clear render window
* RETURNS: N/A
* DESCR: Clear render window
* RETURNS: N/A
*/
void wsgl_clear(
Ws *ws
Expand All @@ -202,7 +202,9 @@ void wsgl_clear(
Phg_ret ret;
Pgcolr gcolr;
Wsgl_handle wsgl = ws->render_context;
/* try to get the background color from the color table entry for this ws */
char buffer[6];
char * xdg_session_type;
/* Try to get the background color from the color table entry for this ws */
phg_wsb_inq_LUT_entry(ws, 0, PINQ_REALIZED, PHG_ARGS_COREP, &ret, &gcolr, NULL);
if (ret.err == 0) {
wsgl->background.val.general.x = gcolr.val.general.x;
Expand All @@ -223,8 +225,13 @@ void wsgl_clear(
glXMakeContextCurrent(ws->display, ws->drawable_id, ws->drawable_id, ws->glx_context);
}
wsgl_clear_geometry();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (ws->has_double_buffer) {
xdg_session_type = getenv("XDG_SESSION_TYPE");
if (xdg_session_type){
strncpy(buffer, xdg_session_type, 5);
} else {
strncpy(buffer, "unkwn", 5);
}
if (ws->has_double_buffer && ( 0==strncmp(buffer, "x11", 3) || (0==strncmp(buffer, "tty", 3)))) {
#ifdef DEBUG
printf("Swapping buffers in clear\n");
#endif
Expand All @@ -236,13 +243,14 @@ void wsgl_clear(
#endif
glFlush();
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}

/*******************************************************************************
* wsgl_flush
*
* DESCR: Flush settings to render window
* RETURNS: N/A
* DESCR: Flush settings to render window
* RETURNS: N/A
*/
void wsgl_flush(
Ws *ws
Expand Down Expand Up @@ -347,8 +355,8 @@ void wsgl_flush(
/*******************************************************************************
* init_rendering_state
*
* DESCR: Initialize rendering state helper function
* RETURNS: N/A
* DESCR: Initialize rendering state helper function
* RETURNS: N/A
*/
static void init_rendering_state(
Ws *ws
Expand Down Expand Up @@ -396,8 +404,8 @@ static void init_rendering_state(
/*******************************************************************************
* wsgl_begin_rendering
*
* DESCR: Start a rendiering session for workstation
* RETURNS: N/A
* DESCR: Start a rendiering session for workstation
* RETURNS: N/A
*/
void wsgl_begin_rendering(
Ws *ws
Expand Down Expand Up @@ -426,8 +434,8 @@ void wsgl_begin_rendering(
/*******************************************************************************
* wsgl_end_rendering
*
* DESCR: End a rendiering session
* RETURNS: N/A
* DESCR: End a rendiering session
* RETURNS: N/A
*/
void wsgl_end_rendering(
Ws *ws
Expand All @@ -454,8 +462,8 @@ void wsgl_end_rendering(
/*******************************************************************************
* store_cur_struct
*
* DESCR: Store current structure information helper function
* RETURNS: N/A
* DESCR: Store current structure information helper function
* RETURNS: N/A
*/

static void store_cur_struct(
Expand All @@ -479,8 +487,8 @@ static void store_cur_struct(
/*******************************************************************************
* update_cur_struct
*
* DESCR: Update current structure information helper function
* RETURNS: N/A
* DESCR: Update current structure information helper function
* RETURNS: N/A
*/
static void update_cur_struct(
Ws *ws
Expand Down Expand Up @@ -545,8 +553,8 @@ static int check_draw_primitive(
/*******************************************************************************
* check_highlight_primitive
*
* DESCR: check if the current primitive is highlighted
* RETURNS: N/A
* DESCR: check if the current primitive is highlighted
* RETURNS: N/A
*/
static int check_highlight_primitive(
Ws *ws
Expand Down Expand Up @@ -575,8 +583,8 @@ static int check_highlight_primitive(
/*******************************************************************************
* wsgl_begin_structure
*
* DESCR: Mark the beginning of a new structure element
* RETURNS: N/A
* DESCR: Mark the beginning of a new structure element
* RETURNS: N/A
*/
void wsgl_begin_structure(
Ws *ws,
Expand Down Expand Up @@ -614,8 +622,8 @@ void wsgl_begin_structure(
/*******************************************************************************
* wsgl_end_structure
*
* DESCR: Mark the ending of a structure element
* RETURNS: N/A
* DESCR: Mark the ending of a structure element
* RETURNS: N/A
*/
void wsgl_end_structure(
Ws *ws
Expand Down Expand Up @@ -654,8 +662,8 @@ void wsgl_end_structure(
/*******************************************************************************
* wsgl_render_element
*
* DESCR: Render element to current workstation rendering window
* RETURNS: N/A
* DESCR: Render element to current workstation rendering window
* RETURNS: N/A
*/
void wsgl_render_element(
Ws *ws,
Expand Down Expand Up @@ -1373,16 +1381,9 @@ void wsgl_begin_pick(
printf("WSGL begin pick: set render mode to select\n");
printf("WSGL begin pick: buffer size is %d at %p\n", wsgl->select_size, (void*)wsgl->select_buf);
#endif
//glDisable(GL_CULL_FACE);
//glEnable(GL_DEPTH_TEST);
glRenderMode(GL_SELECT);
glInitNames();
/*
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
*/}
}

/*******************************************************************************
* wsgl_end_pick
Expand Down
11 changes: 7 additions & 4 deletions src/test_f/test_f1.f
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,18 @@ PROGRAM DRAWLINE
REAL PXA(1:2)
REAL PYA(1:2)

INTEGER IWK
PARAMETER (IWK=1)

C Open PHIGS and a workstation
CALL POPPH(0, 0)
CALL POPWK(0, 0, 0)
CALL POPPH(0, 1)
CALL POPWK(IWK, 0, 3)

C Define line colour in workstation table
COLR(1) = 1.0
COLR(2) = 1.0
COLR(3) = 0.0
CALL PSCR(0, 1, 3, COLR)
CALL PSCR(IWK, 1, 3, COLR)

C Open structure
CALL POPST(0)
Expand Down Expand Up @@ -70,7 +73,7 @@ PROGRAM DRAWLINE
CALL PCLST

C Post structure to workstation
CALL PPOST(0, 0, 0.0)
CALL PPOST(IWK, 0, 0.0)

C Buisy loop
DO WHILE (1 .GT. 0)
Expand Down
15 changes: 9 additions & 6 deletions src/test_f/test_f2.f
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,18 @@ PROGRAM DRAWLINE
REAL PL_y(2)
REAL PL_z(2)

C Open PHIGS and a workstation
CALL POPPH(0, 0)
CALL POPWK(0, 0, 0)
INTEGER IWK
PARAMETER (IWK=1)

C Define line colour in workstation table
C Open PHIGS and a workstation
CALL POPPH(0, 1)
CALL POPWK(IWK, 0, 3)

C Define line colour in workstation table
COLR(1) = 1.0
COLR(2) = 1.0
COLR(3) = 0.0
CALL PSCR(0, 1, 3, COLR)
CALL PSCR(IWK, 1, 3, COLR)

C Open structure
CALL POPST(0)
Expand Down Expand Up @@ -108,7 +111,7 @@ PROGRAM DRAWLINE
CALL PCLST

C Post structure to workstation
CALL PPOST(0, 0, 0.0)
CALL PPOST(IWK, 0, 0.0)

C Buisy loop
DO WHILE (1 .GT. 0)
Expand Down
34 changes: 18 additions & 16 deletions src/test_f/test_f3.f
Original file line number Diff line number Diff line change
Expand Up @@ -490,31 +490,33 @@ SUBROUTINE KYDELP (XORG, YORG, SCAL)
END

PROGRAM DRAWLINE

C Include PHIGS enumeration file
INCLUDE 'phigsf77.h'

C Open PHIGS and a workstation
CALL POPPH(0, 0)
CALL POPWK(0, 0, 0)
iwk1 = 0
C init colors
call initcols(iwk1)



INTEGER IWK
PARAMETER (IWK=1)

C Open PHIGS and a workstation
CALL POPPH(0, 1)
CALL POPWK(IWK, 0, 3)

C Initialize colors
CALL INITCOLS(IWK)

C Open structure
CALL POPST(0)
CALL KYDELP(0.3, 0.5, 1.)
C Close structure
C
C Close structure
CALL PCLST

C Post structure to workstation
CALL PPOST(0, 0, 0.0)
CALL PPOST(IWK, 0, 0.0)

C Buisy loop
DO WHILE (1 .GT. 0)
END DO

STOP
END
7 changes: 5 additions & 2 deletions src/test_f/test_f4.f
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,14 @@ PROGRAM DRAWLINE
C Include PHIGS enumeration file
INCLUDE 'phigsf77.h'

INTEGER IWK
PARAMETER (IWK=1)

C Open PHIGS and a workstation
CALL POPPH(0, 1)
CALL POPWK(1, 0, 3)
CALL POPWK(IWK, 0, 3)

CALL KYSABL(1)
CALL KYSABL(IWK)

C Buisy loop
DO WHILE (1 .GT. 0)
Expand Down
Loading