Commit fb05a319 authored by Kenneth Moreland's avatar Kenneth Moreland
Browse files

Add library for all the OpenGL dependent IceT functionality.

Created a new src directory (gl) for a new IceT library (icet_gl).
This library will encapsulate all the OpenGL dependent functionality.
As a first step, ICET_READ_BUFFER was moved to this library.
parent 4005cc45
......@@ -6,3 +6,8 @@ Names of include files.
Many GL* types converted to IceT* types.
ICET_READ_BUFFER -> ICET_GL_READ_BUFFER
Added icetGLInitialize.
Added icetGLSetReadBuffer.
# Id
#
## Copyright 2003 Sandia Coporation
## Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
## license for use of this work by or on behalf of the U.S. Government.
......@@ -9,6 +7,7 @@
#
ADD_SUBDIRECTORY(ice-t)
ADD_SUBDIRECTORY(gl)
ADD_SUBDIRECTORY(communication)
ADD_SUBDIRECTORY(strategies)
......
## Copyright 2003 Sandia Coporation
## Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
## license for use of this work by or on behalf of the U.S. Government.
## Redistribution and use in source and binary forms, with or without
## modification, are permitted provided that this Notice and any statement
## of authorship are reproduced on all copies.
#
SET(ICET_GL_SRCS
icetGLState.c
)
ADD_LIBRARY(icet_gl ${ICET_GL_SRCS})
TARGET_LINK_LIBRARIES(icet_gl icet)
IF(NOT ICET_INSTALL_NO_LIBRARIES)
INSTALL(TARGETS icet_gl
RUNTIME DESTINATION ${ICET_INSTALL_BIN_DIR} COMPONENT RuntimeLibraries
LIBRARY DESTINATION ${ICET_INSTALL_LIB_DIR} COMPONENT RuntimeLibraries
ARCHIVE DESTINATION ${ICET_INSTALL_LIB_DIR} COMPONENT RuntimeLibraries)
ENDIF(NOT ICET_INSTALL_NO_LIBRARIES)
IF(NOT ICET_INSTALL_NO_DEVELOPMENT)
INSTALL(FILES ${ICET_SOURCE_DIR}/src/include/IceTGL.h
DESTINATION ${ICET_INSTALL_INCLUDE_DIR})
ENDIF(NOT ICET_INSTALL_NO_DEVELOPMENT)
/* -*- c -*- *******************************************************/
/*
* Copyright (C) 2010 Sandia Corporation
* Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
* license for use of this work by or on behalf of the U.S. Government.
*/
#include <IceTGL.h>
#include <diagnostics.h>
void icetGLInitialize(void)
{
if (icetStateGetType(ICET_GL_INITIALIZED) != ICET_NULL) {
IceTBoolean initialized;
icetGetBooleanv(ICET_GL_INITIALIZED, &initialized);
if (initialized) {
icetRaiseWarning("icetGLInitialize called multiple times.",
ICET_INVALID_OPERATION);
}
}
icetStateSetBoolean(ICET_GL_INITIALIZED, ICET_TRUE);
icetStateSetInteger(ICET_GL_READ_BUFFER, GL_BACK);
}
void icetGLSetReadBuffer(GLenum mode)
{
if ( (mode == GL_FRONT_LEFT) || (mode == GL_FRONT_RIGHT)
|| (mode == GL_BACK_LEFT) || (mode == GL_BACK_RIGHT)
|| (mode == GL_FRONT) || (mode == GL_BACK)
|| (mode == GL_LEFT) || (mode == GL_RIGHT)
|| ((mode >= GL_AUX0) && (mode < GL_AUX0 + GL_AUX_BUFFERS)) )
{
icetStateSetInteger(ICET_GL_READ_BUFFER, GL_BACK);
} else {
icetRaiseError("Invalid OpenGL read buffer.", ICET_INVALID_ENUM);
}
}
# Id
#
## Copyright 2003 Sandia Coporation
## Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
## license for use of this work by or on behalf of the U.S. Government.
......@@ -29,8 +27,8 @@ IF(NOT ICET_INSTALL_NO_LIBRARIES)
ARCHIVE DESTINATION ${ICET_INSTALL_LIB_DIR} COMPONENT RuntimeLibraries)
ENDIF(NOT ICET_INSTALL_NO_LIBRARIES)
IF(NOT ICET_INSTALL_NO_DEVELOPMENT)
INSTALL(FILES ${ICET_SOURCE_DIR}/src/include/GL/ice-t.h
${ICET_SOURCE_DIR}/src/include/GL/ice-t_buckets.h
${ICET_BINARY_DIR}/src/include/GL/ice-t_config.h
DESTINATION ${ICET_INSTALL_INCLUDE_DIR}/GL)
INSTALL(FILES ${ICET_SOURCE_DIR}/src/include/IceT.h
${ICET_SOURCE_DIR}/src/include/IceTBuckets.h
${ICET_BINARY_DIR}/src/include/IceTConfig.h
DESTINATION ${ICET_INSTALL_INCLUDE_DIR})
ENDIF(NOT ICET_INSTALL_NO_DEVELOPMENT)
......@@ -471,7 +471,7 @@ void icetDrawFrame(void)
IceTInt readBuffer;
IceTUInt depth;
IceTUInt far_depth;
icetGetIntegerv(ICET_READ_BUFFER, &readBuffer);
icetGetIntegerv(ICET_GL_READ_BUFFER, &readBuffer);
icetRaiseDebug("Trying to get far depth.");
......@@ -759,7 +759,7 @@ void icetDrawFrame(void)
icetRaiseDebug("Displaying image.");
icetGetIntegerv(ICET_READ_BUFFER, &readBuffer);
icetGetIntegerv(ICET_GL_READ_BUFFER, &readBuffer);
glDrawBuffer(readBuffer);
/* Place raster position in lower left corner. */
......
......@@ -763,7 +763,7 @@ static void renderTile(int tile, IceTInt *screen_viewport,
icetRaiseDebug("Checking depth.");
icetGetIntegerv(ICET_ABSOLUTE_FAR_DEPTH, (IceTInt *)&far_depth);
if (far_depth == 1) { /* An unlikely initial value. */
icetGetIntegerv(ICET_READ_BUFFER, &readBuffer);
icetGetIntegerv(ICET_GL_READ_BUFFER, &readBuffer);
glReadBuffer(readBuffer);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glFlush();
......@@ -841,7 +841,7 @@ static void readSubImage(IceTInt fb_x, IceTInt fb_y,
/* glPixelStorei(GL_PACK_SKIP_PIXELS, ib_x); */
/* glPixelStorei(GL_PACK_SKIP_ROWS, ib_y); */
icetGetIntegerv(ICET_READ_BUFFER, &readBuffer);
icetGetIntegerv(ICET_GL_READ_BUFFER, &readBuffer);
glReadBuffer(readBuffer);
glGetIntegerv(GL_VIEWPORT, physical_viewport);
......
......@@ -121,7 +121,6 @@ void icetStateSetDefaults(void)
icetStateSetInteger(ICET_DATA_REPLICATION_GROUP_SIZE, 1);
icetStateSetPointer(ICET_DRAW_FUNCTION, NULL);
icetStateSetInteger(ICET_READ_BUFFER, GL_BACK);
#ifdef _WIN32
icetStateSetInteger(ICET_COLOR_FORMAT, GL_BGRA_EXT);
#else
......
......@@ -193,7 +193,6 @@ ICET_EXPORT void icetDiagnostics(IceTBitField mask);
#define ICET_DATA_REPLICATION_GROUP_SIZE (ICET_STATE_ENGINE_START | (IceTEnum)0x002C)
#define ICET_DRAW_FUNCTION (ICET_STATE_ENGINE_START | (IceTEnum)0x0060)
#define ICET_READ_BUFFER (ICET_STATE_ENGINE_START | (IceTEnum)0x0061)
#define ICET_COLOR_FORMAT (ICET_STATE_ENGINE_START | (IceTEnum)0x0062)
#define ICET_FRAME_COUNT (ICET_STATE_ENGINE_START | (IceTEnum)0x0063)
......
......@@ -27,6 +27,11 @@
# else
# define ICET_EXPORT __declspec( dllimport )
# endif
# ifdef icet_gl_EXPORTS
# define ICET_GL_EXPORT __declspec( dllexport )
# else
# define ICET_GL_EXPORT __declspec( dllimport )
# endif
# ifdef icet_strategies_EXPORTS
# define ICET_STRATEGY_EXPORT __declspec( dllexport )
# else
......@@ -39,6 +44,7 @@
# endif
#else /* WIN32 && SHARED_LIBS */
# define ICET_EXPORT
# define ICET_GL_EXPORT
# define ICET_STRATEGY_EXPORT
# define ICET_MPI_EXPORT
#endif /* WIN32 && SHARED_LIBS */
......
......@@ -3,9 +3,6 @@
* Copyright (C) 2010 Sandia Corporation
* Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
* license for use of this work by or on behalf of the U.S. Government.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that this Notice and any statement
* of authorship are reproduced on all copies.
*/
#ifndef _ICET_GL_H_
......@@ -26,6 +23,17 @@ extern "C" {
}
#endif
ICET_GL_EXPORT void icetGLInitialize(void);
ICET_GL_EXPORT void icetGLSetReadBuffer(GLenum mode);
#define ICET_GL_STATE_START (IceTEnum)0x00000140
#define ICET_GL_INITIALIZED (ICET_GL_STATE_START | (IceTEnum)0x0001)
#define ICET_GL_READ_BUFFER (ICET_GL_STATE_START | (IceTEnum)0x0010)
#ifdef __cplusplus
}
#endif
......
......@@ -26,6 +26,7 @@ CREATE_TEST_SOURCELIST(Tests icetTests_mpi.c ${MyTests}
ADD_EXECUTABLE(icetTests_mpi ${Tests} ${UTIL_SRCS})
TARGET_LINK_LIBRARIES(icetTests_mpi
icet
icet_gl
icet_strategies
icet_mpi
${OPENGL_glu_LIBRARY}
......
......@@ -199,6 +199,7 @@ void initialize_test(int *argcp, char ***argvp, IceTCommunicator comm)
/* Create an IceT context. */
context = icetCreateContext(comm);
icetDiagnostics(diag_level);
icetGLInitialize();
/* Redirect standard output on demand. */
if (redirect) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment