Welcome, Guest! Login | Register

Render Scene [Print this Article]
Posted by: X-0ut
Date posted: Jan 24 2004
User Rating: 5 out of 5.0
Number of views: 6527
Number of comments: 7
Description: Simple rendering.
Quick & simple, heres how to draw visible surfaces (bsp only) - unlit.
 CODE (C++) 

model_t* world = gEngfuncs.GetEntityByIndex(0)->model;
msurface_t** s=world->marksurfaces;
glpoly_t* p;
texture_t* tex;
glColor4f(1,1,1,1);
for(int i=0;i<world->nummarksurfaces;i++)
{
    if(s[i]->visframe!=-1)
    {
        tex=s[i]->texinfo->texture;
        glBindTexture(GL_TEXTURE_2D,tex->gl_texturenum);
        p=s[i]->polys;
        glBegin (GL_POLYGON);
        float* v = p->verts[0];
        for (int t=0 ; t<p->numverts ; t++, v+= VERTEXSIZE)
        {
            glTexCoord2f (v[3], v[4]);
            glVertex3fv (v);
        }
        glEnd ();
        s[i]->visframe=-1;
    }
}

Rate This Article
This article is currently rated: 5 out of 5.0 (1 Votes)

You have to register to rate this article.
User Comments Showing comments 1-7

Posted By: _jc on Jan 27 2004 at 22:27:56
/me shudders

Posted By: XENO on Feb 05 2004 at 01:17:57
Ehhh.... Which includes does this need...

the standard TriAPI includes,
<gl/gl.h>,
<windows.h>

and what else?

Posted By: X-0ut on Feb 05 2004 at 01:20:53
I should have noted you need the modified com_model header containing the hardware definitions.
If you dont have it I can put it up on my image dump?

Posted By: rein on Feb 17 2004 at 23:35:56
nevermind, problem solvedEdited by rein on Feb 18 2004, 23:19:20

Posted By: Lord Booga on Apr 10 2004 at 07:05:19
If you don't know where to put this, you shouldn't be trying...

Posted By: InternetNightmare on May 26 2004 at 12:54:50
Wow cool! :D I needed this... Hmmm... I don't have gl_texturenum def.

Posted By: mathew on Apr 07 2005 at 13:30:49
hmm it seems to moast of time bind the worng texture in steam is it just my gfx card or dose anyone esle get this problem


You must register to post a comment. If you have already registered, you must login.

Latest Articles
3rd person View in Multiplayer
Half-Life 2 | Coding | Client Side Tutorials
How to enable it in HL2DM

By: cct | Nov 13 2006

Making a Camera
Half-Life 2 | Level Design
This camera is good for when you join a map, it gives you a view of the map before you join a team

By: slackiller | Mar 05 2006

Making a camera , Part 2
Half-Life 2 | Level Design
these cameras are working monitors that turn on when a button is pushed.

By: slackiller | Mar 04 2006

Storing weapons on ladder
Half-Life 2 | Coding | Snippets
like Raven Sheild or BF2

By: British_Bomber | Dec 24 2005

Implementation of a string lookup table
Half-Life 2 | Coding | Snippets
A string lookup table is a set of functions that is used to convert strings to pre-defined values

By: deathz0rz | Nov 13 2005


Latest Comments
knock knock
General | News
By: MIFUNE | Dec 31 2017
 
knock knock
General | News
By: omega | Dec 22 2016
 
knock knock
General | News
By: MIFUNE | Oct 10 2015
 
New HL HUD Message System
Half-Life | Coding | Shared Tutorials
By: chbrules | Dec 31 2011
 
knock knock
General | News
By: Whistler | Nov 05 2011
 
Particle Engine tutorial part 4
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 18 2010
 
Particle Engine tutorial part 2
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 11 2010
 
Particle Engine tutorial part 3
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 11 2010
 
Game Movement Series #2: Analog Jumping and Floating
Half-Life 2 | Coding | Shared Tutorials
By: mars3554 | Oct 26 2009
 
Particle Engine tutorial part 5
Half-Life | Coding | Client Side Tutorials
By: Deadpool | Aug 02 2009
 

Site Info
297 Approved Articless
8 Pending Articles
3940 Registered Members
0 People Online (11 guests)
About - Credits - Contact Us

Wavelength version: 3.0.0.9
Valid XHTML 1.0! Valid CSS!