mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 01:53:10 +02:00
Merge branch '18637'
Conflicts: main.cpp
This commit is contained in:
commit
4d94e9e322
3 changed files with 23 additions and 13 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
xcuserdata
|
||||||
|
|
29
main.cpp
29
main.cpp
|
@ -204,6 +204,7 @@ unsigned int texture_height = 256;
|
||||||
|
|
||||||
|
|
||||||
float particle_attenuation_quadratic[] = { 0.0f, 0.0f, 2.0f }; // larger Z = smaller particles
|
float particle_attenuation_quadratic[] = { 0.0f, 0.0f, 2.0f }; // larger Z = smaller particles
|
||||||
|
float pointer_attenuation_quadratic[] = { 1.0f, 0.0f, 0.0f }; // for 2D view
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -580,22 +581,22 @@ void display(void)
|
||||||
glRotatef(render_yaw, 0, 1, 0);
|
glRotatef(render_yaw, 0, 1, 0);
|
||||||
glTranslatef(location[0], location[1], location[2]);
|
glTranslatef(location[0], location[1], location[2]);
|
||||||
|
|
||||||
// Draw Point Sprites
|
/* Draw Point Sprites */
|
||||||
load_png_as_texture(texture_filename);
|
|
||||||
|
//glActiveTexture(GL_TEXTURE0);
|
||||||
/* assuming you have setup a 32-bit RGBA texture with a legal name */
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
glEnable( GL_TEXTURE_2D );
|
glEnable( GL_TEXTURE_2D );
|
||||||
glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE);
|
|
||||||
|
//glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE);
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||||
|
|
||||||
glPointParameterfvARB( GL_POINT_DISTANCE_ATTENUATION_ARB, particle_attenuation_quadratic );
|
glPointParameterfvARB( GL_POINT_DISTANCE_ATTENUATION_ARB, particle_attenuation_quadratic );
|
||||||
|
|
||||||
float maxSize = 0.0f;
|
float maxSize = 0.0f;
|
||||||
glGetFloatv( GL_POINT_SIZE_MAX_ARB, &maxSize );
|
glGetFloatv( GL_POINT_SIZE_MAX_ARB, &maxSize );
|
||||||
glPointSize( maxSize );
|
glPointSize( maxSize );
|
||||||
glPointParameterfARB( GL_POINT_SIZE_MAX_ARB, maxSize );
|
glPointParameterfARB( GL_POINT_SIZE_MAX_ARB, maxSize );
|
||||||
// glPointParameterfARB( GL_POINT_SIZE_MIN_ARB, 0.001f );
|
glPointParameterfARB( GL_POINT_SIZE_MIN_ARB, 0.001f );
|
||||||
glTexEnvf( GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE );
|
glTexEnvf( GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE );
|
||||||
|
|
||||||
glEnable( GL_POINT_SPRITE_ARB );
|
glEnable( GL_POINT_SPRITE_ARB );
|
||||||
glBegin( GL_POINTS );
|
glBegin( GL_POINTS );
|
||||||
{
|
{
|
||||||
|
@ -607,10 +608,12 @@ void display(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
glDisable( GL_TEXTURE_2D );
|
glDisable( GL_TEXTURE_2D );
|
||||||
glDisable( GL_POINT_SPRITE_ARB );
|
glDisable( GL_POINT_SPRITE_ARB );
|
||||||
|
|
||||||
if (display_field) field_render();
|
// Show field vectors
|
||||||
|
if (display_field) field_render();
|
||||||
|
|
||||||
if (display_head) myHead.render();
|
if (display_head) myHead.render();
|
||||||
|
|
||||||
|
@ -636,20 +639,20 @@ void display(void)
|
||||||
|
|
||||||
if (mouse_pressed == 1)
|
if (mouse_pressed == 1)
|
||||||
{
|
{
|
||||||
glPointSize(20.f);
|
glPointParameterfvARB( GL_POINT_DISTANCE_ATTENUATION_ARB, pointer_attenuation_quadratic );
|
||||||
|
glPointSize( 10.0f );
|
||||||
glColor3f(1,1,1);
|
glColor3f(1,1,1);
|
||||||
glEnable(GL_POINT_SMOOTH);
|
//glEnable(GL_POINT_SMOOTH);
|
||||||
glBegin(GL_POINTS);
|
glBegin(GL_POINTS);
|
||||||
glVertex2f(target_x, target_y);
|
glVertex2f(target_x, target_y);
|
||||||
glEnd();
|
glEnd();
|
||||||
char val[20];
|
char val[20];
|
||||||
sprintf(val, "%d,%d", target_x, target_y);
|
sprintf(val, "%d,%d", target_x, target_y);
|
||||||
drawtext(target_x, target_y-20, 0.08, 0, 1.0, 0, val, 0, 1, 0);
|
drawtext(target_x, target_y-20, 0.08, 0, 1.0, 0, val, 0, 1, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (display_head_mouse)
|
if (display_head_mouse)
|
||||||
{
|
{
|
||||||
glPointSize(20.f);
|
glPointSize(10.0f);
|
||||||
glColor4f(1.0, 1.0, 0.0, 0.8);
|
glColor4f(1.0, 1.0, 0.0, 0.8);
|
||||||
glEnable(GL_POINT_SMOOTH);
|
glEnable(GL_POINT_SMOOTH);
|
||||||
glBegin(GL_POINTS);
|
glBegin(GL_POINTS);
|
||||||
|
|
|
@ -19,6 +19,12 @@
|
||||||
|
|
||||||
#define TEXTURE_LOAD_ERROR 0
|
#define TEXTURE_LOAD_ERROR 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read a given filename as a PNG texture, and set
|
||||||
|
it as the current default OpenGL texture.
|
||||||
|
* @param[in] filename Relative path to PNG file
|
||||||
|
* @return Zero for success.
|
||||||
|
*/
|
||||||
|
|
||||||
int load_png_as_texture(char* filename)
|
int load_png_as_texture(char* filename)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue