Willkommen ~Gast!
Registrieren || Einloggen || Hilfe/FAQ || Staff
Probleme mit der Registrierung im Forum? Melde dich unter registerEin Bild.
Autor Beitrag
000
14.05.2002, 11:12
Hanky



moinsen,

ich habe was mit oGL im client rumgepfuscht ..habe mit das nebel tut vom -dhcc mal angesehn..daher kam ich auf die bedepperte idee..

..nunja..man jann sowohl hud als auch welt objecte erschaffen, letzteres sieht wenigstensds so aus....
Bilder:

hier nen rotierender hud-würfel OHNE textur..
Bild 1
tja..er dreht sich.... und was mich wundert..
Bild 2
..ist das dass Lichtsetting in einer HL map auswirkungen auf das openGL materiial zu haben scheint
Bild 3
leider ist der ganze müll nit ganz fehlerfrei..in bestimen Blickrichtungen schaltete er sich mal die Farbe ab
Bild 4
tjar.... den nun auch mal aus "welt-Würfel" absichtlich so kaputt dahingestellt:
Bild 1
und
Bild 2

Texturen und HUD-Würfel: (Glaux-Textur)
Bild 1
Bild 2
sieht fast gut aus..aber
Bild 3
HL scheint dagegen zu sein :((

ein netter mir unklarerer fehler ist folgender: HL gibbt dem, Würfel eine Welttextur, wenn man auf eine zeigt (crosshair):
Bild 1

oder halt fehler!
Bild 2

neja..auch hier ist ein pseudoweltobject möglisch:
Bild 1
und
Bild 2
ünd
Bild 1

ich verstehe hierbei nicht, was HL da eigentlich macht, in einem sauberem HL-freiem oGL fenster passiert sowas ja auch nit...

hier der code:

die ganze tri.cpp... einige der headerfiles sind für die fehlerausgabe benötigt (worden) da ein consolenaltert bei gGl-initialisieringszeiten nicht machbar ist..scheinbar!

nunja..was hat man davon? man könnte 3d hudelemente machen....WENN man diese biggs rausbügelt..oder?

--code in antwort..

--

hankYs Page


Dieser Beitrag wurde am 14.05.2002 um 12:52 von Hanky bearbeitet.
zum Seitenanfang zum Seitenende Profil || Suche
001
14.05.2002, 11:13
Hanky



//hankY--------------

#include <windows.h> // Header File For Windows
#include <gl\gl.h> // Header File For The OpenGL32 Library
#include <gl\glu.h> // Header File For The GLu32 Library
#include <gl\glaux.h> // Header File For The GLaux Library
#include "r_studioint.h"
#include <iostream.h>
#include<fstream>
using namespace std;

extern engine_studio_api_t IEngineStudio;
//----------------------

// Triangle rendering, if any

#include "hud.h"
#include "cl_util.h"

// Triangle rendering apis are in gEngfuncs.pTriAPI

#include "const.h"
#include "entity_state.h"
#include "cl_entity.h"
#include "triangleapi.h"

#define DLLEXPORT __declspec( dllexport )

extern "C"
{
void DLLEXPORT HUD_DrawNormalTriangles( void );
void DLLEXPORT HUD_DrawTransparentTriangles( void );
};

GLfloat xrot; // X Rotation ( NEW )
GLfloat yrot; // Y Rotation ( NEW )
GLfloat zrot; // Z Rotation ( NEW )
GLuint texture[1];

AUX_RGBImageRec *LoadBMP(char *Filename)
{
FILE *File=NULL;

if (!Filename)
{
ofstream out("links.txt");
out<<"error opening texurefeile\n"<<endl;
return NULL;
}

File=fopen(Filename,"r");

if (File)
{
fclose(File);
return auxDIBImageLoad(Filename);
}
return NULL;
}

int LoadGLTextures()
{
int Status=FALSE;

AUX_RGBImageRec *TextureImage[1];
memset(TextureImage,0,sizeof(void *)*1);

if (TextureImage[0]=LoadBMP("./exodus/cl_dlls/hankY.bmp"))
{
Status=TRUE;

glGenTextures(1, &texture[0]);
glBindTexture(GL_TEXTURE_2D, texture[0]);

glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);

}

if (TextureImage[0])
{
if (TextureImage[0]->data)
{
free(TextureImage[0]->data);
}
free(TextureImage[0]);
}
return Status;
}

void Draw_GL()
{
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background

glLoadIdentity();
glPushMatrix();

glFrontFace(GL_CW);
glEnable(GL_CULL_FACE);
glTranslatef(0.0f, 0.0f, -6.0f);
GLfloat LightAmbient[]= { 0.5f, 0.5f, 0.5f, 1.0f };
GLfloat LightDiffuse[]= { 1.0f, 1.0f, 1.0f, 1.0f };
GLfloat LightPosition[]= { 0.0f, 0.0f, 2.0f, 1.0f };
glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient); // Setup The Ambient Light
glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse); // Setup The Diffuse Light
glLightfv(GL_LIGHT1, GL_POSITION,LightPosition); // Position The Light
glEnable(GL_LIGHT1);

glPopMatrix();

glLoadIdentity();

glPushMatrix();
glTranslatef(0.0f, 0.0f, -6.0f);
glRotatef(xrot,1.0f,0.0f,0.0f);
glRotatef(yrot,0.0f,1.0f,0.0f);
glRotatef(zrot,0.0f,0.0f,1.0f);

xrot+=0.3f;
yrot+=0.2f;
zrot+=0.4f;

glFrontFace(GL_CW);
glEnable(GL_CULL_FACE);

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture[0]);
LoadGLTextures();
glBegin(GL_QUADS);
//Front
glNormal3f(0.0f, 0.0f, 1.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
//Back
glNormal3f(0.0f, 0.0f, -1.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
// Top Face
glNormal3f(0.0f, 1.0f, 0.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
// Bottom Face
glNormal3f(0.0f, -1.0f, 0.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
// Right face
glNormal3f(1.0f, 0.0f, 0.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
// Left Face
glNormal3f(-1.0f, 0.0f, 0.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
glEnd();
glDisable(GL_TEXTURE_2D);

/*
glBegin(GL_QUADS);
// glNormal3f(0.0f, 0.0f, 1.0f);
glColor3f(0.0f,1.0f,0.0f);
glVertex3f( 1.0f, 1.0f,-1.0f); // Top Right Of The Quad (Top)
glVertex3f(-1.0f, 1.0f,-1.0f); // Top Left Of The Quad (Top)
glVertex3f(-1.0f, 1.0f, 1.0f); // Bottom Left Of The Quad (Top)
glVertex3f( 1.0f, 1.0f, 1.0f); // Bottom Right Of The Quad (Top)

// glNormal3f(0.0f, 0.0f, -1.0f);
glColor3f(1.0f,0.0f,0.0f);
glVertex3f( 1.0f,-1.0f, 1.0f); // Top Right Of The Quad (Bottom)
glVertex3f(-1.0f,-1.0f, 1.0f); // Top Left Of The Quad (Bottom)
glVertex3f(-1.0f,-1.0f,-1.0f); // Bottom Left Of The Quad (Bottom)
glVertex3f( 1.0f,-1.0f,-1.0f); // Bottom Right Of The Quad (Bottom)

// glNormal3f(0.0f, 1.0f, 0.0f);
glColor3f(0.0f,0.0f,1.0f);
glVertex3f( 1.0f, 1.0f, 1.0f); // Top Right Of The Quad (Front)
glVertex3f(-1.0f, 1.0f, 1.0f); // Top Left Of The Quad (Front)
glVertex3f(-1.0f,-1.0f, 1.0f); // Bottom Left Of The Quad (Front)
glVertex3f( 1.0f,-1.0f, 1.0f); // Bottom Right Of The Quad (Front)

// glNormal3f(0.0f, -1.0f, 0.0f);
glColor3f(1.0f,1.0f,0.0f); // Set The Color To Yellow
glVertex3f( 1.0f,-1.0f,-1.0f); // Top Right Of The Quad (Back)
glVertex3f(-1.0f,-1.0f,-1.0f); // Top Left Of The Quad (Back)
glVertex3f(-1.0f, 1.0f,-1.0f); // Bottom Left Of The Quad (Back)
glVertex3f( 1.0f, 1.0f,-1.0f); // Bottom Right Of The Quad (Back)

// glNormal3f(1.0f, 0.0f, 0.0f);
glColor3f(0.0f,1.0f,1.0f); // Set The Color To Blue
glVertex3f(-1.0f, 1.0f, 1.0f); // Top Right Of The Quad (Left)
glVertex3f(-1.0f, 1.0f,-1.0f); // Top Left Of The Quad (Left)
glVertex3f(-1.0f,-1.0f,-1.0f); // Bottom Left Of The Quad (Left)
glVertex3f(-1.0f,-1.0f, 1.0f); // Bottom Right Of The Quad (Left)

// glNormal3f(-1.0f, 0.0f, 0.0f);
glColor3f(1.0f,0.0f,1.0f); // Set The Color To Violet
glVertex3f( 1.0f, 1.0f,-1.0f); // Top Right Of The Quad (Right)
glVertex3f( 1.0f, 1.0f, 1.0f); // Top Left Of The Quad (Right)
glVertex3f( 1.0f,-1.0f, 1.0f); // Bottom Left Of The Quad (Right)
glVertex3f( 1.0f,-1.0f,-1.0f); // Bottom Right Of The Quad (Right)
glEnd(); // Done Drawing The Quad
*/
glPopMatrix();

}

/*
=================
HUD_DrawNormalTriangles

Non-transparent triangles-- add them here
=================
*/
void DLLEXPORT HUD_DrawNormalTriangles( void )
{

gHUD.m_Spectator.DrawOverview();

//#if defined( TEST_IT )
//Draw_Triangles();
//#endif

if( IEngineStudio.IsHardware() == 1 ) // OpenGL
{
glShadeModel(GL_SMOOTH);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations
glViewport(0, 0, ScreenWidth,ScreenHeight); // Reset The Current Viewport
glClearDepth(1.0f);
glDepthFunc(GL_ALWAYS); //ausgeklammert: pseudo-w-object!
glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
glLoadIdentity(); // Reset The Projection Matrix
gluPerspective(45.0f,(GLfloat)ScreenWidth/(GLfloat) ScreenHeight,0.10f,1000.0f);// Calculate The Aspect Ratio Of The Window
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
Draw_GL();
}
}
/*
=================
HUD_DrawTransparentTriangles

Render any triangles with transparent rendermode needs here
=================
*/

void DLLEXPORT HUD_DrawTransparentTriangles( void )
{
static float rtri;
//hankY some FOG better than shit in ver #1
float fogStart = 200;
float fogEnd = 2000;
float fogColor[3] = {80,80,80};

GLfloat fogColorogl[4] = {0.3f,0.3f,0.3f,1.0f}; // Fog Color
if( IEngineStudio.IsHardware() == 2 ) // Direct3D
{
gEngfuncs.pTriAPI->Fog( fogColor, fogStart, fogEnd, 1 );
}
else if( IEngineStudio.IsHardware() == 1 ) // OpenGL
{

glFrontFace(GL_CCW); // hankY: ein muss!!
glEnable(GL_CULL_FACE); //hankY: ein muss!!!
/*
glFogi(GL_FOG_MODE, GL_LINEAR);
glFogfv(GL_FOG_COLOR, fogColorogl);
glFogf(GL_FOG_DENSITY, (GLfloat)0.35f);
glHint(GL_FOG_HINT, GL_NICEST);
glFogf( GL_FOG_START, (GLfloat)50 );
glFogf( GL_FOG_END, (GLfloat)2500 );
glEnable(GL_FOG);
*/

}
}

--

hankYs Page

zum Seitenanfang zum Seitenende Profil || Suche
002
14.05.2002, 11:33
Hanky



na toll... da das board hier eine maximale texxtlänge hat..mussich einen 3ten post machen..

edit: ihr müsst natürlich folgende 3 libs in euer project einbinden:

opengl32.lib glu32.lib glaux.lib entweder bei project->einstelliungen->linker oder so:
#pragma comment( lib, "opengl32.lib" )
#pragma comment( lib, "glu32.lib" )
#pragma comment( lib, "glaux.lib" )

--

hankYs Page

zum Seitenanfang zum Seitenende Profil || Suche
003
14.05.2002, 12:27
TheTinySteini



Gah, hau mal die Bilder bitte nur als Links rein!!! Das is ja abartig!

Und zum Fehler: Ja. Ich weiß. Ich weiß aber net woran's liegt. Hab so nettes Zeug auch mit TriAPI erlebt. Plötzlich andere Texturen, plötzlich die Farbe der Waffe, die man in der Hand hält und so weiter. kA, was das soll. Is aber so. Und Valve schweigt sich drüber aus. Jedenfalls mir gegenüber :-/

--

TheTinySteini
Coder Poke646
"Don't Panic" - Hitchhiker's Guide to the Galaxy

zum Seitenanfang zum Seitenende Profil || Suche
004
14.05.2002, 12:48
Hanky



tz...die schweigen weil sie keinen weitren Fehler eingestehen wollen..schätz ich ma!

--

hankYs Page

zum Seitenanfang zum Seitenende Profil || Suche
005
14.05.2002, 14:43
Another1



ich versteh bloß net wozu du das mit openGL machst, hanky? Dazu kannst du doch die TriAPI viel einfacher benutzen, das is nich so übel gehackt.

--

Another1

...relaxing..atm =)
... und Schweiz suckt!

zum Seitenanfang zum Seitenende Profil || Suche
006
14.05.2002, 15:36
Rockefeller



Warum? Warum? Weils geht! :D

Es wird wohl keine ernsthafte Anwendung in HL haben, da es noch recht viele Leute mit D3D gibt.

--

zum Seitenanfang zum Seitenende Profil || Suche
007
14.05.2002, 17:19
Another1



na toll. Aber !genau! das selbe geht mit TriAPI auch ...

--

Another1

...relaxing..atm =)
... und Schweiz suckt!

zum Seitenanfang zum Seitenende Profil || Suche
008
14.05.2002, 18:17
Hanky



habe es versucht...

..alles was dabei rauskam war ne fehlermeldung..

habe diese vorgabe von valve genommen.. nix ging!

daher habe ich oGL getestet...

--

hankYs Page

zum Seitenanfang zum Seitenende Profil || Suche
009
14.05.2002, 18:23
Tron



Zitat:
Rockefeller postete
Es wird wohl keine ernsthafte Anwendung in HL haben, da es noch recht viele Leute mit D3D gibt.

yeah! opengl rulz da wörld!
(sorry 4 spam, aber das _musste_ jetzt sein)

--

'KEINE PANIK' - aus der Triologie in fuenf Baenden von Douglas Adams

'FÜR DEINN FERD' - aus 'Gevatter Tod' von Terry Pratchett

zum Seitenanfang zum Seitenende Profil || Suche
010
15.05.2002, 01:56
Another1



sehr gewagte aussage, Tron.

--

Another1

...relaxing..atm =)
... und Schweiz suckt!

zum Seitenanfang zum Seitenende Profil || Suche
011
15.05.2002, 21:38
TheTinySteini



Gewagt schon, aber sympathisch! =P

--

TheTinySteini
Coder Poke646
"Don't Panic" - Hitchhiker's Guide to the Galaxy

zum Seitenanfang zum Seitenende Profil || Suche
012
16.05.2002, 16:22
Hanky



warum hat sich Tron nun fürs spamen entschuldigt? *gg*

d3d suckt aber warum stellt MS das nit mal fest? Wennes schon bei Win nit klappt....

--

hankYs Page

zum Seitenanfang zum Seitenende Profil || Suche
013
16.05.2002, 20:32
fS|eixid



Willst du das als so ne art drehbaren readar benutzen oder was?aber das währ ne geile idee ma,oder? so ne art karte ... :)

--

Project leader at www.future-strike.de

zum Seitenanfang zum Seitenende Profil || Suche
014
17.05.2002, 22:01
Jotzet



ne 3D karte, cool ;)

--

- Herr der Ringe Multiplayer-Mod => www.middlewars.de.vu
- German Tactical Group Clanpage => www.gtg-csclan.de
...mfg Jotzet

zum Seitenanfang zum Seitenende Profil || Suche