小编Trt*_*Trt的帖子

问题了解OpenGL中的光照

我在理解OpenGL中的光照效果方面遇到了一些问题(特别是理解预定义的变量.在某处有一个列表吗?).我一直在我的Vertex Shader文件中弄乱我的shpere.所以我设法掩盖它,但我不知道我做了什么.这是代码:

顶点着色器:

#version 330
precision highp float;

in vec3 in_Position; //declare position
in vec3 in_Color; //color passed from the cpp file

//mycode
in vec3 in_Normal;

// mvpmatrix is the result of multiplying the model, view, and projection matrices */
uniform mat4 MVP_matrix;

vec3 ambient;

out vec3 ex_Color;

void main(void) {

// Multiply the MVP_ matrix by the vertex to obtain our final vertex position (mvp was created in *.cpp)

gl_Position = MVP_matrix * vec4(in_Position, 1.0);

//mycode
ambient = vec3(0.0f,0.1f,1.0f); …
Run Code Online (Sandbox Code Playgroud)

opengl glsl

0
推荐指数
1
解决办法
425
查看次数

如何将这个片段放在另一个片段之上?

我有这个观点:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="@color/DeepSkyBlue"
    tools:context=".MainPreviewActivity"
    android:weightSum="5">

    <fragment
        android:name="com.apps.foo.bar.CleanPreviewFragment"
        android:id="@+id/clean_preview_fragment"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:layout_width="match_parent"/>

    <fragment
        android:name="com.apps.foo.bar.ProcessedPreviewFragment"
        android:id="@+id/processed_preview_fragment"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:layout_width="match_parent"/>

    <View
        android:id="@+id/center_dummy_view"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:layout_width="match_parent"/>

    <ListView
        android:layout_height="0dp"
        android:layout_weight="2"
        android:layout_width="match_parent"
        android:id="@+id/lvImageProcessChoices"/>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我想要将带有id的片段clean_preview_fragment替换为带有id的片段processed_preview_fragment.

我的应用程序需要在后台运行一个摄像头,以便获取帧,处理它们并在其中显示它们processed_preview_fragment.

这是我的代码:

processedPreviewFragment = (ProcessedPreviewFragment) fragmentManager.findFragmentById(R.id.processed_preview_fragment);

if(getResources().getConfiguration().orientation == getResources().getConfiguration().ORIENTATION_PORTRAIT){
            FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
            fragmentTransaction.replace(R.id.clean_preview_fragment, processedPreviewFragment);
            fragmentTransaction.commit();
        }
Run Code Online (Sandbox Code Playgroud)

那是我的MainActivity,onCreate.

我收到此错误:

java.lang.IllegalStateException: Can't change container ID of fragment ProcessedPreviewFragment{41b14770 #1 id=0x7f0e0050}: was 2131624016 now 2131624015
Run Code Online (Sandbox Code Playgroud)

android android-fragments

0
推荐指数
1
解决办法
983
查看次数

实例变量和attr_accessor

当我@foo=3initialize方法中定义时,我希望像这样访问我的变量.

class Object
  def initialize(v)
    @foo = v
  end

  Object.new.foo
Run Code Online (Sandbox Code Playgroud)

但这不会发生.我需要写attr_accessor :foo.为什么我需要这样做,即使@已经为我做了这个?

ruby

-1
推荐指数
1
解决办法
388
查看次数

Rails 4资产错误,没有加载图像

长话短说,因为我浪费了足够的时间与这个愚蠢的框架.我想使用纯CSS,没有SCSS,没有css.erb,没有mumbo-jumpo,它增加了更多的开销解析,即使它超过2ms.

我的production.rb文件有(我正在使用webrick):

Properties::Application.configure do
  # Settings specified here will take precedence over those in config/application.rb.

  # Code is not reloaded between requests.
  config.cache_classes = true

  # Eager load code on boot. This eager loads most of Rails and
  # your application in memory, allowing both thread web servers
  # and those relying on copy on write to perform better.
  # Rake tasks automatically ignore this option for performance.
  config.eager_load = true

  # Full error reports are disabled and caching is …
Run Code Online (Sandbox Code Playgroud)

css ruby ruby-on-rails ruby-on-rails-4

-4
推荐指数
1
解决办法
3439
查看次数