state_point.c revision f350d4fb2d12fd22c0905fe9c7a121499da7b52d
/* Copyright (c) 2001, Stanford University
* All rights reserved
*
* See the file LICENSE.txt for information on redistributing this software.
*/
#include "state.h"
#include "state/cr_statetypes.h"
#include "state_internals.h"
{
int i;
p->pointSmooth = GL_FALSE;
p->pointSize = 1.0f;
#ifdef CR_ARB_point_parameters
p->minSize = 0.0f;
p->fadeThresholdSize = 1.0f;
p->distanceAttenuation[0] = 1.0f;
#endif
#ifdef CR_ARB_point_sprite
p->pointSprite = GL_FALSE;
for (i = 0; i < CR_MAX_TEXTURE_UNITS; i++) {
p->coordReplacement[i] = GL_FALSE;
}
#endif
/*
*p->aliasedpointsizerange_min = c->aliasedpointsizerange_min;
*p->aliasedpointsizerange_max = c->aliasedpointsizerange_max;
*p->aliasedpointsizegranularity = c->aliasedpointsizegranularity;
*p->smoothpointsizerange_min = c->smoothpointsizerange_min;
*p->smoothpointsizerange_max = c->smoothpointsizerange_max;
*p->smoothpointgranularity = c->smoothpointgranularity;
*/
}
{
CRContext *g = GetCurrentContext();
CRPointState *p = &(g->point);
if (g->current.inBeginEnd)
{
return;
}
FLUSH();
if (size <= 0.0f)
{
crStateError(__LINE__, __FILE__, GL_INVALID_VALUE, "glPointSize called with size <= 0.0: %f", size);
return;
}
}
{
CRContext *g = GetCurrentContext();
if (g->current.inBeginEnd)
{
return;
}
FLUSH();
}
{
CRContext *g = GetCurrentContext();
CRPointState *p = &(g->point);
if (g->current.inBeginEnd)
{
crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "glPointParameterfvARB called in begin/end");
return;
}
FLUSH();
switch (pname) {
if (g->extensions.ARB_point_parameters) {
p->distanceAttenuation[0] = params[0];
}
else
{
return;
}
break;
case GL_POINT_SIZE_MIN_EXT:
if (g->extensions.ARB_point_parameters) {
if (params[0] < 0.0F) {
crStateError(__LINE__, __FILE__, GL_INVALID_VALUE, "glPointParameterfvARB invalid value: %f", params[0]);
return;
}
}
else
{
return;
}
break;
case GL_POINT_SIZE_MAX_EXT:
if (g->extensions.ARB_point_parameters) {
if (params[0] < 0.0F) {
crStateError(__LINE__, __FILE__, GL_INVALID_VALUE, "glPointParameterfvARB invalid value: %f", params[0]);
return;
}
}
else
{
return;
}
break;
if (g->extensions.ARB_point_parameters) {
if (params[0] < 0.0F) {
crStateError(__LINE__, __FILE__, GL_INVALID_VALUE, "glPointParameterfvARB invalid value: %f", params[0]);
return;
}
p->fadeThresholdSize = params[0];
}
else
{
return;
}
break;
{
crStateError(__LINE__, __FILE__, GL_INVALID_VALUE, "glPointParameterfvARB invalid GL_POINT_SPRITE_COORD_ORIGIN value: %f", params[0]);
return;
}
p->spriteCoordOrigin = params[0];
break;
}
default:
return;
}
}
{
}
{
}
{
unsigned int j, i;
Assert(0);
for (j=0;j<CR_MAX_BITARRAY;j++)
i = 0; /* silence compiler */
{
{
}
}
{
{
}
}
{
{
}
}
{
{
}
}
{
{
}
}
{
{
}
}
{
if (from->distanceAttenuation[0] != to->distanceAttenuation[0] || from->distanceAttenuation[1] != to->distanceAttenuation[1] || from->distanceAttenuation[2] != to->distanceAttenuation[2]) {
}
}
{
{
}
}
{
unsigned int activeUnit = (unsigned int) -1;
for (i = 0; i < CR_MAX_TEXTURE_UNITS; i++) {
{
if (activeUnit != i) {
activeUnit = i;
}
}
}
}
}
{
unsigned int j, i;
for (j=0;j<CR_MAX_BITARRAY;j++)
i = 0; /* silence compiler */
{
{
FILLDIRTY(b->enableSmooth);
}
}
{
{
}
}
{
{
}
}
{
{
}
}
{
{
}
}
{
{
}
}
{
if (from->distanceAttenuation[0] != to->distanceAttenuation[0] || from->distanceAttenuation[1] != to->distanceAttenuation[1] || from->distanceAttenuation[2] != to->distanceAttenuation[2]) {
}
}
{
unsigned int activeUnit = (unsigned int) -1;
for (i = 0; i < CR_MAX_TEXTURE_UNITS; i++) {
{
if (!fEnabled)
{
}
#if 0
/*don't set coord replacement, it will be set just before drawing points when necessary,
* to work around gpu driver bugs
* See crServerDispatch[Begin|End|Draw*] */
if (activeUnit != i) {
activeUnit = i;
}
#endif
}
}
}
{
{
FILLDIRTY(b->enableSprite);
}
}
{
}
}