From patchwork Thu Jul 21 12:36:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandros Frantzis X-Patchwork-Id: 2916 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id A454E23F4D for ; Thu, 21 Jul 2011 12:36:46 +0000 (UTC) Received: from mail-qw0-f52.google.com (mail-qw0-f52.google.com [209.85.216.52]) by fiordland.canonical.com (Postfix) with ESMTP id 5BD3DA184BF for ; Thu, 21 Jul 2011 12:36:46 +0000 (UTC) Received: by qwb8 with SMTP id 8so850408qwb.11 for ; Thu, 21 Jul 2011 05:36:45 -0700 (PDT) Received: by 10.229.25.212 with SMTP id a20mr168967qcc.148.1311251805794; Thu, 21 Jul 2011 05:36:45 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.229.217.78 with SMTP id hl14cs139338qcb; Thu, 21 Jul 2011 05:36:45 -0700 (PDT) Received: by 10.227.62.208 with SMTP id y16mr169913wbh.80.1311251795550; Thu, 21 Jul 2011 05:36:35 -0700 (PDT) Received: from adelie.canonical.com (adelie.canonical.com [91.189.90.139]) by mx.google.com with ESMTP id ge8si2365688wbb.143.2011.07.21.05.36.35; Thu, 21 Jul 2011 05:36:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.139 as permitted sender) client-ip=91.189.90.139; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.139 as permitted sender) smtp.mail=bounces@canonical.com Received: from loganberry.canonical.com ([91.189.90.37]) by adelie.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1QjsUT-0000D2-Jk for ; Thu, 21 Jul 2011 12:36:33 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 567092EA05D for ; Thu, 21 Jul 2011 12:36:32 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: glmark2 X-Launchpad-Branch: ~glmark2-dev/glmark2/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 32 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~glmark2-dev/glmark2/trunk] Rev 32: Add "MaterialTexture0" uniform. Message-Id: <20110721123632.17019.43166.launchpad@loganberry.canonical.com> Date: Thu, 21 Jul 2011 12:36:32 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="13475"; Instance="initZopeless config overlay" X-Launchpad-Hash: f9de298f37ac933226b3d6dfc90214350c915f46 ------------------------------------------------------------ revno: 32 committer: Alexandros Frantzis timestamp: Fri 2010-07-09 16:34:12 +0300 message: Add "MaterialTexture0" uniform. Rename "texture" vertex attribute to "texcoord". modified: data/shaders/light-advanced.vert data/shaders/light-basic.frag data/shaders/light-basic.vert shader.cpp shader.h --- lp:glmark2 https://code.launchpad.net/~glmark2-dev/glmark2/trunk You are subscribed to branch lp:glmark2. To unsubscribe from this branch go to https://code.launchpad.net/~glmark2-dev/glmark2/trunk/+edit-subscription === modified file 'data/shaders/light-advanced.vert' --- data/shaders/light-advanced.vert 2010-07-09 09:48:40 +0000 +++ data/shaders/light-advanced.vert 2010-07-09 13:34:12 +0000 @@ -1,6 +1,5 @@ attribute vec3 position; attribute vec3 normal; -attribute vec2 texture; uniform mat4 ModelViewProjectionMatrix; uniform mat4 NormalMatrix; === modified file 'data/shaders/light-basic.frag' --- data/shaders/light-basic.frag 2010-07-08 15:48:22 +0000 +++ data/shaders/light-basic.frag 2010-07-09 13:34:12 +0000 @@ -1,4 +1,5 @@ varying vec4 Color; +varying vec2 TextureCoord; void main(void) { === modified file 'data/shaders/light-basic.vert' --- data/shaders/light-basic.vert 2010-07-09 10:28:57 +0000 +++ data/shaders/light-basic.vert 2010-07-09 13:34:12 +0000 @@ -1,6 +1,6 @@ attribute vec3 position; attribute vec3 normal; -attribute vec2 texture; +attribute vec2 texcoord; uniform mat4 ModelViewProjectionMatrix; uniform mat4 NormalMatrix; @@ -8,6 +8,7 @@ uniform vec3 MaterialColor; varying vec4 Color; +varying vec2 TextureCoord; void main(void) { @@ -22,6 +23,9 @@ float diffuse = max(dot(N, L), 0.0); Color = diffuse * vec4(MaterialColor, 1.0); + // Set the texture coordinates as a varying + TextureCoord = texcoord; + // Transform the position to clip coordinates gl_Position = ModelViewProjectionMatrix * vec4(position, 1.0); } === modified file 'shader.cpp' --- shader.cpp 2010-07-09 11:16:34 +0000 +++ shader.cpp 2010-07-09 13:34:12 +0000 @@ -66,7 +66,7 @@ glAttachObjectARB(mShaderProgram, mVertexShader); glBindAttribLocation(mShaderProgram, VertexAttribLocation, "position"); glBindAttribLocation(mShaderProgram, NormalAttribLocation, "normal"); - glBindAttribLocation(mShaderProgram, TexCoordAttribLocation, "texture"); + glBindAttribLocation(mShaderProgram, TexCoordAttribLocation, "texcoord"); glLinkProgram(mShaderProgram); glGetShaderInfoLog(mShaderProgram, sizeof msg, NULL, msg); @@ -97,9 +97,12 @@ "MaterialSpecular"); mLocations.MaterialColor = glGetUniformLocation(mShaderProgram, "MaterialColor"); + mLocations.MaterialTexture0 = glGetUniformLocation(mShaderProgram, + "MaterialTexture0"); + glUniform1i(mLocations.MaterialTexture0, 0); #ifdef _DEBUG - printf("Uniform Locations: %d %d %d %d %d %d %d %d %d %d %d\n", + printf("Uniform Locations: %d %d %d %d %d %d %d %d %d %d %d %d\n", mLocations.ModelViewProjectionMatrix, mLocations.NormalMatrix, mLocations.LightSourcePosition, @@ -110,7 +113,8 @@ mLocations.MaterialAmbient, mLocations.MaterialDiffuse, mLocations.MaterialSpecular, - mLocations.MaterialColor); + mLocations.MaterialColor, + mLocations.MaterialTexture); #endif } === modified file 'shader.h' --- shader.h 2010-07-09 11:16:34 +0000 +++ shader.h 2010-07-09 13:34:12 +0000 @@ -31,6 +31,7 @@ GLint MaterialDiffuse; GLint MaterialSpecular; GLint MaterialColor; + GLint MaterialTexture0; } mLocations; enum {