OpenGL Orthographic Projection problems on emulator (rendering 1/4 size)

by Robert Green » Thu, 20 Aug 2009 13:07:50 GMT


Sponsored Links
  seem to have found the bug.  The problem appears to be with how
Fixed Point numbers are used with glOrthox. The specification is such
that glOrtho creates a relative number of "pixels" that can be used -
so no matter what the actual screen resolution is, you get to draw to
whatever you defined as your coordinate system in glOrtho. This means
that instead of converting everything to FP (int << 16), you can just
put the regular int in for the width and height of the orthographic
projection and then use regular ints in your geometry. This works
correctly on the device and in every opengl example I've seen, but the
emulator doesn't like it. Here's what I found:

Testing landscape full screen 480x320

glOrthox(0, 480, 320, 0, 0, 1) and geometry using ints (320, 480)
works on device but not on emulator (1/2 length and width show up)
glOrthox(0, 480 << 16, 320 << 16, 0, 0, 1) and geometry using FP (320
<< 16, 480 << 16) works on both emulator and device
glOrthof(0, 480f, 320f, 0, 0, 1) and geometry using floats (320f x
480f) works on both emulator and device
glOrthof(0, 480f, 320f, 0, 0, 1) and geometry using FP (320 << 16, 480
<< 16) works on both emulator and device

I think it's a bug that the first method doesn't work, but I'll just
convert everything to FP and forget about it.

On Aug 19, 11:44pm, Robert Green <rbgrn....@gmail.com> wrote:
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Where can I download "Android SDK source code" ?

Source.android.com




Dear *

Where can I download "Android SDK source code" ?

BR
Frederic

-- 
-----------------------------------------------------
Fedora-ambassadors-list mailing list
fedora-ambassadors-l...@redhat.com
Olpc mailing list
olpc-o...@laptop.org

--

2. About Sqlite Database

I have done database related work by android that was succesfully work
and show the data on the listview and insert,update,delete operation
is ok now, but I have one problem, I can't get the database, only i
see the database name by using eclipes

windows-->show view -->others -->File explorar

when i run my application in android mobile, there is no data at first
time, and database backup is not found

how can i solve this
problem...................................................


i create the database by this
way....................................................


Constants.java
import android.provider.BaseColumns;

public interface Constants extends BaseColumns {
   public static final String TABLE_NAME = "myupdate";

   // Columns in the Events database
   public static final String NAME = "name";
  // public static final String  ADDRESS = "address";
   //public static final String MOBILE = "mobile";
   // static final String  HOME= "home";
}

DBHelper.java
import static android.provider.BaseColumns._ID;
import static dbupdate.example.com.Constants.TABLE_NAME;
import static dbupdate.example.com.Constants.NAME;
//import static dbproject.example.com.Constants.ADDRESS;
//import static dbproject.example.com.Constants.MOBILE;
//import static dbproject.example.com.Constants.HOME;
import android.content.ContentValues;
import android.database.SQLException;
import android.util.Log;
import android.database.Cursor;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DBHelper extends SQLiteOpenHelper {
   private static final String DATABASE_NAME = "UpdateDB";
   private static final int DATABASE_VERSION = 1;
   private SQLiteDatabase db;
   /** Create a helper object for the Events database */
   public DBHelper(Context ctx) {
      super(ctx, DATABASE_NAME, null, DATABASE_VERSION);
   }

   @Override
   public void onCreate(SQLiteDatabase db) {
      db.execSQL("CREATE TABLE " + TABLE_NAME + " (" + _ID
            + " INTEGER PRIMARY KEY AUTOINCREMENT, " + NAME
            + " TEXT NOT NULL);");
   }

   @Override
   public void onUpgrade(SQLiteDatabase db, int oldVersion,
         int newVersion) {
      db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
      onCreate(db);
   }
   public void createRow(String name) {
       ContentValues initialValues = new ContentValues();
       initialValues.put("NAME", name);
      // initialValues.put("ADDRESS", address);
       //initialValues.put("MOBILE", mobile);
       //initialValues.put("HOME", home);
       db.insert(TABLE_NAME, null, initialValues);
       }
   public Cursor GetAllRows() {
       try {
           //Cursor c =
           return db.query(TABLE_NAME, new String[] {
                   "_id", "name"}, null, null, null, null, null);
           //return c;
       } catch (SQLException e) {
           Log.e("Exception on query", e.toString());
           return null;
       }
   }

}

--

3. Clicking ItemizedItem

4. Understand Device deep sleep behavior and its affect on the application.

5. Understand Device deep sleep behavior and its affect on the application.

6. Where can I download "Android SDK source code" ?

7. AlertDialog problem: always get NULL values