void XFBSource::Draw(const MathUtil::Rectangle<float> &sourcerc, const MathUtil::Rectangle<float> &drawrc, int width, int height) const { // Texture map xfbSource->texture onto the main buffer glBindTexture(GL_TEXTURE_RECTANGLE_ARB, texture); glBegin(GL_QUADS); glTexCoord2f(sourcerc.left, sourcerc.bottom); glMultiTexCoord2fARB(GL_TEXTURE1, 0, 0); glVertex2f(drawrc.left, drawrc.bottom); glTexCoord2f(sourcerc.left, sourcerc.top); glMultiTexCoord2fARB(GL_TEXTURE1, 0, 1); glVertex2f(drawrc.left, drawrc.top); glTexCoord2f(sourcerc.right, sourcerc.top); glMultiTexCoord2fARB(GL_TEXTURE1, 1, 1); glVertex2f(drawrc.right, drawrc.top); glTexCoord2f(sourcerc.right, sourcerc.bottom); glMultiTexCoord2fARB(GL_TEXTURE1, 1, 0); glVertex2f(drawrc.right, drawrc.bottom); glEnd(); GL_REPORT_ERRORD(); }
void SetTextureCoord(float x, float z) { // Find the (u, v) coordinate for the current vertex float u = (float)x / (float)MAP_SIZE; float v = -(float)z / (float)MAP_SIZE; /////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * // Instead of using the normal API for assigning the current texture // coordinate, we want to use the glMultiTexCoord2fARB() function. // This will allow us to choose the (u, v) coordinate for every texture // map, since we are using multitexturing. Due to the fact that we // are going to be using the texture matrix to set the tiling of our // detail texture, we just assign the same (u, v) coordinate for both // textures. // Give OpenGL the current terrain texture coordinate for our height map glMultiTexCoord2fARB(GL_TEXTURE0_ARB, u, v); // Give OpenGL the current detail texture coordinate for our height map glMultiTexCoord2fARB(GL_TEXTURE1_ARB, u, v); /////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * }
static void DrawScene(WindowData *pwdata) { /* Render a triangle - multi-textured if ARB_multitexture is supported. */ glClearColor (0.0, 0.0, 0.0, 0.0); /* BLACK */ glClear (GL_COLOR_BUFFER_BIT); glMatrixMode (GL_MODELVIEW); glLoadIdentity(); glRotatef (pwdata->spin, 0.0, 0.0, 1.0); pwdata->spin += 2; if (pwdata->spin >= 360) { pwdata->spin = 0; } if (pwdata->hasMultitexture) { /* * ========================================================== * ========================================================== * Use an extension function without doing anything special! * OpenGL 1.2, OpenGL 1.3 procs can be used similarly - as * long we ensure it is supported - just as we have done * for MultiTexCoord here. * ========================================================== * ========================================================== */ glBegin( GL_POLYGON ); glMultiTexCoord2fARB (GL_TEXTURE1_ARB, 0.0, 0.0); glColor3f (1.0, 0.0, 0.0); glVertex3f(0.0, 0.0, 0.0); glMultiTexCoord2fARB (GL_TEXTURE1_ARB, 1.0, 0.0); glColor3f (0.0, 1.0, 0.0); glVertex3f(0.5, 0.0, 0.0); glMultiTexCoord2fARB (GL_TEXTURE1_ARB, 1.0, 1.0); glColor3f (0.0, 0.0, 1.0); glVertex3f(0.5, 0.5, 0.0); glEnd(); } else { glBegin( GL_POLYGON ); glColor3f (1.0, 0.0, 0.0); glVertex3f(0.0, 0.0, 0.0); glColor3f (0.0, 1.0, 0.0); glVertex3f(0.5, 0.0, 0.0); glColor3f (0.0, 0.0, 1.0); glVertex3f(0.5, 0.5, 0.0); glEnd(); } glXSwapBuffers(pwdata->display, pwdata->window); }
FX_ENTRY void FX_CALL grDrawPoint( const void *pt ) { float *x = (float*)pt + xy_off/sizeof(float); float *y = (float*)pt + xy_off/sizeof(float) + 1; float *z = (float*)pt + z_off/sizeof(float); float *q = (float*)pt + q_off/sizeof(float); unsigned char *pargb = (unsigned char*)pt + pargb_off; float *s0 = (float*)pt + st0_off/sizeof(float); float *t0 = (float*)pt + st0_off/sizeof(float) + 1; float *s1 = (float*)pt + st1_off/sizeof(float); float *t1 = (float*)pt + st1_off/sizeof(float) + 1; float *fog = (float*)pt + fog_ext_off/sizeof(float); LOG("grDrawPoint()\r\n"); if(nvidia_viewport_hack && !render_to_texture) { glViewport(0, viewport_offset, viewport_width, viewport_height); nvidia_viewport_hack = 0; } reloadTexture(); if(need_to_compile) compile_shader(); glBegin(GL_POINTS); if (nbTextureUnits > 2) { if (st0_en) glMultiTexCoord2fARB(GL_TEXTURE1_ARB, *s0 / *q / (float)tex1_width, ytex(0, *t0 / *q / (float)tex1_height)); if (st1_en) glMultiTexCoord2fARB(GL_TEXTURE0_ARB, *s1 / *q / (float)tex0_width, ytex(1, *t1 / *q / (float)tex0_height)); } else { if (st0_en) glTexCoord2f(*s0 / *q / (float)tex0_width, ytex(0, *t0 / *q / (float)tex0_height)); } if (pargb_en) glColor4f(pargb[2]/255.0f, pargb[1]/255.0f, pargb[0]/255.0f, pargb[3]/255.0f); if (fog_enabled && fog_coord_support) { if(!fog_ext_en || fog_enabled != 2) glSecondaryColor3f((1.0f / *q) / 255.0f, 0.0f, 0.0f); else glSecondaryColor3f((1.0f / *fog) / 255.0f, 0.0f, 0.0f); } glVertex4f((*x - (float)widtho) / (float)(width/2) / *q, -(*y - (float)heighto) / (float)(height/2) / *q, ZCALC(*z ,*q), 1.0f / *q); glEnd(); }
void SetTextureCoord(float x, float z) { // Find the (u, v) coordinate for the current vertex float u = (float)x / (float)MAP_SIZE; float v = -(float)z / (float)MAP_SIZE; // Give OpenGL the current terrain texture coordinate for our height map glMultiTexCoord2fARB(GL_TEXTURE0_ARB, u, v); // Give OpenGL the current detail texture coordinate for our height map glMultiTexCoord2fARB(GL_TEXTURE1_ARB, u, v); }
void CQuad::draw() { CHECK_GLERROR(""); glBegin(GL_QUADS); glMultiTexCoord2fARB(GL_TEXTURE0_ARB,u0, v0); glVertex2f(x0, y0); glMultiTexCoord2fARB(GL_TEXTURE0_ARB,u0, v1); glVertex2f(x0, y1); glMultiTexCoord2fARB(GL_TEXTURE0_ARB,u1, v1); glVertex2f(x1, y1); glMultiTexCoord2fARB(GL_TEXTURE0_ARB,u1, v0); glVertex2f(x1, y0); glEnd(); CHECK_GLERROR(""); }
static void Display( void ) { GLfloat x, y, s, t; glClear( GL_COLOR_BUFFER_BIT ); glPushMatrix(); glRotatef(Xrot, 1.0, 0.0, 0.0); glRotatef(Yrot, 0.0, 1.0, 0.0); glRotatef(Zrot, 0.0, 0.0, 1.0); glScalef(Scale, Scale, Scale); if (Texture) glColor3f(1, 1, 1); if (Points) { glBegin(GL_POINTS); for (t = 0.0; t <= 1.0; t += 0.025) { for (s = 0.0; s <= 1.0; s += 0.025) { x = s * 2.0 - 1.0; y = t * 2.0 - 1.0; if (!Texture) glColor3f(1, 0, 1); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, t, s); glTexCoord2f(s, t); glVertex2f(x, y); } } glEnd(); } else { glBegin(GL_LINES); for (t = 0.0; t <= 1.0; t += 0.025) { x = t * 2.0 - 1.0; if (!Texture) glColor3f(1, 0, 1); glTexCoord2f(t, 0.0); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0, t); glVertex2f(x, -1.0); if (!Texture) glColor3f(0, 1, 0); glTexCoord2f(t, 1.0); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0, t); glVertex2f(x, 1.0); } glEnd(); } glPopMatrix(); glutSwapBuffers(); }
/* ================ R_ArrayElementDiscrete This is just for OpenGL conformance testing, it should never be the fastest ================ */ static void GLAPIENTRY R_ArrayElementDiscrete( GLint index ) { glColor4ubv(tess.svars.colors[index]); if(glState.currenttmu) { glMultiTexCoord2fARB(0, tess.svars.texcoords[0][index][0], tess.svars.texcoords[0][index][1]); glMultiTexCoord2fARB(1, tess.svars.texcoords[1][index][0], tess.svars.texcoords[1][index][1]); } else { glTexCoord2fv(tess.svars.texcoords[0][index]); } glVertex3fv(tess.xyz[index].v); }
///////////////////////////////////////////////////////// // SetVertex // set up the texture-coordinates ///////////////////////////////////////////////////////// void GemShape :: SetVertex(GemState* state,float x, float y, float z, float tx, float ty,int curCoord) { TexCoord*texcoords=NULL; int numCoords = 0; int numUnits = 0; state->get(GemState::_GL_TEX_NUMCOORDS, numCoords); state->get(GemState::_GL_TEX_UNITS, numUnits); if (numCoords) { tx=state->texCoordX(curCoord); ty=state->texCoordY(curCoord); } if (numUnits) { for(int i=0; i<numUnits; i++) { glMultiTexCoord2fARB(GL_TEXTURE0+i, tx, ty); } } else { // no multitexturing! glTexCoord2f(tx, ty); } glVertex3f( x, y, z ); }
//=========================================================================== // DG_MultiTexCoord2f //=========================================================================== void DG_MultiTexCoord2f(int target, float s, float t) { if(target == GL_TEXTURE0) glTexCoord2f(s, t); else glMultiTexCoord2fARB(GL_TEXTURE0 + (target - DGL_TEXTURE0), s, t); }
static void DrawObject(void) { GLint i; GLint j; static const GLfloat tex_coords[] = { 0.0, 0.0, 1.0, 1.0, 0.0 }; static const GLfloat vtx_coords[] = { -1.0, -1.0, 1.0, 1.0, -1.0 }; if (!TexEnabled[0] && !TexEnabled[1]) glColor3f(0.1, 0.1, 0.1); /* add onto this */ else glColor3f(1, 1, 1); /* modulate this */ glBegin(GL_QUADS); /* Toggle between the vector and scalar entry points. This is done purely * to hit multiple paths in the driver. */ if ( Drift > 0.49 ) { for (j = 0; j < 4; j++ ) { for (i = 0; i < NumUnits; i++) glMultiTexCoord2fARB(GL_TEXTURE0_ARB + i, tex_coords[j], tex_coords[j+1]); glVertex2f( vtx_coords[j], vtx_coords[j+1] ); } } else { for (j = 0; j < 4; j++ ) { for (i = 0; i < NumUnits; i++) glMultiTexCoord2fvARB(GL_TEXTURE0_ARB + i, & tex_coords[j]); glVertex2fv( & vtx_coords[j] ); } } glEnd(); }
Sky::Impl::Impl(const std::string &tex_file, const Color &col, float alt, float reps) : color(col), altitude(alt), repeats(reps), texture(tex_file), sim_time(0), shader("sky"), tr(TextureMgr::get_ref()) { if(Settings::current.use_arb_multitexturing && Settings::current.use_arb_texture_env_combine) { list.begin(); for(int i=-5;i<5;i++) { glBegin(GL_TRIANGLE_STRIP); for(int j=-5;j<6;j++) { glMultiTexCoord2fARB((GLenum)GL_TEXTURE0_ARB,i,j); glMultiTexCoord2fARB((GLenum)GL_TEXTURE1_ARB,i,j); glVertex3f(i*1000,altitude,j*1000); glMultiTexCoord2fARB((GLenum)GL_TEXTURE0_ARB,(i+1),j); glMultiTexCoord2fARB((GLenum)GL_TEXTURE1_ARB,(i+1),j); glVertex3f((i+1)*1000,altitude,j*1000); } glEnd(); } list.end(); } else { list.begin(); // FIXME: maximum view distance fixed to 5000m here for(int i=-5;i<5;i++) { glBegin(GL_TRIANGLE_STRIP); for(int j=-5;j<6;j++) { glTexCoord2f(i,j); glVertex3f(i*1000,altitude,j*1000); glTexCoord2f(i+1,j); glVertex3f((i+1)*1000,altitude,j*1000); } glEnd(); } list.end(); } if(Settings::current.use_arb_multitexturing && Settings::current.use_arb_texture_env_combine) { shader.pre_load(); } else { tr->load(tex_file); } }
void APIENTRY gldMTexCoord2fSGIS( GLenum target, GLfloat s, GLfloat t) { GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS); glMultiTexCoord2fARB(ARB_target, s, t); }
void multi_tex_coord_2f(int stage, float s, float t) // Texture coords for the current vertex, in the specified // stage. { if (glMultiTexCoord2fARB) { glMultiTexCoord2fARB(stage, s, t); } }
void moTexturedGrid::SetTexCoord(MOint i, MOint j, MOint l) { float s, t; for (int k = 1; k <= l; k++) { GetPoint(k, i, j, s, t); glMultiTexCoord2fARB(GL_TEXTURE0_ARB + k - 1, s, t); } }
void CSm3ReadMap::DrawMinimap () { if (!minimapTexture) return; // draw the minimap in a quad (with extends: (0,0)-(1,1)) glDisable(GL_BLEND); glDisable(GL_ALPHA_TEST); glActiveTextureARB(GL_TEXTURE0_ARB); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, minimapTexture); glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REPLACE); if(groundDrawer->DrawExtraTex()){ glActiveTextureARB(GL_TEXTURE1_ARB); glEnable(GL_TEXTURE_2D); glTexEnvi(GL_TEXTURE_ENV,GL_COMBINE_RGB_ARB,GL_ADD_SIGNED_ARB); glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_COMBINE_ARB); glBindTexture(GL_TEXTURE_2D, groundDrawer->infoTex); glActiveTextureARB(GL_TEXTURE0_ARB); } float isx=gs->mapx/float(gs->pwr2mapx); float isy=gs->mapy/float(gs->pwr2mapy); glBegin(GL_QUADS); glTexCoord2f(0,isy); glMultiTexCoord2fARB(GL_TEXTURE1_ARB,0,1); glMultiTexCoord2fARB(GL_TEXTURE2_ARB,0,isy); glVertex2f(0,0); glTexCoord2f(0,0); glMultiTexCoord2fARB(GL_TEXTURE1_ARB,0,0); glMultiTexCoord2fARB(GL_TEXTURE2_ARB,0,0); glVertex2f(0,1); glTexCoord2f(isx,0); glMultiTexCoord2fARB(GL_TEXTURE1_ARB,1,0); glMultiTexCoord2fARB(GL_TEXTURE2_ARB,isx,0); glVertex2f(1,1); glTexCoord2f(isx,isy); glMultiTexCoord2fARB(GL_TEXTURE1_ARB,1,1); glMultiTexCoord2fARB(GL_TEXTURE2_ARB,isx,isy); glVertex2f(1,0); glEnd(); glActiveTextureARB(GL_TEXTURE1_ARB); glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE); glDisable(GL_TEXTURE_2D); glActiveTextureARB(GL_TEXTURE0_ARB); glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE); glDisable(GL_TEXTURE_2D); }
void Terrain::Render() { for(int z = 0; z < depth - 1; ++z) { glBegin(GL_TRIANGLE_STRIP); for(int x = 0; x < width; ++x) { glNormal3f(VertexAt(x, z).nx, VertexAt(x, z).ny, VertexAt(x, z).nz); glMultiTexCoord2fARB(GL_TEXTURE0_ARB, (float)x / width, (float)z / depth); //glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0f, x%2); glVertex3f(x -(width * 0.5) , VertexAt(x, z).y, z -(depth * 0.5)); glNormal3f(VertexAt(x, z + 1).nx, VertexAt(x, z + 1).ny, VertexAt(x, z + 1).nz); glMultiTexCoord2fARB(GL_TEXTURE0_ARB, (float)x / width, (float)(z + 1) / depth); //glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0f, x%2); glVertex3f(x -(width * 0.5), VertexAt(x, z + 1).y, z + 1 -(depth * 0.5)); } glEnd(); } }
void TextureManager::textureCoord2f(uint32 n, float u, float v) { if (n >= ARRAYSIZE(texture)) return; if (n == 0) { glTexCoord2f(u, v); return; } if (GfxMan.supportMultipleTextures()) glMultiTexCoord2fARB(texture[n], u, v); }
//***************************************************************************** void BTerrainBlock::SetTextureCoordinate(BVector vPoint) { if(OpenGLHelpers::m_bMultiTexturing) { // Use first texture unit /* if(vPoint.m_dZ <= -126.0) { glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.5f, 62.0f/64.0f); } else if(vPoint.m_dZ > 0.0) { glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.5f, 0.0f); } else { glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.5f, float(-vPoint.m_dZ) / 128.0f); } */ //glMultiTexCoord2fARB(GL_TEXTURE0_ARB, float(vPoint.m_dX) / 1000.0f, float(vPoint.m_dY) / 1000.0f); glMultiTexCoord2fARB(GL_TEXTURE0_ARB, float(vPoint.m_dX) * BTerrain::m_fGroundTextureScaler1, float(vPoint.m_dY) * BTerrain::m_fGroundTextureScaler1); // Use second texture unit //glMultiTexCoord2fARB(GL_TEXTURE1_ARB, float(vPoint.m_dX) / 100.0f, float(vPoint.m_dY) / 100.0f); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, float(vPoint.m_dX) * BTerrain::m_fGroundTextureScaler2, float(vPoint.m_dY) * BTerrain::m_fGroundTextureScaler2); } else { // No multitexturing, use second texture unit coordinates glTexCoord2f(float(vPoint.m_dX) * BTerrain::m_fGroundTextureScaler1, float(vPoint.m_dY) * BTerrain::m_fGroundTextureScaler1); } }
void HUD_Picture::Render() { // setup and bind texture glActiveTextureARB(GL_TEXTURE0_ARB ); //bind texture 0 glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D,texture); glBegin(GL_QUADS); glMultiTexCoord2fARB( GL_TEXTURE0_ARB, 1, 1); glVertex2f(xPos+width, yPos+height); glMultiTexCoord2fARB( GL_TEXTURE0_ARB, 0, 1); glVertex2f(xPos, yPos+height); glMultiTexCoord2fARB( GL_TEXTURE0_ARB, 0, 0); glVertex2f(xPos,yPos); glMultiTexCoord2fARB( GL_TEXTURE0_ARB, 1, 0); glVertex2f(xPos+width, yPos); glEnd(); glActiveTextureARB( GL_TEXTURE0_ARB ); glDisable( GL_TEXTURE_2D ); glBindTexture( GL_TEXTURE_2D, 0 ); }
static void draw( void ) { glClear( GL_COLOR_BUFFER_BIT ); glColor3f( 0.0, 0.0, 0.0 ); /* draw first polygon */ glPushMatrix(); glRotatef( Angle, 0.0, 0.0, 1.0 ); if (UseArrays) { glDrawArrays(GL_POLYGON, 0, 4); } else { glBegin( GL_POLYGON ); glTexCoord2f( 0.0, 0.0 ); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0, 0.0); glVertex2f( -1.0, -1.0 ); glTexCoord2f( 1.0, 0.0 ); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0, 0.0); glVertex2f( 1.0, -1.0 ); glTexCoord2f( 1.0, 1.0 ); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0, 1.0); glVertex2f( 1.0, 1.0 ); glTexCoord2f( 0.0, 1.0 ); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0, 1.0); glVertex2f( -1.0, 1.0 ); glEnd(); } glPopMatrix(); glutSwapBuffers(); }
void ObjMeshGPUDeformer::MakeDisplayListsPoints() { printf("Creating display list for points...\n"); displayListPoints = glGenLists(1); glNewList(displayListPoints, GL_COMPILE); glBegin(GL_POINTS); for (int i=0; i < (int)mesh->getNumVertices(); i++) { float s = gpgpuVertexTextureCoordinates[2*i+0]; float t = gpgpuVertexTextureCoordinates[2*i+1]; glMultiTexCoord2fARB(GL_TEXTURE0_ARB, s, t); Vec3d pos = mesh->getPosition(i); glVertex3f(pos[0], pos[1], pos[2]); } glEnd(); glEndList(); }
void DrawTile(float x, float y, float z, float size) { size *= 0.5; glNormal3f( 0.0f, 1.0f, 0.0f ); glBegin(GL_TRIANGLE_STRIP); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0f, 0.0f); glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0f, 0.0f); glVertex3f(x + size, y, z - size); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0f, 0.0f); glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 1.0f, 0.0f); glVertex3f(x - size, y, z - size); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0f, 1.0f); glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0f, 1.0f); glVertex3f(x + size, y, z + size); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0f, 1.0f); glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 1.0f, 1.0f); glVertex3f(x - size, y, z + size); glEnd(); }
void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glBegin(GL_TRIANGLES); glMultiTexCoord2fARB (GL_TEXTURE0_ARB, 0.0, 0.0); glMultiTexCoord2fARB (GL_TEXTURE1_ARB, 1.0, 0.0); glVertex2f(0.0, 0.0); glMultiTexCoord2fARB (GL_TEXTURE0_ARB, 0.5, 1.0); glMultiTexCoord2fARB (GL_TEXTURE1_ARB, 0.5, 0.0); glVertex2f(50.0, 100.0); glMultiTexCoord2fARB (GL_TEXTURE0_ARB, 1.0, 0.0); glMultiTexCoord2fARB (GL_TEXTURE1_ARB, 1.0, 1.0); glVertex2f(100.0, 0.0); glEnd(); glFlush(); }
static void DrawObject(void) { glBegin(GL_QUADS); #ifdef GL_ARB_multitexture glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0, 0.0); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0, 0.0); glVertex2f(-1.0, -1.0); glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 2.0, 0.0); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0, 0.0); glVertex2f(1.0, -1.0); glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 2.0, 2.0); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0, 1.0); glVertex2f(1.0, 1.0); glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0, 2.0); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0, 1.0); glVertex2f(-1.0, 1.0); #else glTexCoord2f(0.0, 0.0); glVertex2f(-1.0, -1.0); glTexCoord2f(1.0, 0.0); glVertex2f(1.0, -1.0); glTexCoord2f(1.0, 1.0); glVertex2f(1.0, 1.0); glTexCoord2f(0.0, 1.0); glVertex2f(-1.0, 1.0); #endif glEnd(); }
void CWater::RenderWater(CVec3f cameraPos, CFloat elapsedTime ) { if( g_fogBlurPass ) { glDisable( GL_CULL_FACE ); glBegin( GL_QUADS ); glVertex3f(m_sidePoint[0].x, m_sidePoint[0].y, m_sidePoint[0].z); glVertex3f(m_sidePoint[1].x, m_sidePoint[1].y, m_sidePoint[1].z); glVertex3f(m_sidePoint[2].x, m_sidePoint[2].y, m_sidePoint[2].z); glVertex3f(m_sidePoint[3].x, m_sidePoint[3].y, m_sidePoint[3].z); glEnd(); glEnable( GL_CULL_FACE ); } else { glDisable( GL_CULL_FACE ); // Turn on the first texture unit and bind the REFLECTION texture glActiveTexture(GL_TEXTURE0); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, m_waterTexture[WATER_REFLECTION_ID]); // Turn on the second texture unit and bind the REFRACTION texture glActiveTexture(GL_TEXTURE1); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, m_waterTexture[WATER_REFRACTION_ID]); // Turn on the third texture unit and bind the NORMAL MAP texture glActiveTexture(GL_TEXTURE2); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, m_normalMapImg->GetId() ); // Turn on the fourth texture unit and bind the DUDV MAP texture glActiveTexture(GL_TEXTURE3); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, m_dudvMapImg->GetId() ); // Turn on the fifth texture unit and bind the DEPTH texture glActiveTexture(GL_TEXTURE4); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, m_waterTexture[WATER_DEPTH_ID]); // Set the variable "reflection" to correspond to the first texture unit GLint uniform = glGetUniformLocationARB(g_render.m_waterProgram, "reflection"); glUniform1iARB(uniform, 0); //second paramter is the texture unit // Set the variable "refraction" to correspond to the second texture unit uniform = glGetUniformLocationARB(g_render.m_waterProgram, "refraction"); glUniform1iARB(uniform, 1); // Set the variable "normalMap" to correspond to the third texture unit uniform = glGetUniformLocationARB(g_render.m_waterProgram, "normalMap"); glUniform1iARB(uniform, 2); // Set the variable "dudvMap" to correspond to the fourth texture unit uniform = glGetUniformLocationARB(g_render.m_waterProgram, "dudvMap"); glUniform1iARB(uniform, 3); // Set the variable "depthMap" to correspond to the fifth texture unit uniform = glGetUniformLocationARB(g_render.m_waterProgram, "depthMap"); glUniform1iARB(uniform, 4); // Give the variable "waterColor" a blue color uniform = glGetUniformLocationARB(g_render.m_waterProgram, "waterColor"); glUniform4fARB(uniform, 0.1f, 0.2f, 0.3f, 1.0f); // We don't use lighting, but we do need to calculate // the diffuse and specular lighting on the water to increase realism. // position the light so it's near the light in the sky box texture. CVec3f lightPos(m_fWaterLPos[0], m_fWaterLPos[1], m_fWaterLPos[2]); // Give the variable "lightPos" our hard coded light position uniform = glGetUniformLocationARB(g_render.m_waterProgram, "lightPos"); glUniform4fARB(uniform, lightPos.x, lightPos.y, lightPos.z, 1.0f); // Give the variable "cameraPos" our camera position uniform = glGetUniformLocationARB(g_render.m_waterProgram, "cameraPos"); glUniform4fARB(uniform, cameraPos.x, cameraPos.y, cameraPos.z, 1.0f); // Create a static variable for the movement of the water static float move = 0.0f; // Use this variable for the normal map and make it slower // than the refraction map's speed. We want the refraction // map to be jittery, but not the normal map's waviness. float move2 = move * kNormalMapScale; // Set the refraction map's UV coordinates to our global g_WaterUV float refrUV = m_fWaterUV; // Set our normal map's UV scale and shrink it by kNormalMapScale float normalUV = m_fWaterUV * kNormalMapScale; // Move the water by our global speed move += m_fWaterSpeed * elapsedTime; glUseProgram( g_render.m_waterProgram ); // Draw our huge water quad glBegin(GL_QUADS); // The back left vertex for the water glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0f, m_fWaterUV); // Reflection texture glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0f, refrUV - move); // Refraction texture glMultiTexCoord2fARB(GL_TEXTURE2_ARB, 0.0f, normalUV + move2); // Normal map texture glMultiTexCoord2fARB(GL_TEXTURE3_ARB, 0, 0); // DUDV map texture glMultiTexCoord2fARB(GL_TEXTURE4_ARB, 0, 0); // Depth texture glVertex3f(m_sidePoint[0].x, m_sidePoint[0].y, m_sidePoint[0].z); // The front left vertex for the water glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0f, 0.0f); // Reflection texture glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0f, 0.0f - move); // Refraction texture glMultiTexCoord2fARB(GL_TEXTURE2_ARB, 0.0f, 0.0f + move2); // Normal map texture glMultiTexCoord2fARB(GL_TEXTURE3_ARB, 0, 0); // DUDV map texture glMultiTexCoord2fARB(GL_TEXTURE4_ARB, 0, 0); // Depth texture glVertex3f(m_sidePoint[1].x, m_sidePoint[1].y, m_sidePoint[1].z); // The front right vertex for the water glMultiTexCoord2fARB(GL_TEXTURE0_ARB, m_fWaterUV, 0.0f); // Reflection texture glMultiTexCoord2fARB(GL_TEXTURE1_ARB, refrUV, 0.0f - move); // Refraction texture glMultiTexCoord2fARB(GL_TEXTURE2_ARB, normalUV, 0.0f + move2); // Normal map texture glMultiTexCoord2fARB(GL_TEXTURE3_ARB, 0, 0); // DUDV map texture glMultiTexCoord2fARB(GL_TEXTURE4_ARB, 0, 0); // Depth texture glVertex3f(m_sidePoint[2].x, m_sidePoint[2].y, m_sidePoint[2].z); // The back right vertex for the water glMultiTexCoord2fARB(GL_TEXTURE0_ARB, m_fWaterUV, m_fWaterUV); // Reflection texture glMultiTexCoord2fARB(GL_TEXTURE1_ARB, refrUV, refrUV - move); // Refraction texture glMultiTexCoord2fARB(GL_TEXTURE2_ARB, normalUV, normalUV + move2); // Normal map texture glMultiTexCoord2fARB(GL_TEXTURE3_ARB, 0, 0); // DUDV map texture glMultiTexCoord2fARB(GL_TEXTURE4_ARB, 0, 0); // Depth texture glVertex3f(m_sidePoint[3].x, m_sidePoint[3].y, m_sidePoint[3].z); glEnd(); // Turn the fifth multi-texture pass off glActiveTexture(GL_TEXTURE4); glBindTexture( GL_TEXTURE_2D, 0 ); glDisable(GL_TEXTURE_2D); // Turn the fourth multi-texture pass off glActiveTexture(GL_TEXTURE3); glBindTexture( GL_TEXTURE_2D, 0 ); glDisable(GL_TEXTURE_2D); // Turn the third multi-texture pass off glActiveTexture(GL_TEXTURE2); glBindTexture( GL_TEXTURE_2D, 0 ); glDisable(GL_TEXTURE_2D); // Turn the second multi-texture pass off glActiveTexture(GL_TEXTURE1); glBindTexture( GL_TEXTURE_2D, 0 ); glDisable(GL_TEXTURE_2D); // Turn the first multi-texture pass off glActiveTexture(GL_TEXTURE0); glBindTexture( GL_TEXTURE_2D, 0 ); glDisable(GL_TEXTURE_2D); glEnable( GL_CULL_FACE ); glDisable(GL_TEXTURE_2D); } }
/** * @fn Flo::Display() * @brief Displays the simulation on a screen quad. */ void Flo::Display(DisplayMode mode, bool bilerp /* = false */, bool makeTex /*= false*/, bool displayBoundary /* = false */) { FloDisplayOp *display; // If makeTex is true, then we render to a viewport the size of the // simulation, rather than the whole window. Then (see below), we copy the // viewport to a texture. This is a regular (non-float) 2D texture, and we // can enable bilinear filtering when rendering it. This is faster than // performing the bilinear filtering directly on the float texture in a // fragment program, but the quality of the filtering is lower. // Also note that makeTex causes the scaled and biased fields, such as the // velocity, pressure, and vorticity, to lose their scaling and biasing on // display... if (makeTex) { glPushAttrib(GL_VIEWPORT_BIT); glViewport(0, 0, _iWidth, _iHeight); } static DisplayMode previous = DISPLAY_COUNT; if (mode != previous) { switch(mode) { default: case DISPLAY_INK: display = (bilerp) ? &_displayVectorBilerp : &_displayVector; display->SetFragmentParameter4f("bias", 0, 0, 0, 0); display->SetFragmentParameter4f("scale", 1, 1, 1, 1); display->SetTextureParameter("texture", _iTextures[TEXTURE_DENSITY]); break; case DISPLAY_VELOCITY: display = (bilerp) ? &_displayVectorBilerp : &_displayVector; display->SetFragmentParameter4f("bias", 0.5f, 0.5f, 0.5f, 0.5f); display->SetFragmentParameter4f("scale", 0.5f, 0.5f, 0.5f, 0.5f); display->SetTextureParameter("texture", _iTextures[TEXTURE_VELOCITY]); break; case DISPLAY_PRESSURE: display = (bilerp) ? &_displayScalarBilerp : &_displayScalar; display->SetFragmentParameter4f("bias", 0, 0, 0, 0); display->SetFragmentParameter4f("scale", 2, -1, -2, 1); display->SetTextureParameter("texture", _iTextures[TEXTURE_PRESSURE]); break; case DISPLAY_VORTICITY: display = (bilerp) ? &_displayScalarBilerp : &_displayScalar; display->SetFragmentParameter4f("bias", 0, 0, 0, 0); display->SetFragmentParameter4f("scale", 1, 1, -1, 1); display->SetTextureParameter("texture", _iTextures[TEXTURE_VORTICITY]); break; } } display->Compute(); // See the comments about makeTex at the top of this method. if (makeTex) { glBindTexture(GL_TEXTURE_2D, _iDisplayTexture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, _iWidth, _iHeight); glPopAttrib(); // GL_VIEWPORT_BIT glEnable(GL_TEXTURE_2D); // now display glBegin(GL_QUADS); { glTexCoord2f(0, 0); glVertex2f(0, 0); glTexCoord2f(1, 0); glVertex2f(1, 0); glTexCoord2f(1, 1); glVertex2f(1, 1); glTexCoord2f(0, 1); glVertex2f(0, 1); } glEnd(); glDisable(GL_TEXTURE_2D); } if (displayBoundary) { glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glBindTexture(GL_TEXTURE_2D, _iBCDisplayTexture); glEnable(GL_TEXTURE_2D); glActiveTextureARB(GL_TEXTURE1_ARB); glTexEnvf(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_MODULATE); glBindTexture(GL_TEXTURE_2D, _iBCDetailTexture); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glEnable(GL_TEXTURE_2D); glBegin(GL_QUADS); { glColor4f(1, 1, 1, 1); glTexCoord2f(0, 0); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0, 0); glVertex2f(0, 0); glTexCoord2f(1, 0); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1, 0); glVertex2f(1, 0); glTexCoord2f(1, 1); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1, 1); glVertex2f(1, 1); glTexCoord2f(0, 1); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0, 1); glVertex2f(0, 1); } glEnd(); glDisable(GL_TEXTURE_2D); glActiveTextureARB(GL_TEXTURE0_ARB); glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); } }
void gDP_TexRect(unsigned int w0, unsigned int w1, unsigned int w2, unsigned int w3) { // dbgprintf(0,0,"%s(%08x, %08x, %08x, %08x);", __FUNCTION__,w0,w1,w2,w3); // CALCULATE! unsigned int ULX = _SHIFTR(w1, 12, 12) / 2; unsigned int ULY = _SHIFTR(w1, 0, 12) / 2; unsigned int LRX = _SHIFTR(w0, 12, 12) / 2; unsigned int LRY = _SHIFTR(w0, 0, 12) / 2; float ULS[2], ULT[2], LRS[2], LRT[2]; float Off_S = (float)((short)((w2 & 0xFFFF0000) >> 16)) / 32.0f; float Off_T = (float)((short)(w2 & 0x0000FFFF)) / 32.0f; float DSDX = (float)((short)((w3 & 0xFFFF0000) >> 16)) / 1024.0f; float DTDY = (float)((short)(w3 & 0x0000FFFF)) / 1024.0f; if(Gfx.OtherMode.cycleType >= 2) { DSDX = 1.0f; LRX++; LRY++; } // dbgprintf(0,0,"Coords: %i, %i -> %i, %i", ULX, ULY, LRX, LRY); if(Gfx.OtherMode.cycleType == G_CYC_COPY) DSDX /= 4.0f; float Off_X = (float)Off_S; float Off_Y = (float)Off_T; float Off_Size_X = (float)((LRX - ULX) * DSDX); float Off_Size_Y = (float)((LRY - ULY) * DTDY); RDP_InitLoadTexture(); int i = 0; for(i = 0; i < 2; i++) { Texture[i].TexRectW = Off_Size_X; Texture[i].TexRectH = Off_Size_Y; Texture[i].IsTexRect = true; RDP_CalcTextureSize(i); // dbgprintf(0,0,"Tex%i: RW:%i, RH:%i", i, Texture[i].RealWidth, Texture[i].RealHeight); float SX = 1.0f, SY = 1.0f; if(Texture[i].ShiftS > 10) { SX = (1 << (16 - Texture[i].ShiftS)); } else if(Texture[i].ShiftS > 0) { SX /= (1 << Texture[i].ShiftS); } if(Texture[i].ShiftT > 10) { SY = (1 << (16 - Texture[i].ShiftT)); } else if(Texture[i].ShiftT > 0) { SY /= (1 << Texture[i].ShiftT); } ULS[i] = (Off_X * SX); ULT[i] = (Off_Y * SY); ULS[i] -= Texture[i].ULS + Texture[i].ScaleS - 0.5f; ULT[i] -= Texture[i].ULT + Texture[i].ScaleT - 0.5f; LRS[i] = (ULS[i] + Off_Size_X * SX - 1.0f); LRT[i] = (ULT[i] + Off_Size_Y * SY - 1.0f); ULS[i] /= Texture[i].RealWidth * 2.0f; ULT[i] /= Texture[i].RealHeight * 2.0f; LRS[i] /= Texture[i].RealWidth * 2.0f; LRT[i] /= Texture[i].RealHeight * 2.0f; // dbgprintf(0,0,"Tex%i: ULS:%4.2f, ULT:%4.2f, LRS:%4.2f, LRS:%4.2f", i, ULS[i], ULT[i], LRS[i], LRT[i]); } // RENDER! if(Gfx.Update) RDP_UpdateGLStates(); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glOrtho(0, System.DrawWidth, System.DrawHeight, 0, -2048, 2048); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); if(Gfx.OtherMode.cycleType == G_CYC_FILL) { glColor4f(Gfx.FillColor.R, Gfx.FillColor.G, Gfx.FillColor.B, Gfx.FillColor.A); } else { glColor4f(Gfx.BlendColor.R, Gfx.BlendColor.G, Gfx.BlendColor.B, Gfx.BlendColor.A); } glBegin(GL_QUADS); if(OpenGL.Ext_MultiTexture) { glMultiTexCoord2fARB(GL_TEXTURE0_ARB, ULS[0], ULT[0]); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, ULS[1], ULT[1]); glVertex2d(ULX, ULY); glMultiTexCoord2fARB(GL_TEXTURE0_ARB, LRS[0], ULT[0]); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, LRS[1], ULT[1]); glVertex2d(LRX, ULY); glMultiTexCoord2fARB(GL_TEXTURE0_ARB, LRS[0], LRT[0]); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, LRS[1], LRT[1]); glVertex2d(LRX, LRY); glMultiTexCoord2fARB(GL_TEXTURE0_ARB, ULS[0], LRT[0]); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, ULS[1], LRT[1]); glVertex2d(ULX, LRY); } else { glTexCoord2f(ULS[0], ULT[0]); glVertex2d(ULX, ULY); glTexCoord2f(LRS[0], ULT[0]); glVertex2d(LRX, ULY); glTexCoord2f(LRS[0], LRT[0]); glVertex2d(LRX, LRY); glTexCoord2f(ULS[0], LRT[0]); glVertex2d(ULX, LRY); } glEnd(); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); // dbgprintf(0,0,"TEXRECT done.\n\n"); }
void DrawScene (WindowData *pwdata) { // If WIN_swap_hint extension is supported, use it to create GREEN // border around the frame. We render the first frame with GREEN. // The second frame is the actual rendering rectangle - but is // swapped with a smaller swap rectangle. if (pwdata->hasWinSwapHint) { glClearColor (0.0, 1.0, 0.0, 0.0); // GREEN glClear(GL_COLOR_BUFFER_BIT); SwapBuffers (pwdata->hDC); // Setup the swap hint rect for the next frame //========================================================== //========================================================== // Use an extension function without doing anything special! // OpenGL 1.2, OpenGL 1.3 procs can be used similarly - as // long we ensure it is supported - just as we have done // for SwapHint here. //========================================================== //========================================================== glAddSwapHintRectWIN(20, 20, pwdata->width - 40, pwdata->height - 40); } // Render a triangle - multi-textured if ARB_multitexture is supported. glClearColor (0.0, 0.0, 0.0, 0.0); // BLACK glClear(GL_COLOR_BUFFER_BIT); glMatrixMode (GL_MODELVIEW); glLoadIdentity(); glRotatef (pwdata->spin, 0.0, 0.0, 1.0); pwdata->spin += 2; if (pwdata->spin >= 360) { pwdata->spin = 0; } if (pwdata->hasMultitexture) { //========================================================== //========================================================== // Use an extension function without doing anything special! // OpenGL 1.2, OpenGL 1.3 procs can be used similarly - as // long we ensure it is supported - just as we have done // for MultiTexCoord here. //========================================================== //========================================================== glBegin( GL_POLYGON ); glMultiTexCoord2fARB (GL_TEXTURE1_ARB, 0.0, 0.0); glColor3f (1.0, 0.0, 0.0); glVertex3f(0.0, 0.0, 0.0); glMultiTexCoord2fARB (GL_TEXTURE1_ARB, 1.0, 0.0); glColor3f (0.0, 1.0, 0.0); glVertex3f(0.5, 0.0, 0.0); glMultiTexCoord2fARB (GL_TEXTURE1_ARB, 1.0, 1.0); glColor3f (0.0, 0.0, 1.0); glVertex3f(0.5, 0.5, 0.0); glEnd(); } else { glBegin( GL_POLYGON ); glColor3f (1.0, 0.0, 0.0); glVertex3f(0.0, 0.0, 0.0); glColor3f (0.0, 1.0, 0.0); glVertex3f(0.5, 0.0, 0.0); glColor3f (0.0, 0.0, 1.0); glVertex3f(0.5, 0.5, 0.0); glEnd(); } SwapBuffers (pwdata->hDC); }
void LLPostProcess::drawOrthoQuad(unsigned int width, unsigned int height, QuadType type) { #if 0 float noiseX = 0.f; float noiseY = 0.f; float screenRatio = 1.0f; if (type == QUAD_NOISE){ noiseX = ((float) rand() / (float) RAND_MAX); noiseY = ((float) rand() / (float) RAND_MAX); screenRatio = (float) width / (float) height; } glBegin(GL_QUADS); if (type != QUAD_BLOOM_EXTRACT){ glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.f, (GLfloat) height); } else { glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.f, (GLfloat) height * 2.0f); } if (type == QUAD_NOISE){ glMultiTexCoord2fARB(GL_TEXTURE1_ARB, noiseX, noiseTextureScale + noiseY); } else if (type == QUAD_BLOOM_COMBINE){ glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.f, (GLfloat) height * 0.5f); } glVertex2f(0.f, (GLfloat) screenH - height); if (type != QUAD_BLOOM_EXTRACT){ glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.f, 0.f); } else { glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.f, 0.f); } if (type == QUAD_NOISE){ glMultiTexCoord2fARB(GL_TEXTURE1_ARB, noiseX, noiseY); } else if (type == QUAD_BLOOM_COMBINE){ glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.f, 0.f); } glVertex2f(0.f, (GLfloat) height + (screenH - height)); if (type != QUAD_BLOOM_EXTRACT){ glMultiTexCoord2fARB(GL_TEXTURE0_ARB, (GLfloat) width, 0.f); } else { glMultiTexCoord2fARB(GL_TEXTURE0_ARB, (GLfloat) width * 2.0f, 0.f); } if (type == QUAD_NOISE){ glMultiTexCoord2fARB(GL_TEXTURE1_ARB, screenRatio * noiseTextureScale + noiseX, noiseY); } else if (type == QUAD_BLOOM_COMBINE){ glMultiTexCoord2fARB(GL_TEXTURE1_ARB, (GLfloat) width * 0.5f, 0.f); } glVertex2f((GLfloat) width, (GLfloat) height + (screenH - height)); if (type != QUAD_BLOOM_EXTRACT){ glMultiTexCoord2fARB(GL_TEXTURE0_ARB, (GLfloat) width, (GLfloat) height); } else { glMultiTexCoord2fARB(GL_TEXTURE0_ARB, (GLfloat) width * 2.0f, (GLfloat) height * 2.0f); } if (type == QUAD_NOISE){ glMultiTexCoord2fARB(GL_TEXTURE1_ARB, screenRatio * noiseTextureScale + noiseX, noiseTextureScale + noiseY); } else if (type == QUAD_BLOOM_COMBINE){ glMultiTexCoord2fARB(GL_TEXTURE1_ARB, (GLfloat) width * 0.5f, (GLfloat) height * 0.5f); } glVertex2f((GLfloat) width, (GLfloat) screenH - height); glEnd(); #endif }