Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (575)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  How to go from Texture Id to Texture object?  (Read 1281 times)
0 Members and 1 Guest are viewing this topic.
Offline sgthale

Senior Newbie





« Posted 2012-04-29 03:09:56 »

When I use glGenTextures(). It only returns an int and not the texture itself. I want to keep track of all textures in an array but I have no way of storing it because well...it only returns an integer. How do I go about doing this? Do I even need to do this?
Offline lhkbob

JGO Knight


Medals: 32



« Reply #1 - Posted 2012-04-29 04:56:00 »

glGenTextures() is only supposed to return an integer.  It generates a unique id you can use for a new texture object.  The "texture object" is an object stored by OpenGL on the graphics card, it is not the same thing as any Java type named Texture (these would just wrap an integer received from glGenTextures() anyway).

Why can't you just store the texture id in the array?

Offline ra4king

JGO Kernel


Medals: 353
Projects: 3
Exp: 5 years


I'm the King!


« Reply #2 - Posted 2012-04-29 05:24:59 »

I don't think he even understand how textures or anything else in OpenGL work. @OP, read some tutorials first before asking RTFM-related questions Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline sproingie

JGO Kernel


Medals: 202



« Reply #3 - Posted 2012-04-29 05:34:31 »

As far as OpenGL is concerned, that int is the texture, or at least an opaque "handle" to one anyway.  The storage associated with the handle is something you allocate and manage separately.  This is how all objects in OpenGL work, from textures to buffer objects to shaders.  When you want to work with one of these objects, you "bind" them which sets them as the current object you're working on, and subsequent operations work on the texture or buffer or whatever you have bound.  It's a stateful API, it's a big pain in the ass, but welcome to OpenGL Tongue
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (34 views)
2014-10-17 03:59:02

Norakomi (25 views)
2014-10-16 15:22:06

Norakomi (24 views)
2014-10-16 15:20:20

lcass (26 views)
2014-10-15 16:18:58

TehJavaDev (50 views)
2014-10-14 00:39:48

TehJavaDev (50 views)
2014-10-14 00:35:47

TehJavaDev (40 views)
2014-10-14 00:32:37

BurntPizza (63 views)
2014-10-11 23:24:42

BurntPizza (36 views)
2014-10-11 23:10:45

BurntPizza (74 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!